/* ==========================================================================
   Header Premium - Slottomat.com
   Version 6.0 UNIFIED - single source of truth for header + dropdowns (red system)
   Replaces header-premium.css (retired 2026-07-02; stale-cache victim of immutable v=20260408a)
   ========================================================================== */

/* --- Custom Properties --- */
:root {
    --header-navy: #1a1a2e;
    --header-navy-light: #24243e;
    --header-red: #981b14;
    --header-red-dark: #6c120e;
    --header-red-bright: #c52e1b;
    --header-gold: #ffd24a;
    --header-gold-dim: rgba(255, 212, 74, 0.18);
    --header-text: #fff;
    --header-text-dim: rgba(255, 255, 255, 0.85);
    --header-text-muted: rgba(255, 255, 255, 0.6);
    --header-border: rgba(255, 255, 255, 0.12);
    --header-height: 70px;
    --header-height-mobile: 60px;
}

/* --- Header Bar --- */
.premium-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, var(--header-red-dark) 0%, var(--header-red) 48%, var(--header-red-bright) 100%);
    padding: 0;
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    isolation: isolate;
}

body.has-premium-header {
    padding-top: var(--header-height);
}

/* --- Header Container --- */
.header-container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    box-sizing: border-box;
}

/* --- Logo --- */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff6d6;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.premium-header .header-logo img {
    display: block;
    width: auto;
    height: 56px;
    max-width: 220px;
    max-height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.2));
}

/* --- Desktop Navigation --- */
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    min-width: 0;
}

/* --- Nav Links --- */
.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 11px;
    min-height: 44px;
    color: var(--header-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: 999px;
    transition: background 0.2s, transform 0.2s, color 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff7d8;
    transform: translateY(-1px);
}

.nav-dropdown.dropdown-active > .nav-link,
.nav-link[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.16);
    color: #fff7d8;
}

.nav-link i {
    font-size: 14px;
    color: var(--header-gold);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

/* --- Favorites & Age Badge --- */
.header-fav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    color: var(--header-text);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.header-fav-link svg {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

#favCountBadge {
    position: absolute;
    top: 4px;
    right: 0;
    font-size: 10px;
    font-weight: 700;
    background: var(--header-gold);
    color: #000;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
}

.header-age-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    text-decoration: none;
    color: var(--header-text);
}

.age-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    color: var(--header-text);
}

/* --- Desktop Dropdowns --- */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--header-red-dark) 0%, var(--header-red) 100%);
    border: 1px solid var(--header-gold-dim);
    border-radius: 18px;
    min-width: 250px;
    padding: 16px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 10001;
    margin-top: 10px;
}

.nav-dropdown.dropdown-active .dropdown-menu,
.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-top: 5px;
}

.nav-dropdown.dropdown-active .dropdown-arrow,
.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* --- Dropdown Header --- */
.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: none;
}

.dropdown-title {
    color: var(--header-gold);
    font-weight: 700;
    font-size: 14px;
}

.view-all-link {
    color: var(--header-text);
    font-size: 12px;
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* --- Dropdown Grids --- */
.dropdown-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    max-height: 420px;
    overflow-y: auto;
}

.dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* --- Dropdown Items --- */
.dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    min-height: 40px;
    color: var(--header-text);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.35;
    border-radius: 12px;
    transition: background 0.2s, transform 0.2s, color 0.2s;
}

.dropdown-item span {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(2px);
    color: #fff7d8;
}

.dropdown-item i {
    color: var(--header-gold);
    width: 16px;
    text-align: center;
}

.providers-dropdown {
    min-width: 450px;
}

/* --- Dropdown Section Grid (Categories/Guides mega-menus) --- */
.dropdown-section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.dropdown-section-grid.dropdown-section-grid-guides {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dropdown-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.dropdown-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dropdown-section-title {
    color: #ecf5ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.dropdown-section-links {
    display: grid;
    gap: 8px;
}

/* --- Mobile Menu Toggle --- */
.mobile-menu-toggle {
    display: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: var(--header-gold);
    border-radius: 2px;
}

/* --- Mobile Overlay --- */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mobile-overlay.overlay-active {
    opacity: 1;
    visibility: visible;
}

/* --- Mobile Drawer --- */
/* Override core.min.css red gradient with higher specificity + !important */
body.has-premium-header .premium-header .mobile-drawer,
.premium-header .mobile-drawer,
.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(360px, 92vw);
    height: 100dvh;
    min-height: 100vh;
    background: #1a1a2e !important;
    border-left: 1px solid var(--header-gold-dim);
    z-index: 9999;
    transform: translateX(100%);
    -webkit-transform: translateX(100%);
    transition: transform 0.3s ease;
    -webkit-transition: -webkit-transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: -24px 0 48px rgba(0, 0, 0, 0.36);
}

