/* =========================================================
   HEADER — App-Style Sticky Header + Drawer + Bottom Nav
   Theme: Dark Blue + Black (Modern AI-style)
   Fully responsive.
   ========================================================= */

/* =========================================================
   1. GLOBAL HEADER SHELL
   ========================================================= */
.site-header {
    position: relative;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}
.site-header.scrolled {
    box-shadow: 0 4px 20px rgba(8, 24, 58, 0.06);
    background: rgba(255, 255, 255, 0.95);
}

/* =========================================================
   2. HEADER CONTAINER
   ========================================================= */
.header-main { padding: 10px 0; }
.header-main .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* =========================================================
   3. SITE BRANDING (Aligned Left)
   ========================================================= */
.site-branding {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    order: 1 !important;
}
.site-branding .site-title {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -.5px;
    line-height: 1;
}
.site-branding .site-title a {
    color: var(--navy-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.site-branding .site-title a span { color: var(--primary); }
.site-branding img.custom-logo {
    max-height: 38px;
    width: auto;
}
.site-branding .site-description { display: none; }

.tso-logo-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
    color: #fff;
    font-size: 17px;
    box-shadow: 0 6px 14px rgba(0, 102, 255, 0.28);
    flex-shrink: 0;
}

.tso-logo-link {
    text-decoration: none !important;
    display: inline-block;
}
.tso-text-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tso-logo-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.tso-logo-brand {
    font-family: 'Poppins', sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: #08183a;
    letter-spacing: -.3px;
}
.tso-logo-tagline {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    letter-spacing: .2px;
    margin-top: 2px;
}

/* =========================================================
   4. SEARCH BARS (Aligned Right)
   ========================================================= */
.tso-header-right-action {
    order: 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    flex: 0 0 320px !important;
    min-width: 0;
}

.tso-header-right-action .tso-lf-header,
.tso-header-search-pill {
    position: relative;
    flex: 1 1 auto;
    max-width: 340px;
    margin: 0;
    order: 1;
}
.tso-header-search-pill .tso-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
    transition: color .2s ease;
    z-index: 2;
}
.tso-header-search-pill input[type="search"] {
    width: 100%;
    padding: 10px 18px 10px 42px;
    background: #f1f5f9;
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-size: 13.5px;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    transition: all .22s ease;
    -webkit-appearance: none;
    appearance: none;
}
.tso-header-search-pill input[type="search"]::placeholder {
    color: #94a3b8;
    font-weight: 500;
}
.tso-header-search-pill input[type="search"]:focus {
    background: #ffffff;
    border-color: #0066ff;
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}

.header-search {
    position: relative;
    max-width: 320px;
    flex: 1 1 auto;
}
.header-search input[type="search"] {
    width: 100%;
    padding: 10px 42px 10px 16px;
    background: #f1f5f9;
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-size: 13px;
    outline: none;
    transition: all .22s ease;
    -webkit-appearance: none;
    appearance: none;
}
.header-search input[type="search"]:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}
.header-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: transform .2s ease, background .2s ease;
}
.header-search button:hover {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.06);
}

/* =========================================================
   5. DESKTOP NAVIGATION (Centered In Middle)
   ========================================================= */
.tso-nav-links,
.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2 !important;
    flex: 1 1 auto;
}
.tso-nav-links ul,
.main-nav > .container > ul,
.tso-desktop-menu {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tso-nav-links li,
.main-nav > .container > ul > li,
.tso-desktop-menu > li { 
    position: relative; 
}

.tso-nav-links a,
.main-nav > .container > ul > li > a,
.tso-desktop-menu > li > a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #08183a;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    transition: all .2s ease;
    letter-spacing: .1px;
}
.tso-nav-links a:hover,
.main-nav > .container > ul > li > a:hover,
.tso-desktop-menu > li > a:hover {
    color: var(--primary);
    background: rgba(0, 102, 255, 0.06);
}
.tso-nav-links .current-menu-item > a,
.main-nav .current-menu-item > a,
.tso-desktop-menu > li.current-menu-item > a {
    color: var(--primary);
    background: rgba(0, 102, 255, 0.08);
}

