/* ========================================================================
   RateBuddy Header
   File: public/css/header_2.css
   Clean external stylesheet for desktop, tablet, and mobile navigation.
   Load Inter from the document <head> with a <link> if exact font parity
   is required. This file deliberately avoids CSS @import.
   ======================================================================== */

.site-header {
    --rb-header-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --rb-header-link: #334155;
    --rb-header-hover: #0d6efd;
    --rb-header-top-height: 60px;
    --rb-header-bottom-height: 40px;
    --rb-header-anchor-width: 260px;

    position: relative;
    z-index: 1050;
    width: 100%;
    margin-bottom: 5px !important;
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    contain: layout;
    font-family: var(--rb-header-font);
}

.site-header *,
.site-header *::before,
.site-header *::after {
    box-sizing: border-box;
}

.site-header a {
    text-decoration: none;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.site-header img {
    display: block;
    vertical-align: bottom;
}

/* Desktop rows and core layout */
.site-header .header-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 15px;
}

.site-header .row-top {
    position: relative;
    z-index: 20;
    height: var(--rb-header-top-height);
    border-bottom: 1px solid #f0f0f0;
    background: #ffffff;
}

.site-header .row-btm {
    position: relative;
    z-index: 10;
    height: var(--rb-header-bottom-height);
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.site-header .col-anchor {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 var(--rb-header-anchor-width);
    width: var(--rb-header-anchor-width);
    min-width: var(--rb-header-anchor-width);
    height: 100%;
}

.site-header .logo-container {
    display: flex;
    align-items: center;
    height: 100%;
}

.site-header .logo-img {
    display: block;
    width: auto;
    height: 32px;
    transform: translateY(-4px);
}

.site-header .col-nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
}

.site-header .nav-item {
    position: static;
    display: flex;
    align-items: center;
    height: 100%;
    padding-right: 10px !important;
}

/* Desktop navigation buttons */
.site-header .nav-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 100%;
    margin-right: 0 !important;
    padding: 0 12px !important;
    gap: 6px !important;

    border: 0;
    background: transparent !important;
    color: var(--rb-header-link) !important;

    font-family: var(--rb-header-font);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    transition: color 0.2s ease;
}

.site-header .row-btm .nav-btn {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--rb-header-link) !important;
}

