/* ============================================
   MODERN HEADER & DROPDOWN STYLES
   ============================================ */

:root {
    --hdr-primary: #6366f1;
    --hdr-secondary: #8b5cf6;
    --hdr-accent: #06b6d4;
    --hdr-dark: #0f172a;
    --hdr-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
}

/* Header container */
#header {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 9999;
}

/* Top-level nav links */
#header .main-na > ul > li > a,
#header .custom-nav > ul > li > a {
    position: relative;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.5px;
    color: #1e293b !important;
    padding: 32px 18px !important;
    transition: all 0.3s ease;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Dropdown caret indicator */
#header .main-na > ul > li.dropdown > a::before,
#header .custom-nav > ul > li.dropdown > a::before {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    margin-left: 6px;
    order: 2;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: #94a3b8;
}

#header .main-na > ul > li.dropdown:hover > a::before,
#header .custom-nav > ul > li.dropdown:hover > a::before {
    transform: rotate(180deg);
    color: var(--hdr-primary);
}

/* Active state — current page */
#header .main-na > ul > li.active > a,
#header .custom-nav > ul > li.active > a {
    color: var(--hdr-primary) !important;
}

#header .main-na > ul > li.active > a::after,
#header .custom-nav > ul > li.active > a::after {
    width: 28px !important;
}

/* Hover animated underline */
#header .main-na > ul > li > a::after,
#header .custom-nav > ul > li > a::after {
    content: '';
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    border-radius: 3px;
    background: var(--hdr-gradient);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#header .main-na > ul > li:hover > a::after,
#header .custom-nav > ul > li:hover > a::after {
    width: 28px;
}

#header .main-na > ul > li:hover > a,
#header .custom-nav > ul > li:hover > a {
    color: var(--hdr-primary) !important;
}

/* ============================================
   DROPDOWN MENU — MODERN GLASS CARD
   ============================================ */
#header .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 18px;
    box-shadow:
        0 25px 60px rgba(15, 23, 42, 0.15),
        0 10px 30px rgba(99, 102, 241, 0.1),
        0 0 0 1px rgba(99, 102, 241, 0.05);

    /* Animation */
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.96);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#header .dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Decorative top arrow */
#header .dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 30px;
    width: 16px;
    height: 16px;
    background: white;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    border-left: 1px solid rgba(99, 102, 241, 0.1);
    transform: rotate(45deg);
    border-radius: 3px 0 0 0;
}

/* Top gradient strip */
#header .dropdown-menu::after {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    background: var(--hdr-gradient);
    border-radius: 3px;
    opacity: 0.5;
}

/* Dropdown items */
#header .dropdown-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
    border: none !important;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

#header .dropdown:hover .dropdown-menu li {
    opacity: 1;
    transform: translateX(0);
}

#header .dropdown-menu li:nth-child(1) { transition-delay: 0.05s; }
#header .dropdown-menu li:nth-child(2) { transition-delay: 0.08s; }
#header .dropdown-menu li:nth-child(3) { transition-delay: 0.11s; }
#header .dropdown-menu li:nth-child(4) { transition-delay: 0.14s; }
#header .dropdown-menu li:nth-child(5) { transition-delay: 0.17s; }
#header .dropdown-menu li:nth-child(6) { transition-delay: 0.20s; }
#header .dropdown-menu li:nth-child(7) { transition-delay: 0.23s; }
#header .dropdown-menu li:nth-child(8) { transition-delay: 0.26s; }
#header .dropdown-menu li:nth-child(9) { transition-delay: 0.29s; }
#header .dropdown-menu li:nth-child(10) { transition-delay: 0.32s; }

#header .dropdown-menu li a {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 16px !important;
    font-size: 0.88rem !important;
    font-weight: 600;
    color: #334155 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-radius: 10px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

/* Icon dot before each item */
#header .dropdown-menu li a::before {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
}

#header .dropdown-menu li a:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.06) 100%);
    color: var(--hdr-primary) !important;
    transform: translateX(4px);
}

#header .dropdown-menu li a:hover::before {
    background: var(--hdr-gradient);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
    transform: scale(1.3);
}

/* Right arrow on hover */
#header .dropdown-menu li a::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s ease;
    color: var(--hdr-primary);
}

#header .dropdown-menu li a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* Active/hover indicator on parent when dropdown open */
#header .dropdown:hover > a {
    color: var(--hdr-primary) !important;
}

/* Logo refinement */
#header #logo img {
    transition: transform 0.3s ease;
}
#header #logo:hover img {
    transform: scale(1.05);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================
   The theme's strongest mobile-logo selector is `#header .header-inner #logo`
   (specificity 2,1,0) which forces `position: absolute; width: 100%; text-align: center`.
   We beat it with `html body #header .header-inner #logo.logo-img` (specificity 2,2,2). */