.tso-nav-links ul ul,
.main-nav ul ul,
.tso-desktop-menu ul.sub-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 12px 32px rgba(8, 24, 58, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all .22s ease;
    flex-direction: column;
    align-items: stretch;
    z-index: 1000;
    list-style: none;
    margin: 0;
}
.tso-nav-links li:hover > ul,
.main-nav li:hover > ul,
.tso-desktop-menu li:hover > ul.sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.tso-nav-links ul ul a,
.main-nav ul ul a,
.tso-desktop-menu ul.sub-menu li a {
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    border-radius: 8px;
    text-transform: none;
    letter-spacing: 0;
}
.tso-nav-links ul ul a:hover,
.main-nav ul ul a:hover,
.tso-desktop-menu ul.sub-menu li a:hover {
    background: #f1f5f9;
    color: var(--primary);
}

/* =========================================================
   5b. MENU TOGGLE (HAMBURGER)
   ========================================================= */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #08183a 0%, #000000 100%);
    color: #ffffff;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: all .25s cubic-bezier(.4, 0, .2, 1);
    -webkit-tap-highlight-color: transparent;
    order: 2;
    border: 1px solid rgba(0, 102, 255, 0.2);
    box-shadow: 0 4px 12px rgba(8, 24, 58, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.menu-toggle i {
    font-size: inherit;
    line-height: 1;
}
.menu-toggle:hover,
.menu-toggle:active {
    background: linear-gradient(135deg, #0066ff 0%, #00265c 100%);
    color: #ffffff;
    transform: scale(0.95);
    box-shadow: 0 6px 18px rgba(0, 102, 255, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* =========================================================
   6. BREAKING NEWS TICKER
   ========================================================= */
.breaking-news {
    background: linear-gradient(90deg, #08183a 0%, #0f2350 100%);
    color: #fff;
    padding: 7px 0;
    overflow: hidden;
    font-size: 12.5px;
}
.breaking-news .container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.breaking-label {
    background: linear-gradient(135deg, #ff3b30 0%, #e63946 100%);
    color: #fff;
    padding: 4px 11px;
    font-weight: 800;
    font-size: 10px;
    text-transform: uppercase;
    border-radius: 6px;
    letter-spacing: .5px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    animation: tso-pulse 1.6s ease-in-out infinite;
}
.breaking-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: tso-dot 1.6s ease-in-out infinite;
}
@keyframes tso-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .75; }
}
@keyframes tso-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.4); opacity: .6; }
}
.ticker-wrap { overflow: hidden; flex: 1; position: relative; }
.ticker {
    display: flex;
    gap: 36px;
    white-space: nowrap;
    animation: ticker 32s linear infinite;
}
.ticker:hover { animation-play-state: paused; }
.ticker a {
    color: #e2e8f0;
    font-size: 12.5px;
    font-weight: 500;
    transition: color .2s ease;
}
.ticker a:hover { color: #f59e0b; }
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* =========================================================
   7. TSO SCREENSHOT HEADER VARIANT (Matches Design)
   ========================================================= */
.tso-screenshot-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 0;
}
.tso-screenshot-header .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* =========================================================
   8. MOBILE BOTTOM NAV — Dark Navy Glassy
   ========================================================= */