.premium-header .mobile-drawer.drawer-open,
.mobile-drawer.drawer-open {
    transform: translateX(0) !important;
    -webkit-transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.premium-header .mobile-drawer:not(.drawer-open),
.mobile-drawer:not(.drawer-open) {
    visibility: hidden;
    opacity: 0;
}

.mobile-overlay:not(.overlay-active) {
    display: none;
}

body.menu-open {
    overflow: hidden;
    touch-action: none;
}

/* --- Drawer Header --- */
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.drawer-close {
    background: transparent;
    border: none;
    color: var(--header-text);
    font-size: 24px;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Drawer Content --- */
.drawer-content {
    display: grid;
    gap: 8px;
    padding: 14px 14px 24px;
    min-height: calc(100dvh - 92px);
    align-content: start;
}

/* --- Drawer Links --- */
.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    min-height: 52px;
    color: var(--header-text);
    text-decoration: none;
    font-size: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    -webkit-tap-highlight-color: rgba(255, 215, 0, 0.2);
}

.drawer-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff7d8;
}

.drawer-link i {
    color: var(--header-gold);
    width: 20px;
}

/* --- Drawer Accordions --- */
.drawer-accordion {
    margin-bottom: 5px;
}

.accordion-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 15px;
    min-height: 52px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--header-text);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    -webkit-tap-highlight-color: rgba(255, 215, 0, 0.2);
}

.accordion-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.accordion-trigger i:first-child {
    color: var(--header-gold);
    width: 20px;
}

.accordion-arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    padding-left: 0;
    transition: max-height 0.35s ease-out, padding 0.35s ease-out;
}

.drawer-accordion.accordion-open .accordion-content {
    max-height: 2000px;
    padding: 8px 0 2px;
}

.drawer-accordion.accordion-open .accordion-arrow {
    transform: rotate(180deg);
}

/* --- Accordion Links --- */
.accordion-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px 11px 16px;
    min-height: 42px;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    -webkit-tap-highlight-color: rgba(255, 215, 0, 0.2);
}

.accordion-link:hover {
    color: var(--header-gold);
    background: rgba(255, 212, 74, 0.12);
}

.accordion-link.view-all {
    margin-top: 10px;
    font-weight: 800;
    background: rgba(255, 212, 74, 0.14);
    border-color: rgba(255, 212, 74, 0.18);
    color: #fff7d8;
}

.accordion-link span,
.accordion-trigger span,
.drawer-link span {
    min-width: 0;
    overflow-wrap: break-word;
}

/* --- Drawer Sections (inside accordions) --- */
.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0 12px;
}

.drawer-section + .drawer-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-section-title {
    color: var(--header-text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0 2px;
}

/* --- Drawer Footer --- */
.drawer-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--header-text-muted);
    font-size: 12px;
}

/* --- SVG Icons in nav --- */
.drawer-link svg,
.nav-link svg {
    display: inline-block;
    vertical-align: middle;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* --- Pseudo-element cleanup --- */
.direct-link::after, .direct-link::before,
.dropdown-trigger::after, .dropdown-trigger::before,
.header-container::after, .header-container::before,
.header-nav.desktop-nav::after, .header-nav.desktop-nav::before,
.nav-link::after, .nav-link::before {
    display: none;
    content: none;
    width: 0;
    height: 0;
}

/* ==========================================================================
   RESPONSIVE - Mobile (<1200px)
   ========================================================================== */
@media (max-width: 1199px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 10px;
        background: transparent;
        border: none;
        cursor: pointer;
        min-height: 44px;
        min-width: 44px;
        align-items: center;
        justify-content: center;
    }

    .header-container {
        height: var(--header-height-mobile);
    }

    .premium-header .header-logo img {
        height: 46px;
        max-height: 46px;
        max-width: 190px;
    }

    body.has-premium-header {
        padding-top: var(--header-height-mobile);
    }

    .mobile-overlay {
        inset: 0;
        width: 100%;
        height: 100dvh;
        min-height: 100vh;
    }
}

/* ==========================================================================
   RESPONSIVE - Desktop (>=1200px)
   ========================================================================== */
