/* ─── V1 Centralized Topbar Styles ─────────────────────── */

/* Top bar container — !important needed to override Bootstrap navbar/container */
html body .top,
html body div .top {
    position: fixed !important;
    left: 20px;
    right: 20px;
    top: 20px;
    height: 64px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 0px;
    z-index: 1050 !important;
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    border-radius: 0;
    visibility: visible;
    opacity: 1;
    font-family: 'Space Grotesk', sans-serif;
}

/* Logo styles */
.top .logo {
    height: 64px;
    padding: 0 20px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.top .logo img {
    height: 55px !important;
    width: auto !important;
    max-height: 55px !important;
    display: block;
}

/* Spacer for flex layout */
.top .spacer {
    flex: 1;
}

/* User section */
.top .user {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #999;
}

/* Profile dropdown */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: #0099ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.profile-avatar:hover {
    border-color: #0099ff;
    box-shadow: 0 0 0 1px #0099ff;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 0 !important; /* Override Bootstrap img border-radius */
}

/* Dropdown menu — !important needed to override Bootstrap .dropdown-menu */
.dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    background: #111111 !important;
    border: 1px solid rgba(255, 255, 255, .07) !important;
    border-radius: 0 !important;
    min-width: 180px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
    margin-top: 8px !important;
    padding: 0 !important;
    float: none !important;
}

.dropdown-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Dropdown item — !important needed to override Bootstrap .dropdown-item */
.dropdown-item {
    display: block !important;
    padding: 12px 16px !important;
    color: #999 !important;
    text-decoration: none !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    font-family: 'Space Grotesk', sans-serif !important;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    transition: all 0.2s ease;
    background: transparent !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(0, 153, 255, .08) !important;
    color: #fff !important;
    text-decoration: none !important;
}

.user-greeting {
    color: #fff;
    font-weight: 600;
    margin-right: 12px;
    font-size: 0.9rem;
    font-family: 'Space Grotesk', sans-serif;
}

.glass-login-btn {
    transition: all 0.2s ease;
}

.glass-login-btn:hover {
    background: #0099ff !important;
    border-color: #0099ff !important;
}

/* Topbar with tabs variation */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #0a0a0a;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .07);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    z-index: 1050;
    font-family: 'Space Grotesk', sans-serif;
}

.topbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: .2px;
    background: transparent;
    height: auto;
    padding: 0;
    border-radius: 0;
}

.logo-dot {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: #0099ff;
    display: grid;
    place-items: center;
    color: #000;
    font-weight: 900;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-left: 8px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 14px;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, .07);
    background: #111111;
    opacity: .9;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
}

.tab.active {
    background: #161616;
    border-color: rgba(0, 153, 255, .3);
    color: #0099ff;
}

.pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #111111;
    border: 1px solid rgba(255, 255, 255, .07);
    padding: 10px 14px;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
}

.primary {
    background: #0099ff;
    color: #000;
    font-weight: 800;
    border: none;
}

/* ─── Responsive adjustments ──────────────────────── */
@media (max-width: 1024px) {
    html body .top,
    html body div .top {
        left: 10px;
        right: 10px;
        top: 12px;
        height: 52px;
        min-height: 52px;
        padding: 0 12px;
        flex-wrap: nowrap;
        border-radius: 0;
        box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
        /* Remove backdrop-filter on mobile — Safari creates a stacking context
           that blocks touch events on sibling fixed elements (hamburger btn) */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(10, 10, 10, 0.95);
    }

    .top .logo {
        height: 56px;
        padding: 0 8px;
    }

    .top .logo img {
        height: 36px !important;
        max-height: 36px !important;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tabs {
        margin-left: 0;
        width: 100%;
    }

    .user-greeting {
        display: none !important;
    }

    /* Hide greeting, profile dropdown, and login on mobile */
    .top .top-user-actions .user-greeting,
    .top .top-user-actions .profile-dropdown,
    .top .glass-login-btn {
        display: none !important;
    }

    /* Keep user actions in topbar flex flow — just hide non-essential items */
    .top .top-user-actions {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
    }

    /* Compact notification bell on mobile */
    .top .notification-bell {
        padding: 4px !important;
    }

    .notification-bell .bell-icon-wrap {
        width: 32px !important;
        height: 32px !important;
    }

    .notification-bell i {
        font-size: 14px !important;
    }

    /* Notification panel mobile */
    .notification-panel {
        position: fixed !important;
        top: 60px !important;
        right: 8px !important;
        left: 8px !important;
        width: auto !important;
        max-width: none !important;
    }
}

/* ─── Mobile Menu Button (lives inside .top) ─────── */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 4px;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.mobile-menu-btn span {
    display: block;
    width: 26px;
    height: 2px;
    background: #fff;
    transition: all 0.22s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

@media (max-width: 1024px) {
    .mobile-menu-btn { display: flex !important; }
}

/* ─── Slide-in Menu ───────────────────────────────── */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 340px;
    height: 100vh;
    height: 100dvh; /* Modern browsers: accounts for Safari URL bar */
    height: -webkit-fill-available; /* Safari < 15.4 fallback */
    background: #0a0a0a;
    border-left: 1px solid rgba(255, 255, 255, .07);
    z-index: 1045;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.28s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-top: 68px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.8);
    visibility: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 153, 255, .4) rgba(255, 255, 255, .03);
}

