#maxtradetopbar-wrapper {
    background-color: #003755;
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    width: 100%;
    z-index: 999999;
    /* Bar is ALWAYS fixed to the top — never toggled on scroll.
       This is what removes the layout jump: there is nothing to
       switch between "in flow" and "fixed", so there is no jump. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    border-bottom: 2px solid #e21a22;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease;
}

/* Reserve the space the fixed bar would otherwise occupy.
   JS sets --mtb-height to the bar's real measured height. */
body {
    padding-top: var(--mtb-height, 48px) !important;
}

body.mtb-scrolled #maxtradetopbar-wrapper {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.mtb-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.mtb-track {
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.mtb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.9;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: default;
    height: 100%;
    flex-shrink: 0;
    white-space: nowrap;
}

a.mtb-item {
    text-decoration: none !important;
    color: inherit !important;
    transition: opacity 0.2s ease;
}

a.mtb-item:hover {
    opacity: 0.85;
}

.mtb-item:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.mtb-duplicate {
    display: none !important;
}

.mtb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtb-text {
    font-size: 13px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    color: #e0e0e0;
}

.mtb-text strong {
    font-weight: 600;
    margin-right: 5px;
    color: #ffffff;
}

.mtb-logos {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

.mtb-pay-logo {
    height: 26px;
    width: auto;
    vertical-align: middle;
    border-radius: 4px;
    background-color: #ffffff;
    padding: 2px 4px;
}

.mtb-pay-logo.mtb-blik {
    background-color: #000000 !important;
    border-color: #000000 !important;
}

@keyframes mtb-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.3333%); }
}

@media (max-width: 850px) {
    #maxtradetopbar-wrapper {
        height: 46px !important;
    }

    .mtb-container {
        padding: 0;
        justify-content: flex-start;
        height: 46px !important;
    }
    
    .mtb-track {
        display: flex;
        width: max-content;
        justify-content: flex-start;
        animation: mtb-marquee 25s linear infinite;
    }
    
    .mtb-track:hover {
        animation-play-state: paused;
    }

    .mtb-item {
        padding: 0 20px 5px 20px !important; /* increased padding from bottom of text */
        width: auto;
    }

    .mtb-item.mtb-duplicate {
        display: flex !important;
    }

    .mtb-item:hover {
        transform: none;
    }
    
    .mtb-text {
        font-size: 12px;
    }
}

/* Desktop: no special rules needed here anymore — the bar is fixed
   at all times (see top of file), and the sticky-header offset is
   computed and applied dynamically by topbar.js based on the bar's
   real height, instead of being hardcoded per breakpoint. */
@media (min-width: 851px) {
    #maxtradetopbar-wrapper.mtb-no-warranty .mtb-track {
        justify-content: space-around;
        max-width: 850px;
        margin: 0 auto;
    }
}

/* --- INTERACTIVE MODAL POPUP SYSTEM --- */
.mtb-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1999999999 !important; /* Extremely high to sit on top of header/footer */
    display: none;
    align-items: center;
    justify-content: center;
}

.mtb-modal.mtb-show {
    display: flex;
}

.mtb-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.mtb-modal-content {
    position: relative;
    background: #ffffff;
    border: 1px solid #dfdfdf;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 485px;
    max-width: 92vw;
    padding: 24px;
    z-index: 2;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.mtb-modal.mtb-show .mtb-modal-content {
    transform: scale(1);
    opacity: 1;
}

.mtb-modal-close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    background: #ececec !important;
    border: none !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: #555555 !important;
    line-height: 22px !important;
    text-align: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    outline: none !important;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.mtb-modal-close:hover {
    background: #dfdfdf !important;
    transform: scale(1.05);
}

.mtb-modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
    margin-bottom: 16px;
    padding-right: 20px;
}

.mtb-modal-title {
    margin: 0 0 4px 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #003755 !important;
    line-height: 1.3 !important;
}

.mtb-modal-subtitle {
    margin: 0 !important;
    font-size: 12px !important;
    color: #666666 !important;
    line-height: 1.4 !important;
}

.mtb-modal-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mtb-modal-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background-color: #f4f8fa;
    border: 1px solid #e5eff5;
    border-radius: 8px;
    text-decoration: none !important;
    color: inherit !important;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

.mtb-modal-card:hover {
    background-color: #ffffff;
    border-color: #e21a22;
    box-shadow: 0 4px 15px rgba(0, 55, 85, 0.06);
    transform: translateY(-1px);
}

.mtr-card-icon-col {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: #ffffff;
    border: 1px solid #e2eff5;
    box-sizing: border-box;
}

.mtb-modal-card:hover .mtr-card-icon-col {
    border-color: #ffd2d4;
    background-color: #fff9f9;
}

.mtr-card-logo-img {
    height: 20px;
    width: auto;
    object-fit: contain;
}

.mtr-card-svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease-in-out;
}

.mtb-modal-card:hover .mtr-card-svg {
    transform: scale(1.08);
}

.mtr-card-text-col {
    display: flex;
    flex-direction: column;
}

.mtr-card-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #003755 !important;
    line-height: 1.3 !important;
    margin-bottom: 2px !important;
    transition: color 0.2s ease;
}

.mtb-modal-card:hover .mtr-card-title {
    color: #e21a22;
}

.mtr-card-desc {
    font-size: 11px !important;
    color: #555555 !important;
    line-height: 1.4 !important;
}

@media (max-width: 480px) {
    .mtb-modal-content {
        padding: 20px 16px;
    }
    .mtb-modal-title {
        font-size: 15px !important;
    }
    .mtb-modal-card {
        padding: 10px 12px;
        gap: 10px;
    }
    .mtr-card-icon-col {
        width: 28px;
        height: 28px;
    }
    .mtr-card-svg {
        width: 16px;
        height: 16px;
    }
    .mtr-card-logo-img {
        height: 16px;
    }
    .mtr-card-title {
        font-size: 12px !important;
    }
    .mtr-card-desc {
        font-size: 10.5px !important;
    }
}

/* Force wrapper to have no margin-top since we handle spacing via header padding-bottom */
#wrapper {
    margin-top: 0px !important;
}

#tvcms-mobile-view-header:has(.tvcmsheader-sticky.sticky) {
    padding-bottom: var(--mobile-header-height, 60px) !important;
}

#header:has(.tvcms-header-menu-offer-wrapper.tvcmsheader-sticky.sticky) {
    padding-bottom: var(--desktop-header-height, 50px) !important;
}