@media (max-width: 991px) {
    /* ---- Header bar shell ---- */
    html body #header .header-inner {
        position: relative !important;
        min-height: 64px !important;
        height: auto !important;
    }
    html body #header .header-inner > .container {
        position: static !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        min-height: 64px !important;
        text-align: left !important;
    }

    /* ---- Logo: left-aligned, compact ---- */
    html body #header .header-inner #logo,
    html body #header .header-inner #logo.logo-img {
        position: relative !important;
        float: left !important;
        left: 0 !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        width: auto !important;
        max-width: 65% !important;
        text-align: left !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 64px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        line-height: 1 !important;
    }
    html body #header .header-inner #logo a,
    html body #header .header-inner #logo a span {
        display: inline-flex !important;
        align-items: center !important;
        line-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        font-size: 0 !important;
    }
    html body #header .header-inner #logo a > img,
    html body #header .header-inner #logo a span img {
        max-height: 38px !important;
        width: auto !important;
        max-width: 160px !important;
        height: auto !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        vertical-align: middle !important;
    }

    /* ---- Hamburger / X: pinned to top-right of the bar ---- */
    html body #header #mainMenu-trigger {
        position: absolute !important;
        top: 14px !important;
        right: 16px !important;
        left: auto !important;
        float: none !important;
        margin: 0 !important;
        z-index: 5 !important;
    }

    /* ---- Hide unused search box ---- */
    html body #header #search { display: none !important; }

    /* ---- Nav drawer container ---- */
    html body #header #mainMenu {
        clear: both !important;
        width: 100% !important;
        background: white !important;
        border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
    }
    html body #header #mainMenu .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* ---- Top-level nav rows ---- */
    #header .main-na > ul > li,
    #header .custom-nav > ul > li {
        float: none !important;
        display: block !important;
        width: 100% !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.05) !important;
    }
    #header .main-na > ul > li:last-child,
    #header .custom-nav > ul > li:last-child {
        border-bottom: none !important;
    }
    #header .main-na > ul > li > a,
    #header .custom-nav > ul > li > a {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 15px 22px !important;
        font-size: 0.88rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        line-height: 1.2 !important;
    }
    #header .main-na > ul > li.dropdown > a::before,
    #header .custom-nav > ul > li.dropdown > a::before {
        margin-left: auto !important;
        order: 2;
    }
    #header .main-na > ul > li > a::after,
    #header .custom-nav > ul > li > a::after {
        display: none !important;
    }
    #header .main-na > ul > li.active > a,
    #header .custom-nav > ul > li.active > a {
        background: rgba(99, 102, 241, 0.05) !important;
        border-left: 3px solid var(--hdr-primary) !important;
        padding-left: 19px !important;
    }

    /* ---- Dropdown sub-menu ---- */
    #header .dropdown-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: auto !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        background: rgba(99, 102, 241, 0.04) !important;
        margin: 0 !important;
        padding: 4px 0 !important;
    }
    #header .dropdown-menu::before,
    #header .dropdown-menu::after { display: none !important; }
    #header .dropdown-menu li {
        opacity: 1 !important;
        transform: none !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.03) !important;
    }
    #header .dropdown-menu li:last-child { border-bottom: none !important; }
    #header .dropdown-menu li a {
        padding: 11px 22px 11px 40px !important;
        font-size: 0.83rem !important;
        font-weight: 500 !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        border-radius: 0 !important;
    }
    #header .dropdown-menu li a::after { display: none !important; }
    #header .dropdown-menu li a::before {
        width: 6px !important;
        height: 6px !important;
    }
}

/* ---- Phone (≤480px): slightly smaller logo ---- */
@media (max-width: 480px) {
    html body #header .header-inner #logo a > img,
    html body #header .header-inner #logo a span img {
        max-height: 34px !important;
        max-width: 140px !important;
    }
    #header .main-na > ul > li > a,
    #header .custom-nav > ul > li > a {
        padding: 14px 18px !important;
        font-size: 0.85rem !important;
    }
}

/* ============================================
   GLOBAL HERO BREATHING-ROOM SAFETY NET
   Sticky header is 64px tall on mobile. Per-page CSS often sets hero
   padding-top too low, clipping the H1 under the sticky header.
   ============================================ */
@media (max-width: 991px) {
    .hero-section { padding-top: 120px !important; }
}
@media (max-width: 767px) {
    .hero-section { padding-top: 110px !important; }
    .hero-section h1 {
        padding-left: 16px;
        padding-right: 16px;
        line-height: 1.25;
    }
}
@media (max-width: 480px) {
    .hero-section { padding-top: 100px !important; }
    .hero-section h1 { font-size: clamp(1.4rem, 6vw, 1.9rem) !important; }
}

/* ============================================
   JS-FREE INLINE-STYLE FALLBACK
   In case the cascade STILL doesn't win (very rare), a tiny inline
   script on each page can set element.style.cssText. See _Layout.cshtml.
   ============================================ */
