/* ═══════════════════════════════════════
   MEGA MENU — GeniusBet Sports
   Always dark, matches header style.
   ═══════════════════════════════════════ */

/* ── Backdrop ── */
.mega-backdrop {
    position: fixed;
    top: var(--header-height, 48px);
    left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s cubic-bezier(.33,1,.68,1), visibility .3s;
    z-index: 90;
}
.mega-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* ── Panel ── */
.mega-panel {
    position: fixed;
    top: var(--header-height, 48px);
    left: 0; right: 0;
    z-index: 95;
    background: linear-gradient(180deg, #111114 0%, #0c0c0f 100%);
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.3);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height .4s cubic-bezier(.16,1,.3,1), opacity .25s cubic-bezier(.33,1,.68,1);
}
.mega-panel.open {
    max-height: 420px;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
}

/* ── Close button ── */
.mega-close {
    display: none;
    position: absolute; top: 12px; right: 16px;
    width: 32px; height: 32px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    cursor: pointer;
    color: rgba(255,255,255,.5);
    align-items: center; justify-content: center;
    transition: all .15s;
    z-index: 10;
}
.mega-close:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

/* ── Inner grid: 3 columns ── */
.mega-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px 28px;
    display: grid;
    grid-template-columns: 190px 1fr 260px;
    gap: 0;
}

/* ── LEFT: Quick Links ── */
.mega-col-left {
    padding-right: 20px;
    border-right: 1px solid rgba(255,255,255,.06);
}

.mega-section-label {
    font-family: var(--mono, 'JetBrains Mono', monospace);
    font-size: .52rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.25);
    margin-bottom: 12px;
    padding: 0 8px;
}