.mobile-menu.active {
    transform: translateX(0);
    visibility: visible;
    will-change: transform; /* Only promote when animating */
}

.mobile-menu::-webkit-scrollbar { width: 4px; }
.mobile-menu::-webkit-scrollbar-track { background: rgba(255, 255, 255, .03); }
.mobile-menu::-webkit-scrollbar-thumb { background: rgba(0, 153, 255, .4); }

/* ─── Overlay ─────────────────────────────────────── */
.menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ─── Mobile Menu — Components ────────────────────── */

/* Branding header */
.mm-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.mm-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.mm-brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.mm-brand-text {
    display: flex;
    flex-direction: column;
}

.mm-brand-name {
    font-family: var(--display, 'Bebas Neue', sans-serif);
    font-size: 1.35rem;
    color: #fff;
    letter-spacing: .06em;
    line-height: 1;
}

.mm-brand-tagline {
    font-family: var(--mono, 'Roboto Mono', monospace);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #0099ff;
    margin-top: 3px;
}

/* Profile card */
.mm-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.mm-profile-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(0, 153, 255, .35);
}

.mm-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.mm-profile-info {
    flex: 1;
    min-width: 0;
}

.mm-profile-name {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'Space Grotesk', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-profile-email {
    color: #555;
    font-size: 0.75rem;
    font-family: 'Space Grotesk', sans-serif;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Guest login */
.mm-login-section {
    padding: 16px 20px 8px;
}

.mm-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    background: #0099ff;
    color: #000;
    text-decoration: none;
    font-family: 'Roboto Mono', monospace;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    transition: background 0.2s;
}

.mm-login-btn:hover { background: #007acc; color: #000; }

/* Section label */
.mm-section-label {
    padding: 14px 20px 6px;
    color: #0099ff;
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .18em;
    font-family: 'Roboto Mono', monospace;
    border-top: 1px solid rgba(255, 255, 255, .04);
}

.mm-section:first-of-type .mm-section-label {
    border-top: none;
}

/* Collapsible section headers */
.mm-collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    -webkit-user-select: none;
    user-select: none;
    transition: color 0.2s, background 0.15s;
    -webkit-tap-highlight-color: rgba(0, 153, 255, 0.15);
    touch-action: manipulation;
    min-height: 48px;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.mm-collapsible:hover,
.mm-collapsible:active {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.mm-chevron {
    font-size: 0.7rem;
    opacity: 0.5;
    transition: transform 0.25s ease;
    display: inline-block;
    margin-left: auto;
    padding: 0 4px;
}

.mm-collapsible.mm-open .mm-chevron {
    transform: rotate(180deg);
    opacity: 0.8;
}

/* Collapse body — hidden by default, animated open */
.mm-collapse-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 0.6, 0.4, 1);
}

.mm-collapse-body.mm-open {
    max-height: 400px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bottom section */
.mm-section-bottom {
    border-top: 1px solid rgba(255, 255, 255, .06);
    margin-top: 8px;
}

/* Nav links */
.mm-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    min-height: 48px;
    color: #999;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Space Grotesk', sans-serif;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.mm-link i, .mm-link svg {
    width: 18px;
    font-size: 14px;
    text-align: center;
    color: #555;
    flex-shrink: 0;
    transition: color 0.18s;
}

.mm-link:hover {
    background: rgba(0, 153, 255, .05);
    color: #fff;
    border-left-color: rgba(0, 153, 255, .4);
}

.mm-link:hover i, .mm-link:hover svg { color: #0099ff; }

.mm-link.mm-active {
    background: rgba(0, 153, 255, .08);
    color: #fff;
    border-left-color: #0099ff;
}

.mm-link.mm-active i, .mm-link.mm-active svg { color: #0099ff; }

.mm-link-muted { color: #666; }
.mm-link-muted i { color: #444; }

.mm-link-danger { color: #ef4444; }
.mm-link-danger i { color: rgba(239, 68, 68, .6); }
.mm-link-danger:hover {
    background: rgba(239, 68, 68, .06);
    color: #ff6b6b;
    border-left-color: #ef4444;
}

/* Social icons */
.mm-socials-row {
    display: flex;
    gap: 8px;
    padding: 8px 20px 16px;
    flex-wrap: wrap;
}

.mm-social {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    font-size: 16px;
    color: #888;
    text-decoration: none;
    transition: all 0.2s;
}

.mm-social:hover {
    background: rgba(0, 153, 255, .08);
    border-color: rgba(0, 153, 255, .3);
}

/* ─── Notification Bell (inside topbar) ───────────── */
.top .notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 0;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    visibility: visible;
    opacity: 1;
}

.top .notification-bell:hover {
    background: rgba(0, 153, 255, .08);
}

.top .notification-bell i {
    font-size: 20px;
    color: #fff;
}

.top .notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: #fff;
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 0;
    min-width: 18px;
    text-align: center;
}

.top .notification-panel {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 380px;
    max-height: 500px;
    background: #111111;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 10002;
    overflow: hidden;
    flex-direction: column;
}

/* ─── Back to Clubs Button ────────────────────────── */
.back-to-teams-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 0;
    text-decoration: none;
    font-size: 0.85rem;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s;
    margin-right: 12px;
}

.back-to-teams-btn:hover {
    background: rgba(0,153,255,.08);
    border-color: rgba(0,153,255,.3);
    text-decoration: none;
}

/* Hide timezone on mobile */
@media (max-width: 1024px) {
    .desktop-only-tz {
        display: none !important;
    }
}

/* ─── Top Navigation Menu ─────────────────────────── */
.top-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: 24px;
}

.top-nav > a, .nav-dropdown {
    color: #999;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
    position: relative;
    padding: 10px 14px;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.nav-dropdown {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-dropdown::after {
    content: '▼';
    font-size: 0.6rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.nav-dropdown:hover::after {
    transform: translateY(2px);
}

.top-nav > a::after, .nav-dropdown::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #0099ff;
    box-shadow: 0 0 8px rgba(0,153,255,.5);
    transform: translateX(-50%);
    transition: width 0.2s ease;
}

.top-nav > a:hover, .nav-dropdown:hover {
    color: #fff;
    background: transparent;
}

.top-nav > a:hover::after, .nav-dropdown:hover::before {
    width: 100%;
}

.top-nav > a.active, .nav-dropdown.active {
    color: #0099ff;
    background: transparent;
}

.top-nav > a.active::after, .nav-dropdown.active::before {
    width: 100%;
}

/* Nav Dropdown Menu */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #111111;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 0;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
    padding: 8px 0;
    overflow: visible;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: #999;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
    border-radius: 0;
}

.nav-dropdown-menu a:hover {
    background: rgba(0,153,255,.08);
    color: #fff;
    padding-left: 24px;
    transform: none;
}

.nav-dropdown-menu a::before {
    display: none;
}

/* Socials nested sub-dropdown */
.nav-sub-dropdown {
    position: relative;
}

.nav-sub-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #999;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.nav-sub-dropdown:hover .nav-sub-label {
    background: rgba(0,153,255,.08);
    color: #fff;
    padding-left: 24px;
}

.nav-sub-menu {
    position: absolute;
    top: 0;
    left: 100%;
    background: #111111;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 0;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: all 0.2s ease;
    z-index: 10001;
    padding: 8px 0;
}

.nav-sub-dropdown:hover .nav-sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-sub-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #999;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
}

.nav-sub-menu a:hover {
    background: rgba(0,153,255,.08);
    color: #fff;
    padding-left: 20px;
}

@media (max-width: 1024px) {
    .top-nav {
        display: none !important;
    }
}
