/**
 * PROPERTISM V4 - NAVIGATION MODULE
 */

header#site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: var(--nav-height) !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--glass-bg) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.15) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transition: all 0.3s ease;
}

header#site-header.scrolled {
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

html[data-theme="dark"] header#site-header {
    border-bottom-color: rgba(196, 156, 82, 0.34) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] header#site-header.scrolled {
    border-bottom-color: rgba(196, 156, 82, 0.48) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.44);
}

.header-content {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    align-items: center;
    height: 100% !important;
    column-gap: clamp(12px, 1.4vw, 24px);
    padding: 0 clamp(6px, 0.7vw, 12px) 0 6px;
}

.logo {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
    margin-right: clamp(0.5rem, 1vw, 1.1rem);
}

.logo-image {
    max-height: 45px;
    width: auto;
    transition: opacity 0.3s ease;
}

/* Theme-based Logo Toggling */
.logo-light { display: none !important; }
.logo-dark { display: block !important; }

[data-theme="light"] .logo-light { display: block !important; }
[data-theme="light"] .logo-dark { display: none !important; }

.main-nav {
    display: flex;
    align-items: center;
    height: 100% !important;
    justify-content: center;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
}

@media (min-width: 769px) {
    .main-nav-even {
        display: grid !important;
        grid-auto-flow: column !important;
        grid-auto-columns: max-content !important;
        gap: clamp(0.45rem, 0.9vw, 1.2rem) !important;
        justify-content: center !important;
        margin: 0 !important;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    justify-self: end;
    margin-left: 0;
    padding-left: clamp(0.75rem, 1.2vw, 1.5rem);
    white-space: nowrap;
}

@media (min-width: 1441px) {
    .header-actions {
        transform: translateX(calc(4vw - 12px));
    }
}

.main-nav a {
    font-family: var(--sans-main) !important;
    font-weight: 500 !important;
    font-size: 11px !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-main) !important;
    padding: 0 10px !important; /* Zero vertical padding */
    line-height: var(--nav-height) !important; /* Force vertical center via line-height */
    height: 100%;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: var(--brand-gold) !important;
}

.main-nav a.nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    background: var(--brand-gold) !important;
    border: 1px solid var(--brand-gold) !important;
    color: var(--brand-navy) !important;
    height: 46px !important;
    line-height: 1.2 !important;
    padding: 8px 24px !important;
    margin-right: 12px;
    border-radius: 4px;
    font-weight: 700 !important;
    box-shadow: 0 4px 10px rgba(196, 156, 82, 0.2);
}

.main-nav a.nav-cta:hover {
    background: var(--text-main) !important;
    color: var(--white) !important;
    border-color: var(--text-main) !important;
}

/* Tool Buttons Styling */
.header-v4-tools {
    display: flex;
    align-items: center;
    height: 100% !important;
    gap: 8px;
    margin-right: 0;
    padding-left: clamp(0.65rem, 1vw, 1.1rem);
    border-left: 1px solid var(--border-subtle);
}

.v4-tool-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0 6px !important;
    height: var(--nav-height); /* Match header height */
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* For subscript label */
}

.v4-sub-label {
    position: absolute;
    bottom: 22px;
    right: 2px;
    font-size: 9px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    color: var(--brand-gold);
    pointer-events: none;
    line-height: 1;
}

.v4-tool-btn:hover {
    background: var(--border-subtle);
    color: var(--brand-gold);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .main-nav { display: none; }

    .header-content {
        grid-template-columns: max-content 1fr max-content;
        padding: 0 16px;
    }

    .header-v4-tools {
        gap: 6px;
        padding-left: 8px;
    }

    .v4-tool-btn {
        padding: 0 6px !important;
    }

    .logo-image {
        max-height: 40px;
    }
}