.site-header .nav-btn .arrow,
.site-header .arrow {
    margin-top: 1px;
    margin-left: 0 !important;
    color: inherit !important;
    font-size: 11px;
    opacity: 0.6;
    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.site-header .nav-btn:hover,
.site-header .nav-item.is-active .nav-btn {
    color: var(--rb-header-hover) !important;
}

.site-header .nav-btn:hover .arrow,
.site-header .nav-item.is-active .arrow {
    opacity: 1;
}

.site-header .nav-item.is-active .arrow {
    transform: rotate(180deg);
}

.site-header .nav-btn::after {
    content: "";
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    height: 2px;
    border-radius: 2px;
    background: var(--rb-header-hover);
    pointer-events: none;
    will-change: transform;
    transform: scaleX(0) translateZ(0);
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.site-header .row-btm .nav-btn::after {
    bottom: 2px;
}

.site-header .nav-btn:hover::after,
.site-header .nav-item.is-active .nav-btn::after {
    transform: scaleX(1);
}

/* Mega menus */
.site-header .dropdown-pane {
    display: none;
    position: absolute;
    left: 0;
    z-index: 1100;
    width: 100%;
    padding: 20px 0;
    border-top: 1px solid #eeeeee;
    background: #ffffff;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
    cursor: default;
}

.site-header .row-top .dropdown-pane {
    top: var(--rb-header-top-height);
}

.site-header .row-btm .dropdown-pane {
    top: var(--rb-header-bottom-height);
}

.site-header .nav-item.is-active .dropdown-pane {
    display: block;
}

.site-header .mm-inner-container {
    width: 100%;
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 40px;
}

.site-header .mm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    justify-content: center;
    gap: 40px;
}

.site-header .mm-title {
    display: block;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f5f5f5;
    color: #8898aa;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.site-header .mm-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-header .mm-list li {
    margin: 0;
    padding: 0;
}

.site-header .mm-list a {
    display: block;
    margin-right: -6px;
    margin-left: -6px;
    padding: 1px 6px;
    border-radius: 4px;
    color: #333333;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

.site-header .mm-list a:hover {
    color: var(--rb-header-hover);
    background: #f0f4ff;
}

.site-header .mm-list a.fw-bold {
    color: #000000;
    font-weight: 700 !important;
}

.site-header .mm-sep {
    margin-top: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #eeeeee;
}

.site-header .mm-sep span {
    color: var(--rb-header-hover);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Logo-side utility elements */
.site-header .home-icon-svg {
    width: 20px;
    height: 20px;
    margin-top: 4px;
    margin-left: 14px;
    fill: #adb5bd;
    cursor: pointer;
    transition:
        fill 0.2s ease,
        transform 0.2s ease;
}

.site-header .home-icon-link:hover .home-icon-svg {
    fill: var(--rb-header-hover);
    transform: scale(1.1);
}

.site-header .row-btm .col-anchor {
    justify-content: center !important;
    padding-left: 0;
}

.site-header .canadian-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 2px;
    opacity: 0.9;
}

.site-header .flag-icon {
    width: auto;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.site-header .flag-text {
    margin-top: 1px;
    color: #666666;
    font-family: var(--rb-header-font);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    text-transform: uppercase;
}

/* Header actions: desktop and signed-in account */
.site-header .header-col-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    align-content: center !important;
    flex: 0 0 auto;
    width: auto !important;
    height: 100%;
    margin-left: auto;
    gap: 0.42rem !important;
}

.site-header .rb-header-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 34px;
    margin: 0 !important;
    padding: 0.48rem 0.66rem !important;
    gap: 0.38rem;

    border: 1px solid transparent;
    border-radius: 0.68rem;

    font-family: var(--rb-header-font);
    font-size: 0.73rem !important;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;

    transition:
        color 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

.site-header .rb-header-action i {
    flex: 0 0 auto;
    font-size: 0.9rem;
    line-height: 1;
}

.site-header .rb-header-action--secondary {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #334155 !important;
}

.site-header .rb-header-action--secondary:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--rb-header-hover) !important;
    transform: translateY(-1px);
}

.site-header .rb-header-action--primary {
    border-color: #0d6efd;
    background: #0d6efd;
    color: #ffffff !important;
    box-shadow: 0 7px 16px -12px rgba(13, 110, 253, 0.95);
}

.site-header .rb-header-action--primary:hover {
    border-color: #0b5ed7;
    background: #0b5ed7;
    color: #ffffff !important;
    box-shadow: 0 10px 20px -13px rgba(13, 110, 253, 1);
    transform: translateY(-1px);
}

.site-header .rb-header-account-dropdown {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.site-header .rb-header-account-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: 0;
    padding: 0.28rem 0.58rem;
    gap: 0.38rem;

    border: 1px solid #dbe3ee;
    border-radius: 0.68rem;
    background: #ffffff;
    color: #334155;
    box-shadow: 0 5px 14px -12px rgba(15, 23, 42, 0.65);

    font-family: var(--rb-header-font);
    font-size: 0.73rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;

    transition:
        color 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.site-header .rb-header-account-btn:hover,
.site-header .rb-header-account-btn[aria-expanded="true"] {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--rb-header-hover);
}

.site-header .rb-header-account-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 0.48rem;
    background: #eaf2ff;
    color: var(--rb-header-hover);
    font-size: 0.78rem;
}