.tso-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(8, 24, 58, 0.96);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(0, 102, 255, 0.25);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}
.tso-bottom-nav ul {
    display: flex;
    align-items: center;
    justify-content: space-around;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tso-bottom-nav li { flex: 1; }
.tso-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 12px;
    transition: color .2s ease, background .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.tso-bottom-nav a i { font-size: 18px; line-height: 1; }
.tso-bottom-nav a:active { background: rgba(0, 102, 255, 0.15); }
.tso-bottom-nav .current-menu-item > a,
.tso-bottom-nav a.active {
    color: #38bdf8;
    background: rgba(0, 102, 255, 0.12);
}

/* =========================================================
   9. RESPONSIVE — Tablet (≤ 1024px)
   ========================================================= */
@media (max-width: 1024px) {
    .tso-header-search-pill { max-width: 320px; }
    .tso-header-right-action { flex: 0 0 280px !important; }
    .tso-desktop-menu { gap: 14px; }
    .tso-desktop-menu > li > a { font-size: 13px; padding: 6px 8px; }
}

/* =========================================================
   10. RESPONSIVE — MOBILE HEADER & DRAWER (≤ 900px)
   ========================================================= */
@media (max-width: 900px) {

    .site-header,
    .tso-screenshot-header {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #ffffff;
        padding: 10px 0;
    }

    .header-main .container,
    .tso-screenshot-header .header-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        row-gap: 0 !important;
        column-gap: 12px !important;
    }

    /* Row: Logo (Left) */
    .site-branding {
        order: 1 !important;
        flex: 0 1 auto !important;
        min-width: 0 !important;
    }

    /* Row: Search Icon + Hamburger Menu (Right) */
    .tso-header-right-action {
        order: 2 !important;
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin: 0 !important;
    }

    .tso-header-right-action .tso-lf-header {
        order: 1 !important;
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        position: static !important;
    }

    .menu-toggle {
        display: inline-flex !important;
        order: 2 !important;
        flex: 0 0 auto !important;
        margin: 0 !important;
    }

    /* =============== DRAWER =============== */
    .tso-nav-links,
    .main-nav {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: min(340px, 88vw) !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: linear-gradient(180deg, #08183a 0%, #000000 100%) !important;
        box-shadow: -12px 0 48px rgba(0, 0, 0, 0.55),
                    -1px 0 0 rgba(0, 102, 255, 0.15) !important;
        transform: translateX(105%) !important;
        transition: transform .32s cubic-bezier(.4, 0, .2, 1) !important;
        padding: 78px 20px 40px !important;
        padding-top: calc(78px + env(safe-area-inset-top)) !important;
        padding-bottom: calc(40px + env(safe-area-inset-bottom)) !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 10001 !important;
        display: block !important;
        border-top: none !important;
        list-style: none !important;
        visibility: hidden !important;
    }
    .tso-nav-links.open,
    .main-nav.open {
        transform: translateX(0) !important;
        visibility: visible !important;
    }

    /* Drawer list */
    .tso-nav-links ul,
    .main-nav > .container > ul,
    .tso-nav-links > ul,
    .main-nav > ul,
    .tso-desktop-menu {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }
    .tso-nav-links a,
    .main-nav > .container > ul > li > a,
    .main-nav a,
    .tso-desktop-menu > li > a {
        padding: 13px 16px !important;
        font-size: 15px !important;
        border-radius: 12px !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        color: #e2e8f0 !important;
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        transition: all .2s ease !important;
    }
    .tso-nav-links a:hover,
    .main-nav a:hover,
    .tso-desktop-menu > li > a:hover {
        color: #ffffff !important;
        background: rgba(0, 102, 255, 0.18) !important;
        border-color: rgba(0, 102, 255, 0.4) !important;
        transform: translateX(4px) !important;
    }
    .tso-nav-links .current-menu-item > a,
    .main-nav .current-menu-item > a,
    .tso-desktop-menu > li.current-menu-item > a {
        color: #38bdf8 !important;
        background: rgba(0, 102, 255, 0.25) !important;
        border-color: rgba(56, 189, 248, 0.5) !important;
    }

    /* Submenus */
    .tso-nav-links ul ul,
    .main-nav ul ul,
    .tso-desktop-menu ul.sub-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 4px 0 4px 16px !important;
        display: none !important;
        background: transparent !important;
        border-radius: 0 !important;
        min-width: 0 !important;
        top: auto !important;
        left: auto !important;
    }
    .tso-nav-links li.open > ul,
    .main-nav li.open > ul,
    .tso-desktop-menu li.open > ul.sub-menu {
        display: block !important;
    }

    /* Overlay */
    body.tso-drawer-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 10000;
        animation: tso-fadeIn .25s ease;
    }
    @keyframes tso-fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Close (×) button */
    .tso-nav-links::before,
    .main-nav::before {
        content: '\00d7';
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
        position: absolute;
        top: calc(20px + env(safe-area-inset-top));
        right: 20px;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: linear-gradient(135deg, #0066ff 0%, #00265c 100%);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        font-weight: 300;
        line-height: 1;
        cursor: pointer;
        transition: all .2s ease;
        z-index: 2;
        box-shadow: 0 4px 14px rgba(0, 102, 255, 0.35),
                    inset 0 1px 0 rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(56, 189, 248, 0.35);
    }

    .tso-bottom-nav { display: block; }
    .site-footer { padding-bottom: 74px !important; }

    body.tso-drawer-open .site-header,
    body.tso-drawer-open .tso-screenshot-header {
        z-index: 10002;
    }

}