@media (min-width: 1024px) and (max-width: 1280px) {
    .header-content {
        column-gap: 14px;
    }

    .main-nav-even {
        gap: 0.45rem !important;
    }

    .main-nav a {
        padding: 0 8px !important;
        letter-spacing: 0.09em !important;
    }

    .header-actions {
        gap: 6px;
        padding-left: 0.75rem;
    }

    .header-v4-tools {
        gap: 6px;
        padding-left: 0.5rem;
    }

    .v4-tool-btn {
        padding: 0 4px !important;
    }

    .nav-profile-wrapper {
        margin-left: 8px;
    }

    .main-nav-even > a:first-child {
        display: none;
    }
}

/* NRI Assist Premium CTA */
.main-nav a.nri-assist-cta {
    --nri-assist-gold: var(--brand-gold);
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    height: auto;
    line-height: 1.2 !important;
    padding: 8px 16px !important;
    border-radius: 4px;
    text-decoration: none !important;
    position: relative;
    background: transparent;
    border: 1.5px solid var(--nri-assist-gold);
    box-shadow: 0 0 8px rgba(201, 169, 97, 0.2);
    transition: background 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease, color 0.3s ease;
    animation: nri-pulse 2.5s ease-out infinite;
}

.main-nav a.nri-assist-cta:hover {
    background: rgba(201, 169, 97, 0.08);
    box-shadow: 0 0 18px rgba(201, 169, 97, 0.45);
    filter: drop-shadow(0 0 8px rgba(201, 169, 97, 0.35));
    animation: none;
    border-color: var(--nri-assist-gold);
    color: var(--text-main) !important;
}

.nri-assist-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: inherit;
}

.nri-assist-sub {
    display: block;
    margin-top: 1px;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.06em;
    white-space: nowrap;
    color: var(--brand-gold);
}

@keyframes nri-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 169, 97, 0.45), 0 0 8px rgba(201, 169, 97, 0.2);
    }
    60% {
        box-shadow: 0 0 0 6px rgba(201, 169, 97, 0), 0 0 8px rgba(201, 169, 97, 0.2);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 169, 97, 0), 0 0 8px rgba(201, 169, 97, 0.2);
    }
}

.dark-nav .nri-assist-label,
[data-theme="dark"] .nri-assist-label {
    color: #F5F5F5;
}

.dark-nav .nri-assist-cta,
[data-theme="dark"] .nri-assist-cta {
    border-color: var(--brand-gold);
    box-shadow: 0 0 10px rgba(201, 169, 97, 0.25);
}

@media (max-width: 768px) {
    .mobile-nav .mobile-menu-item.nri-assist-cta {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        width: calc(100% - 48px);
        margin: 16px 24px;
        padding: 12px 14px !important;
        height: auto;
        line-height: 1.2 !important;
        border: 1.5px solid var(--brand-gold);
        border-bottom: 1.5px solid var(--brand-gold) !important;
        animation: none;
    }

    .mobile-nav .mobile-menu-item.nri-assist-cta:hover {
        padding-left: 14px !important;
        background: rgba(201, 169, 97, 0.08);
        box-shadow: 0 0 12px rgba(201, 169, 97, 0.22);
        filter: none;
        animation: none;
    }

    .mobile-nav .nri-assist-sub {
        display: none;
    }
}

/* Nav Profile SCCB-104 */
.nav-profile-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 16px;
    margin-right: 8px;
    z-index: 10004;
}

.nav-profile-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: max-content;
    height: var(--nav-height);
    padding: 4px 8px 2px 4px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-main);
    cursor: pointer;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.nav-profile-btn:hover {
    opacity: 0.88;
}

.nav-profile-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-gold-glow);
}

.nav-profile-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: none;
    min-width: max-content;
}

.nav-profile-avatar,
.nav-profile-initials {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--brand-gold);
    flex-shrink: 0;
}

.nav-profile-avatar {
    display: block;
    object-fit: cover;
}

.nav-profile-initials,
.nav-profile-identity-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-gold);
    color: var(--brand-navy);
    font-family: var(--sans-main);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.nav-profile-initials {
    font-size: 0.82rem;
}