.site-header .rb-header-account-name {
    overflow: hidden;
    max-width: 100px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header .rb-header-account-arrow {
    color: #94a3b8;
    font-size: 0.58rem;
}

.site-header .rb-header-account-menu {
    min-width: 180px;
    margin-top: 0.5rem !important;
    padding: 0.42rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.78rem;
    font-family: var(--rb-header-font);
    font-size: 0.8rem;
    box-shadow: 0 18px 36px -24px rgba(15, 23, 42, 0.65);
}

.site-header .rb-header-account-menu-item {
    display: flex;
    align-items: center;
    gap: 0.52rem;
    padding: 0.58rem 0.62rem;
    border-radius: 0.5rem;
    color: #334155;
    font-weight: 650;
}

.site-header .rb-header-account-menu-item i {
    width: 1rem;
    color: #64748b;
    text-align: center;
}

.site-header .rb-header-account-menu-item:hover {
    background: #eff6ff;
    color: var(--rb-header-hover);
}

.site-header .rb-header-account-menu-item--danger,
.site-header .rb-header-account-menu-item--danger i {
    color: #dc2626;
}

.site-header .rb-header-account-menu-item--danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.site-header .rb-header-action:focus-visible,
.site-header .rb-header-account-btn:focus-visible,
.site-header .rb-mobile-header-action:focus-visible,
.site-header .mob-toggle-btn:focus-visible,
.site-header .nav-btn:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.22);
    outline-offset: 2px;
}

/* Mobile header and accordion menu */
.site-header .mobile-header-bar,
.site-header .mobile-dropdown-menu {
    display: none;
}

@media (max-width: 767px) {
    .site-header .row-top,
    .site-header .row-btm {
        display: none !important;
    }

    .site-header .mobile-header-bar {
        position: relative;
        z-index: 1050;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 12px;
        border-bottom: 1px solid #e5e5e5;
        background: #ffffff;
    }

    .site-header .mob-left-group {
        display: flex;
        align-items: center;
        min-width: 0;
        gap: 10px;
    }

    .site-header .mob-right-group {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 0 0 auto;
        gap: 0.34rem !important;
    }

    .site-header .mob-toggle-btn {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #333333;
        font-size: 26px;
        line-height: 1;
        cursor: pointer;
    }

    .site-header .rb-mobile-header-action {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        margin: 0;
        padding: 0;
        border: 1px solid #e2e8f0;
        border-radius: 0.68rem;
        background: #f8fafc;
        color: #334155;
        font-size: 0.92rem;
        line-height: 1;
        transition:
            color 0.16s ease,
            background-color 0.16s ease,
            border-color 0.16s ease,
            transform 0.16s ease;
    }

    .site-header .rb-mobile-header-action:hover {
        border-color: #bfdbfe;
        background: #eff6ff;
        color: var(--rb-header-hover);
    }

    .site-header .rb-mobile-header-action--primary {
        border-color: #0d6efd;
        background: #0d6efd;
        color: #ffffff;
        box-shadow: 0 7px 15px -12px rgba(13, 110, 253, 1);
    }

    .site-header .rb-mobile-header-action--primary:hover {
        border-color: #0b5ed7;
        background: #0b5ed7;
        color: #ffffff;
    }

    .site-header .mobile-dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1040;
        display: none;
        width: 300px;
        max-width: 85vw;
        max-height: 85vh;
        overflow-y: auto;
        border-right: 1px solid #eeeeee;
        border-bottom: 1px solid #eeeeee;
        background: #ffffff;
        box-shadow: 4px 10px 20px rgba(15, 23, 42, 0.1);
    }

    .site-header .mobile-dropdown-menu.is-open {
        display: block !important;
    }

    .site-header .mob-nav-item {
        border-bottom: 1px solid #f9f9f9;
    }

    .site-header .mob-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 20px;
        background: #ffffff;
        color: #333333;
        font-size: 1rem;
        font-weight: 500;
        cursor: pointer;
    }

    .site-header .mob-nav-header:hover {
        background: #f8f9fa;
        color: var(--rb-header-hover);
    }

    .site-header .mob-plus-icon {
        color: #999999;
        font-size: 18px;
        font-weight: 300;
    }

    .site-header .mob-submenu {
        display: none;
        padding: 0;
        border-top: 1px solid #f0f0f0;
        background: #fcfcfc;
    }

    .site-header .mob-submenu.is-expanded {
        display: block;
    }

    .site-header .mob-section-header,
    .site-header .mob-col-header {
        display: block;
        margin-top: 0;
        padding: 8px 20px;
        border-top: 1px solid #e9ecef;
        border-bottom: 1px solid #e9ecef;
        background: #f1f3f5;
        color: #495057;
        font-size: 0.7rem;
        font-weight: 800;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }

    .site-header .mob-sub-link {
        display: block;
        padding: 10px 20px 10px 25px !important;
        border-bottom: 1px solid #fcfcfc;
        background: #ffffff;
        color: #555555;
        font-size: 0.95rem;
    }

    .site-header .mob-sub-link:last-child {
        border-bottom: 0;
    }

    .site-header .mob-sub-link:hover {
        background: #f0f4ff;
        color: var(--rb-header-hover);
    }

    .site-header .mob-static-link {
        display: block;
        padding: 14px 20px;
        border-bottom: 1px solid #f9f9f9;
        color: #333333;
        font-size: 1rem;
    }
}