.mega-qlink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 0 -4px;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 600;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    transition: all .15s;
}
.mega-qlink:hover {
    color: #fff;
    background: rgba(255,255,255,.04);
}
.mega-qlink:hover .mega-qlink-icon {
    color: var(--accent, #BFF932);
}
.mega-qlink-icon {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,.04);
    color: rgba(255,255,255,.3);
    flex-shrink: 0;
    transition: all .15s;
}
.mega-qlink-arrow {
    margin-left: auto;
    opacity: 0;
    transform: translateX(-4px);
    transition: all .15s;
    color: var(--accent, #BFF932);
}
.mega-qlink:hover .mega-qlink-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ── CENTER: Competitions ── */
.mega-col-center {
    padding: 0 24px;
    border-right: 1px solid rgba(255,255,255,.06);
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
.mega-col-center::-webkit-scrollbar { width: 4px; }
.mega-col-center::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.mega-col-center .mega-section-label:not(:first-child) {
    margin-top: 16px;
}

.mega-comp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.mega-comp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--t1, #fafafa);
    transition: all .15s;
}
.mega-comp-item:hover {
    background: rgba(255,255,255,.04);
}
.mega-comp-item:hover .mega-comp-name {
    color: var(--accent, #BFF932);
}

.mega-comp-logo {
    width: 28px; height: 28px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255,255,255,.04);
    transition: transform .2s cubic-bezier(.16,1,.3,1);
}
.mega-comp-item:hover .mega-comp-logo {
    transform: scale(1.1);
}

.mega-comp-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.mega-comp-name {
    font-size: .72rem;
    font-weight: 600;
    color: rgba(255,255,255,.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}
.mega-comp-country {
    font-size: .55rem;
    color: rgba(255,255,255,.3);
    margin-top: 1px;
}

/* ── RIGHT: Top Teams/Players ── */
.mega-col-right {
    padding-left: 24px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
.mega-col-right::-webkit-scrollbar { width: 4px; }
.mega-col-right::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.mega-teams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.mega-team-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--t1, #fafafa);
    transition: all .15s;
}
.mega-team-item:hover {
    background: rgba(255,255,255,.04);
}
.mega-team-item:hover .mega-team-name {
    color: var(--accent, #BFF932);
}
.mega-team-item:hover .mega-team-logo {
    transform: scale(1.1);
}

.mega-team-logo {
    width: 32px; height: 32px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255,255,255,.04);
    transition: transform .2s cubic-bezier(.16,1,.3,1);
}
.mega-player-photo {
    border-radius: 50%;
}

.mega-team-name {
    font-size: .72rem;
    font-weight: 600;
    color: rgba(255,255,255,.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}

/* ── Footer rows ── */
.mega-footer-row {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.mega-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .65rem;
    font-weight: 600;
    color: var(--accent, #BFF932);
    text-decoration: none;
    transition: opacity .15s;
}
.mega-view-all:hover { opacity: .7; }

/* ── Empty state ── */
.mega-empty {
    font-size: .72rem;
    color: rgba(255,255,255,.25);
    padding: 16px 8px;
}

/* Layout adjustments when columns have no data —
   still show columns with empty state messages */
.mega-no-teams .mega-col-center { border-right: none; }
.mega-no-comps .mega-col-center { border-right: none; }

/* Empty state styling */
.mega-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    min-height: 120px;
}
.mega-empty-state-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    color: rgba(255,255,255,.15);
}
.mega-empty-state-text {
    font-size: .72rem;
    color: rgba(255,255,255,.3);
    line-height: 1.5;
    max-width: 200px;
}
[data-theme="light"] .mega-empty-state-icon {
    color: rgba(0,0,0,.12);
}
[data-theme="light"] .mega-empty-state-text {
    color: rgba(0,0,0,.35);
}

/* ── Mobile pills (hidden on desktop) ── */
.mega-mobile-pills {
    display: none;
}

/* ── Sport tab caret for mega items ── */
.sport-tab .mega-caret {
    margin-left: 3px;
    opacity: .4;
    transition: transform .2s cubic-bezier(.16,1,.3,1), opacity .15s;
    vertical-align: middle;
}
.sport-tab:hover .mega-caret,
.sport-tab.mega-open .mega-caret {
    opacity: .8;
    transform: rotate(180deg);
}

/* ── Staggered entrance animation ── */
@keyframes megaFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mega-panel.open .mega-comp-item,
.mega-panel.open .mega-team-item,
.mega-panel.open .mega-qlink {
    animation: megaFadeIn .3s cubic-bezier(.16,1,.3,1) backwards;
}
.mega-panel.open .mega-qlink:nth-child(2) { animation-delay: .03s; }
.mega-panel.open .mega-qlink:nth-child(3) { animation-delay: .05s; }
.mega-panel.open .mega-qlink:nth-child(4) { animation-delay: .07s; }
.mega-panel.open .mega-qlink:nth-child(5) { animation-delay: .09s; }
.mega-panel.open .mega-qlink:nth-child(6) { animation-delay: .11s; }
.mega-panel.open .mega-qlink:nth-child(7) { animation-delay: .13s; }
.mega-panel.open .mega-qlink:nth-child(8) { animation-delay: .15s; }

.mega-panel.open .mega-comp-item:nth-child(1) { animation-delay: .04s; }
.mega-panel.open .mega-comp-item:nth-child(2) { animation-delay: .06s; }
.mega-panel.open .mega-comp-item:nth-child(3) { animation-delay: .08s; }
.mega-panel.open .mega-comp-item:nth-child(4) { animation-delay: .10s; }
.mega-panel.open .mega-comp-item:nth-child(5) { animation-delay: .12s; }
.mega-panel.open .mega-comp-item:nth-child(6) { animation-delay: .14s; }

.mega-panel.open .mega-team-item:nth-child(1) { animation-delay: .04s; }
.mega-panel.open .mega-team-item:nth-child(2) { animation-delay: .06s; }
.mega-panel.open .mega-team-item:nth-child(3) { animation-delay: .08s; }
.mega-panel.open .mega-team-item:nth-child(4) { animation-delay: .10s; }
.mega-panel.open .mega-team-item:nth-child(5) { animation-delay: .12s; }
.mega-panel.open .mega-team-item:nth-child(6) { animation-delay: .14s; }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 1024px) {
    .mega-inner {
        grid-template-columns: 170px 1fr 220px;
    }
    .mega-comp-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mega-panel {
        bottom: 0;
        max-height: none !important;
        overflow-y: auto;
        border-bottom: none;
    }
    .mega-panel.open {
        max-height: none;
    }

    .mega-close {
        display: flex;
    }

    .mega-inner {
        grid-template-columns: 1fr;
        padding: 0 16px 24px;
    }

    /* Hide left column on mobile — replaced by pills */
    .mega-col-left {
        display: none;
    }
    .mega-col-center {
        padding: 16px 0 0;
        border-right: none;
        max-height: none;
        overflow: visible;
    }
    .mega-col-right {
        padding: 16px 0 0;
        max-height: none;
        overflow: visible;
    }

    .mega-comp-grid {
        grid-template-columns: 1fr 1fr;
    }
    .mega-teams-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Mobile pills */
    .mega-mobile-pills {
        display: flex;
        gap: 6px;
        padding: 14px 16px;
        overflow-x: auto;
        scrollbar-width: none;
        border-bottom: 1px solid rgba(255,255,255,.06);
    }
    .mega-mobile-pills::-webkit-scrollbar { display: none; }
    .mega-pill {
        flex-shrink: 0;
        padding: 6px 14px;
        border-radius: 100px;
        font-size: .65rem;
        font-weight: 600;
        color: rgba(255,255,255,.5);
        background: rgba(255,255,255,.04);
        border: 1px solid rgba(255,255,255,.06);
        text-decoration: none;
        white-space: nowrap;
        transition: all .15s;
    }
    .mega-pill:hover,
    .mega-pill:active {
        color: var(--accent, #BFF932);
        border-color: rgba(191,249,50,.15);
        background: rgba(191,249,50,.06);
    }
}

@media (max-width: 480px) {
    .mega-comp-grid {
        grid-template-columns: 1fr;
    }
    .mega-teams-grid {
        grid-template-columns: 1fr;
    }
    .mega-comp-item { padding: 8px 6px; }
    .mega-team-item { padding: 8px 6px; }
}

/* ═══════════════════════════════════════
   LIGHT THEME OVERRIDES
   ═══════════════════════════════════════ */
[data-theme="light"] .mega-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8f8fa 100%);
    border-bottom: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 20px 60px rgba(0,0,0,.1), 0 4px 16px rgba(0,0,0,.06);
}
[data-theme="light"] .mega-backdrop {
    background: rgba(0,0,0,.25);
}
[data-theme="light"] .mega-close {
    background: rgba(0,0,0,.04);
    border-color: rgba(0,0,0,.08);
    color: rgba(0,0,0,.4);
}
[data-theme="light"] .mega-close:hover {
    background: rgba(0,0,0,.08);
    color: #111;
}
[data-theme="light"] .mega-col-left {
    border-right-color: rgba(0,0,0,.06);
}
[data-theme="light"] .mega-col-center {
    border-right-color: rgba(0,0,0,.06);
    scrollbar-color: rgba(0,0,0,.08) transparent;
}
[data-theme="light"] .mega-section-label {
    color: rgba(0,0,0,.35);
}
[data-theme="light"] .mega-qlink {
    color: rgba(0,0,0,.55);
}
[data-theme="light"] .mega-qlink:hover {
    color: #111;
    background: rgba(0,0,0,.04);
}
[data-theme="light"] .mega-qlink-icon {
    background: rgba(0,0,0,.04);
    color: rgba(0,0,0,.3);
}
[data-theme="light"] .mega-qlink:hover .mega-qlink-icon {
    color: #854DFF;
}
[data-theme="light"] .mega-qlink-arrow {
    color: #854DFF;
}
[data-theme="light"] .mega-comp-item {
    color: #111;
}
[data-theme="light"] .mega-comp-item:hover {
    background: rgba(133,77,255,.05);
}
[data-theme="light"] .mega-comp-item:hover .mega-comp-name {
    color: #854DFF;
}
[data-theme="light"] .mega-comp-name {
    color: rgba(0,0,0,.85);
}
[data-theme="light"] .mega-comp-country {
    color: rgba(0,0,0,.4);
}
[data-theme="light"] .mega-comp-logo {
    background: rgba(0,0,0,.03);
}
[data-theme="light"] .mega-team-item {
    color: #111;
}
[data-theme="light"] .mega-team-item:hover {
    background: rgba(133,77,255,.05);
}
[data-theme="light"] .mega-team-item:hover .mega-team-name {
    color: #854DFF;
}
[data-theme="light"] .mega-team-name {
    color: rgba(0,0,0,.8);
}
[data-theme="light"] .mega-team-logo {
    background: rgba(0,0,0,.03);
}
[data-theme="light"] .mega-footer-row {
    border-top-color: rgba(0,0,0,.06);
}
[data-theme="light"] .mega-view-all {
    color: #854DFF;
}
[data-theme="light"] .mega-empty {
    color: rgba(0,0,0,.3);
}
/* Mobile pills */
[data-theme="light"] .mega-mobile-pills {
    border-bottom-color: rgba(0,0,0,.06);
}
[data-theme="light"] .mega-pill {
    color: rgba(0,0,0,.5);
    background: rgba(0,0,0,.03);
    border-color: rgba(0,0,0,.08);
}
[data-theme="light"] .mega-pill:hover,
[data-theme="light"] .mega-pill:active {
    color: #854DFF;
    border-color: rgba(133,77,255,.2);
    background: rgba(133,77,255,.06);
}