.nav-profile-trigger-name {
    display: none;
    max-width: none;
    color: var(--text-main);
    font-family: var(--sans-main);
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.015em;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    text-transform: none;
    opacity: 0.82;
}

.nav-profile-chevron {
    position: absolute;
    top: 18px;
    right: 2px;
    color: var(--brand-gold);
    font-size: 0.65rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.nav-profile-btn[aria-expanded="true"] .nav-profile-chevron {
    transform: rotate(180deg);
}

.nav-profile-dropdown {
    position: fixed;
    top: calc(var(--nav-height) + 16px);
    right: 24px;
    min-width: 0;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    display: none;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid rgba(201, 169, 97, 0.18);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--white) 0%, rgba(255, 255, 255, 0.98) 100%);
    box-shadow:
        0 20px 60px rgba(15, 23, 42, 0.12),
        0 4px 16px rgba(15, 23, 42, 0.06),
        0 0 0 1px rgba(201, 169, 97, 0.08);
    animation: profileDropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
    z-index: 9999;
}

.nav-profile-dropdown.open {
    display: block;
}

@keyframes profileDropIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nav-profile-identity {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--brand-navy) 0%, rgba(44, 36, 18, 0.96) 100%);
}

.nav-profile-identity::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-gold) 0%, rgba(201, 169, 97, 0) 100%);
}

.nav-profile-identity-avatar,
.nav-profile-identity-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--brand-gold);
    flex-shrink: 0;
}

.nav-profile-identity-avatar {
    object-fit: cover;
}

.nav-profile-identity-initials {
    font-size: 0.92rem;
}

.nav-profile-identity-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-profile-name {
    color: rgba(255, 255, 255, 0.94);
    font-family: var(--sans-main);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.nav-profile-email {
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--sans-main);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-profile-divider {
    height: 1px;
    margin: 6px 0;
    background: linear-gradient(90deg, rgba(201, 169, 97, 0), rgba(201, 169, 97, 0.2), rgba(201, 169, 97, 0));
}

.nav-profile-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 11px 20px;
    border: none;
    background: none;
    color: var(--text-main);
    font-family: var(--sans-main);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.nav-profile-item:hover {
    background: linear-gradient(90deg, rgba(201, 169, 97, 0.06) 0%, rgba(201, 169, 97, 0) 100%);
    color: var(--brand-gold);
    padding-left: 24px;
}

.nav-profile-signout {
    margin-top: 4px;
    padding: 11px 20px;
    border-top: 1px solid rgba(185, 64, 64, 0.12);
    color: rgb(185, 64, 64);
    font-weight: 400;
}

.nav-profile-signout:hover {
    background: rgba(185, 64, 64, 0.04);
    color: rgb(192, 57, 43);
    padding-left: 24px;
}

@media (max-width: 768px) {
    .nav-profile-btn {
        min-width: 40px;
        padding: 0;
    }

    .nav-profile-dropdown {
        top: calc(var(--nav-height) + 12px);
        right: 12px;
        min-width: 0;
        width: min(320px, calc(100vw - 24px));
    }

    .nav-profile-avatar,
    .nav-profile-initials {
        width: 30px;
        height: 30px;
    }

    .nav-profile-initials {
        font-size: 0.74rem;
    }

    .nav-profile-trigger-name,
    .nav-profile-chevron {
        display: none;
    }
}

/* SCCB-106 nav refinement hardening */
header#site-header .main-nav a.nav-cta {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    height: 46px !important;
    line-height: 1.2 !important;
    padding: 8px 24px !important;
    margin-right: 12px !important;
}

header#site-header .header-v4-tools .nav-profile-wrapper {
    margin-left: 16px !important;
    margin-right: 8px !important;
}

header#site-header .nav-profile-dropdown {
    position: fixed !important;
    top: calc(var(--nav-height) + 16px) !important;
    right: 24px !important;
    width: min(320px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
}

@media (max-width: 768px) {
    header#site-header .nav-profile-dropdown {
        top: calc(var(--nav-height) + 12px) !important;
        right: 12px !important;
    }
}