@media (min-width: 1200px) {
    .premium-header {
        z-index: 2147483000;
        overflow: visible;
    }

    .header-container {
        padding-left: 32px;
        padding-right: 32px;
        overflow: visible;
    }

    .header-nav,
    .nav-dropdown {
        overflow: visible;
    }

    /* Dropdown refinements for desktop */
    .nav-dropdown .dropdown-menu,
    .premium-header .dropdown-menu {
        width: max-content;
        max-width: min(94vw, 1040px);
        padding: 18px 18px 16px;
        border: 1px solid var(--header-gold-dim);
        border-radius: 22px;
        background: linear-gradient(135deg, var(--header-red-dark) 0%, var(--header-red) 100%);
        box-shadow: 0 26px 60px rgba(0, 0, 0, 0.42);
        backdrop-filter: blur(10px);
        z-index: 2147483646;
    }

    .premium-header .dropdown-header {
        gap: 14px;
        padding-bottom: 12px;
        margin-bottom: 14px;
        border-bottom: none;
    }

    .premium-header .dropdown-title {
        font-size: 15px;
        letter-spacing: 0.02em;
    }

    .premium-header .view-all-link {
        display: inline-flex;
        align-items: center;
        min-height: 34px;
        padding: 0 12px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
        color: #fff7d8;
        font-size: 12px;
        font-weight: 700;
        text-decoration: none;
    }

    .premium-header .view-all-link:hover {
        background: rgba(255, 212, 74, 0.18);
        text-decoration: none;
    }

    .premium-header .dropdown-grid-2col {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
        gap: 10px;
        min-width: min(92vw, 540px);
        max-width: min(92vw, 620px);
        padding-right: 2px;
    }

    .premium-header .dropdown-list {
        gap: 10px;
    }

    .premium-header .dropdown-item {
        align-items: flex-start;
        min-height: 58px;
        padding: 12px 14px;
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.045);
    }

    .premium-header .dropdown-item span {
        font-size: 13px;
        font-weight: 700;
        line-height: 1.45;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        hyphens: auto;
    }

    .premium-header .dropdown-item:hover {
        background: rgba(255, 212, 74, 0.12);
        border-color: rgba(255, 212, 74, 0.24);
        transform: translateY(-1px);
    }

    .premium-header .dropdown-item i {
        width: 18px;
        margin-top: 1px;
        flex-shrink: 0;
    }

    .premium-header .providers-dropdown {
        min-width: min(92vw, 560px);
    }
}

/* ==========================================================================
   RESPONSIVE - Tight desktop (1200-1340px)
   ========================================================================== */
@media (min-width: 1200px) and (max-width: 1340px) {
    .header-container {
        padding: 0 12px;
    }

    .nav-link {
        gap: 6px;
        padding: 9px 8px;
        font-size: 12px;
    }

    .nav-link i {
        font-size: 12px;
    }

    .premium-header .header-logo img {
        height: 50px;
        max-height: 50px;
        max-width: 186px;
    }
}

/* Narrower dropdown grid on tight desktop */
@media (min-width: 992px) and (max-width: 1280px) {
    .premium-header .dropdown-section-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

/* ==========================================================================
   RESPONSIVE - Small phones
   ========================================================================== */
@media (max-width: 480px) {
    .header-container {
        padding: 0 12px;
        gap: 8px;
    }

    .header-logo {
        min-width: 0;
        flex: 1 1 0;
    }

    .premium-header .header-logo img {
        max-width: min(160px, 55vw);
        max-height: 46px;
        height: 46px;
    }

    .mobile-menu-toggle {
        flex-shrink: 0;
        padding: 8px 10px;
    }

    .hamburger-line {
        width: 22px;
        height: 2.5px;
    }
}

@media (max-width: 375px) {
    .mobile-drawer {
        width: 280px;
        max-width: 90vw;
    }

    .header-container {
        padding: 0 10px;
    }

    .premium-header .header-logo img {
        max-width: min(140px, 48vw);
        max-height: 36px;
        height: 36px;
    }

    .accordion-trigger,
    .drawer-link {
        font-size: 15px;
        padding: 12px 12px;
    }

    .accordion-link {
        font-size: 13px;
        padding: 10px 12px 10px 18px;
    }

    .drawer-content {
        padding: 8px 10px;
    }
}

/* ==========================================================================
   iOS Safari Fixes
   ========================================================================== */
@supports (-webkit-touch-callout: none) {
    body.menu-open {
        -webkit-overflow-scrolling: auto;
    }

    .mobile-drawer {
        height: -webkit-fill-available;
    }
}


/* Header Search Button */
.header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    color: var(--header-text);
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.2s;
}
.header-search-btn:hover { color: var(--header-gold); }
.header-search-btn svg { width: 20px; height: 20px; }

/* Ensure search button is always clickable */
.header-search-btn {
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}


/* ==========================================================================
   UNIFIED OVERRIDES (v6.0) - one red system, wins over slm-globals !important
   ========================================================================== */
.premium-header {
    background: linear-gradient(180deg, #a12918 0%, #861c13 100%) !important;
}
.premium-header .dropdown-menu,
.nav-dropdown .dropdown-menu {
    background: linear-gradient(180deg, #861c13 0%, #5f120d 100%) !important;
    border: 1px solid rgba(255, 212, 74, 0.22) !important;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.5) !important;
}
.premium-header .dropdown-item {
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.09);
}
.premium-header .dropdown-item:hover {
    background: rgba(255, 212, 74, 0.16);
    border-color: rgba(255, 212, 74, 0.32);
    color: #fff7d8;
}
.premium-header .dropdown-title { color: var(--header-gold); }
.premium-header .view-all-link {
    background: rgba(255, 212, 74, 0.14);
    color: #ffd24a;
}
.premium-header .view-all-link:hover { background: rgba(255, 212, 74, 0.26); }
.nav-link:hover,
.nav-dropdown.dropdown-active > .nav-link,
.nav-link[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.22);
    color: #ffd24a;
}