/* Tablet and smaller desktop */
@media (min-width: 768px) {
    .site-header .row-top,
    .site-header .row-btm {
        display: flex !important;
    }

    .site-header .mobile-header-bar,
    .site-header .mobile-dropdown-menu {
        display: none !important;
    }
}


@media (min-width: 768px) and (max-width: 1350px) {
    .site-header .col-anchor {
        flex-basis: auto;
        width: auto !important;
        min-width: 180px !important;
        padding-right: 10px !important;
    }

    .site-header .col-nav {
        display: flex !important;
        align-items: center;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
    }

    .site-header .nav-btn {
        width: auto !important;
        padding: 0 8px !important;
        white-space: nowrap !important;
    }
}



@media (min-width: 768px) and (max-width: 1250px) {
    .site-header .logo-img {
        width: auto;
        height: 26px !important;
    }

    .site-header .home-icon-svg {
        width: 18px !important;
        height: 18px !important;
        margin-left: 8px !important;
    }

    .site-header .col-nav {
        padding-left: 5px !important;
    }

    .site-header .nav-btn {
        font-size: 0.75rem !important;
    }

    .site-header .nav-btn .arrow {
        display: none !important;
    }

    .site-header .header-col-actions {
        gap: 0.3rem !important;
    }

    .site-header .header-col-actions > .rb-header-action {
        width: 34px !important;
        min-width: 34px !important;
        height: 34px !important;
        min-height: 34px !important;
        padding: 0 !important;
    }

    .site-header .rb-header-action-label {
        display: none;
    }

    .site-header .rb-header-account-btn {
        width: 34px;
        height: 34px;
        min-height: 34px;
        padding: 0;
    }

    .site-header .rb-header-account-icon {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
    }

    .site-header .rb-header-account-name,
    .site-header .rb-header-account-arrow {
        display: none;
    }
}

/* Extra-small phones */
@media (max-width: 374.98px) {
    .site-header .mobile-header-bar {
        padding-right: 9px;
        padding-left: 9px;
    }

    .site-header .mob-left-group {
        gap: 7px;
    }

    .site-header .mob-left-group img {
        width: auto;
        height: 25px !important;
    }

    .site-header .mob-right-group {
        gap: 0.24rem !important;
    }

    .site-header .rb-mobile-header-action {
        flex-basis: 31px;
        width: 31px;
        height: 31px;
        border-radius: 0.58rem;
        font-size: 0.82rem;
    }

    .site-header .mob-toggle-btn {
        font-size: 24px;
    }
}

/* Hide desktop menu arrows */
@media (min-width: 768px) {
    .site-header .nav-btn .arrow {
        display: none !important;
    }
}

/* Accessibility and reduced motion */
@media (prefers-reduced-motion: reduce) {
    .site-header *,
    .site-header *::before,
    .site-header *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Preserve the existing tight handoff from the header to page content. */
body > .site-header + *,
body > .site-header + script + *,
body > .site-header + script + script + * {
    margin-top: 0 !important;
    padding-top: 0;
}