/* =========================================================
   11. RESPONSIVE — Small Tablet (≤ 768px)
   ========================================================= */
@media (max-width: 768px) {
    .site-header { padding: 8px 0; }
    .header-main { padding: 6px 0; }

    .menu-toggle {
        width: 36px;
        height: 36px;
        font-size: 14px;
        border-radius: 10px;
    }
}

/* =========================================================
   12. RESPONSIVE — Small Phones (≤ 640px)
   ========================================================= */
@media (max-width: 640px) {
    .tso-logo-brand { font-size: 17px; }
    .tso-logo-tagline { font-size: 9.5px; }
    .tso-logo-icon {
        width: 34px;
        height: 34px;
        font-size: 15px;
        border-radius: 10px;
    }
    .site-branding .site-title { font-size: 19px; }
    .site-branding img.custom-logo { max-height: 32px; }

    .menu-toggle {
        width: 34px;
        height: 34px;
        font-size: 13px;
        border-radius: 9px;
    }

    .breaking-label { font-size: 9px; padding: 3px 9px; }
    .ticker a { font-size: 12px; }
    .ticker { gap: 28px; }

    body.has-bottom-nav .site-footer { padding-bottom: 74px !important; }
    body.has-bottom-nav .back-to-top {
        bottom: calc(74px + env(safe-area-inset-bottom) + 16px);
    }
    body.has-bottom-nav .share-bottom {
        bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   13. RESPONSIVE — Small Phones (≤ 480px)
   ========================================================= */
@media (max-width: 480px) {
    .site-header { padding: 6px 0; }
    .container { padding: 0 14px; }

    .tso-logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 9px;
    }
    .tso-logo-brand { font-size: 16px; }
    .tso-logo-tagline { font-size: 9px; letter-spacing: 0; }

    .site-branding .site-title { font-size: 17px; }
    .site-branding img.custom-logo { max-height: 30px; }

    .menu-toggle {
        width: 32px;
        height: 32px;
        font-size: 13px;
        border-radius: 8px;
    }

    .breaking-news { padding: 6px 0; font-size: 11.5px; }
    .breaking-label {
        font-size: 9px;
        padding: 3px 8px;
        border-radius: 5px;
    }
    .breaking-label::before { width: 5px; height: 5px; }
    .ticker { gap: 22px; }
    .ticker a { font-size: 11.5px; }

    .tso-nav-links,
    .main-nav {
        width: 100vw;
        max-width: 100vw;
        padding: 70px 16px 40px;
        padding-top: calc(70px + env(safe-area-inset-top));
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .tso-bottom-nav a { font-size: 10px; padding: 5px 2px; }
    .tso-bottom-nav a i { font-size: 17px; }

    body.has-bottom-nav .back-to-top {
        bottom: calc(70px + env(safe-area-inset-bottom) + 12px);
        right: 16px;
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
}

/* =========================================================
   14. RESPONSIVE — Ultra Small (≤ 360px)
   ========================================================= */
@media (max-width: 360px) {
    .tso-logo-tagline { display: none; }
    .tso-logo-brand { font-size: 15px; }
}

/* =========================================================
   15. LANDSCAPE PHONES
   ========================================================= */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .tso-nav-links,
    .main-nav {
        padding-top: calc(60px + env(safe-area-inset-top));
    }
    .tso-nav-links a,
    .main-nav a {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* =========================================================
   16. BODY SCROLL LOCK WHEN DRAWER OPEN
   ========================================================= */
body.tso-drawer-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* =========================================================
   17. TOUCH DEVICE ENHANCEMENTS
   ========================================================= */
@media (hover: none) and (pointer: coarse) {
    .tso-nav-links a:hover,
    .main-nav a:hover {
        background: rgba(255, 255, 255, 0.04);
        color: #e2e8f0;
        transform: none;
    }
    .menu-toggle,
    .tso-header-search-pill input,
    .tso-bottom-nav a {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .tso-nav-links a:active,
    .main-nav a:active {
        background: rgba(0, 102, 255, 0.25);
        color: #38bdf8;
    }
    .menu-toggle:active { transform: scale(0.92); }
}

/* =========================================================
   18. MOMENTUM SCROLL FOR DRAWER
   ========================================================= */
.tso-nav-links,
.main-nav {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}