/* ==========================================================================
   Vinosports Design System — "The Mid-Century Mainstay"
   ==========================================================================
   Single source of truth for palette, global styles, and utility classes.
   Shared across Hub, EPL, NBA, and all future league apps.

   To change the palette globally, edit the :root block below.
   League-specific CSS lives in each app's own styles.css.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. PALETTE — CSS Custom Properties (Theme Tokens)
   --------------------------------------------------------------------------
   Values are RGB triplets (no commas) for Tailwind alpha-value compatibility:
       background-color: rgb(var(--color-accent) / 0.5);
   -------------------------------------------------------------------------- */

:root {
    /* Foundation */
    --color-bg:          245 240 225;   /* #f5f0e1 warm parchment */
    --color-surface:     255 255 255;   /* #ffffff surface-container-lowest */
    --color-dark:         42  50  43;   /* #2a322b inverse-surface */
    --color-text:         22  29  22;   /* #161d16 on-surface */
    --color-muted:       141 112 110;   /* #8d706e outline */
    --color-border:      226 190 188;   /* #e2bebc outline-variant */

    /* Primary — "Sport Red" */
    --color-accent:      179  38  47;   /* #b3262f */
    --color-accent-nav:  179  38  47;   /* #b3262f */
    --color-accent-light: 255 218 216;  /* #ffdad8 primary-fixed */

    /* Secondary — "Heritage Navy" */
    --color-secondary:    72  95 132;   /* #485f84 */

    /* Tertiary — "Boardwalk Gold" */
    --color-gold:        118  90   5;   /* #765a05 */
}


/* --------------------------------------------------------------------------
   2. GLOBAL / PAGE
   -------------------------------------------------------------------------- */

.theme-page {
    background-color: rgb(var(--color-bg));
    color: rgb(var(--color-text));
    transition: background-color 0.2s ease, color 0.2s ease;
}


/* --------------------------------------------------------------------------
   3. NAVBAR
   -------------------------------------------------------------------------- */

.site-nav {
    background-color: #f5f0e1;
    border-bottom: 4px solid #b3262f;
    position: sticky;
    top: 0;
    z-index: 40;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #485f84;
    transition: color 0.3s, background-color 0.3s;
}
.nav-link:hover {
    color: #b3262f;
    background-color: rgba(179, 38, 47, 0.06);
}
.nav-link.nav-link-active {
    color: #b3262f;
    background-color: rgba(179, 38, 47, 0.1);
}

.nav-logo-text {
    color: #b3262f;
}

.nav-action-link {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #485f84;
    transition: color 0.3s, background-color 0.3s;
}
.nav-action-link:hover {
    color: #b3262f;
    background-color: rgba(179, 38, 47, 0.06);
}


/* --------------------------------------------------------------------------
   4. DROPDOWN MENU
   -------------------------------------------------------------------------- */

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: rgb(var(--color-text));
    transition: background-color 0.15s;
}
.dropdown-link:hover {
    background-color: rgb(var(--color-accent-light));
}
.dropdown-link.dropdown-link-active {
    color: rgb(var(--color-accent));
    background-color: rgb(var(--color-accent-light));
}


/* --------------------------------------------------------------------------
   5. MOBILE MENU
   -------------------------------------------------------------------------- */

.mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.375rem;
    color: #485f84;
    transition: color 0.15s, background-color 0.15s;
}
.mobile-menu-btn:hover {
    color: #b3262f;
    background-color: rgba(179, 38, 47, 0.06);
}

.mobile-menu-shell {
    background-color: #f5f0e1;
    border-top: 1px solid rgb(var(--color-border));
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.mobile-menu-shell.open {
    max-height: 100vh;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #485f84;
    transition: color 0.3s, background-color 0.3s;
}
.mobile-nav-link:hover {
    color: #b3262f;
    background-color: rgba(179, 38, 47, 0.06);
}
.mobile-nav-link.nav-link-active {
    color: #b3262f;
    background-color: rgba(179, 38, 47, 0.1);
}


/* --------------------------------------------------------------------------
   6. WEBSOCKET STATUS DOT
   -------------------------------------------------------------------------- */

.ws-status {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}
.ws-status.connected {
    background-color: #16a34a;
    box-shadow: 0 0 4px rgba(22, 163, 74, 0.5);
}
.ws-status.disconnected {
    background-color: #a8a29e;
}


/* --------------------------------------------------------------------------
   7. SIDEBAR
   -------------------------------------------------------------------------- */

.sidebar-nav { padding: 0 0.5rem; }

.sidebar-links { display: flex; flex-direction: column; gap: 0.125rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Epilogue', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(var(--color-secondary));
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-link:hover {
    color: rgb(var(--color-accent));
    background-color: rgba(var(--color-accent-light), 0.3);
}
.sidebar-link--active {
    color: rgb(var(--color-accent));
    background-color: rgba(var(--color-accent-light), 0.4);
    border-left-color: rgb(var(--color-accent));
}

.sidebar-divider {
    height: 4px;
    border-radius: 9999px;
    background: linear-gradient(to right, #b3262f 0%, #b3262f 45%, #f5f0e1 45%, #f5f0e1 55%, #485f84 55%, #485f84 100%);
    margin: 0.75rem 0.75rem;
}

/* Mobile sidebar overlay + drawer */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
}
.sidebar-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
}
.sidebar-drawer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 16rem;
    background-color: rgb(var(--color-surface));
    border-right: 1px solid rgb(var(--color-border));
    padding: 1rem 0;
    overflow-y: auto;
    animation: slide-in-left 0.2s ease-out;
}
.sidebar-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 0.75rem;
    border-bottom: 1px solid rgb(var(--color-border));
    margin-bottom: 0.75rem;
}
.sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 0.375rem;
    color: rgb(var(--color-muted));
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}
.sidebar-close-btn:hover {
    color: rgb(var(--color-text));
    background-color: rgb(var(--color-accent-light));
}

/* League sidebar — sticky desktop column */
.league-sidebar {
    width: 13rem;
    flex-shrink: 0;
    background-color: rgb(var(--color-surface));
    border-right: 1px solid rgb(var(--color-border));
    position: sticky;
    top: 3.5rem; /* below global nav */
    height: calc(100vh - 3.5rem);
    overflow-y: auto;
    padding: 1rem 0;
}


/* --------------------------------------------------------------------------
   8. FOOTER
   -------------------------------------------------------------------------- */

.site-footer {
    background-color: #2a322b;
    color: #eaf3e7;
    margin-top: auto;
}


/* --------------------------------------------------------------------------
   9. SPINNER
   -------------------------------------------------------------------------- */

.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgb(var(--color-border));
    border-top-color: rgb(var(--color-accent));
    border-radius: 9999px;
    animation: spin 0.6s linear infinite;
}
.spinner-sm {
    width: 0.875rem;
    height: 0.875rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


/* --------------------------------------------------------------------------
   10. DESIGN SYSTEM UTILITIES — "The Mid-Century Mainstay"
   -------------------------------------------------------------------------- */

/* Grain overlay — subtle analog texture across the page */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Varsity stripe — signature triple-stripe divider */
.varsity-stripe {
    height: 8px;
    border-radius: 9999px;
    background: linear-gradient(to right,
        #b3262f 0%, #b3262f 45%,
        #f5f0e1 45%, #f5f0e1 55%,
        #485f84 55%, #485f84 100%);
}
.varsity-stripe-vertical {
    width: 8px;
    border-radius: 9999px;
    background: linear-gradient(to bottom,
        #b3262f 0%, #b3262f 45%,
        #f5f0e1 45%, #f5f0e1 55%,
        #485f84 55%, #485f84 100%);
}

/* Jukebox button — tactile press effect */
.jukebox-btn {
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.jukebox-btn:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), 0 6px 8px -1px rgba(0,0,0,0.12);
}
.jukebox-btn:active {
    transform: translateY(2px);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2);
}


/* --------------------------------------------------------------------------
   11. AVATARS
   -------------------------------------------------------------------------- */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: var(--avatar-bg, #374151);
    flex-shrink: 0;
    overflow: hidden;
}
.avatar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.avatar-crest-img,
.avatar-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Sizes */
.avatar--sm  { width: 2rem;   height: 2rem;   }
.avatar--sm .avatar-icon  { font-size: 1.125rem; }

.avatar--md  { width: 2.5rem; height: 2.5rem; }
.avatar--md .avatar-icon  { font-size: 1.375rem; }

.avatar--lg  { width: 3.5rem; height: 3.5rem; }
.avatar--lg .avatar-icon  { font-size: 2rem; }

.avatar--xl  { width: 6rem;   height: 6rem;   }
.avatar--xl .avatar-icon  { font-size: 3.5rem; }

.avatar-icon {
    color: #fff;
    line-height: 1;
}

/* Frames (border treatments) */
.avatar-frame { border: 2px solid transparent; }
.avatar-frame--gold   { border-color: rgb(var(--color-gold)); }
.avatar-frame--accent { border-color: rgb(var(--color-accent)); }


/* --------------------------------------------------------------------------
   12. BADGE CARDS
   -------------------------------------------------------------------------- */

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.75rem;
}

.badge-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--color-border));
    background: rgb(var(--color-surface));
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

/* Rarity accent — bottom border stripe like a collectible card */
.badge-card--common    { border-bottom: 3px solid #a8a29e; }
.badge-card--uncommon  { border-bottom: 3px solid #22c55e; }
.badge-card--rare      { border-bottom: 3px solid #3b82f6; }
.badge-card--epic      { border-bottom: 3px solid #8b5cf6; }

/* Earned cards get a subtle lift on hover */
.badge-card--earned:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

/* Locked cards — greyed out with reduced opacity */
.badge-card--locked {
    opacity: 0.4;
    filter: grayscale(0.8);
}
.badge-card--locked .badge-card-icon {
    opacity: 0.5;
}

.badge-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

/* Rarity-tinted icons for earned cards */
.badge-card--earned.badge-card--common  .badge-card-icon  { color: #78716c; }
.badge-card--earned.badge-card--uncommon .badge-card-icon { color: #16a34a; }
.badge-card--earned.badge-card--rare    .badge-card-icon  { color: #2563eb; }
.badge-card--earned.badge-card--epic    .badge-card-icon  { color: #7c3aed; }

.badge-card-name {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgb(var(--color-text));
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.badge-card-desc {
    font-size: 0.6875rem;
    color: rgb(var(--color-muted));
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

/* Rarity pills */
.badge-rarity-pill {
    display: inline-block;
    margin-top: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-rarity-pill--common    { background: #f5f5f4; color: #78716c; }
.badge-rarity-pill--uncommon  { background: #f0fdf4; color: #16a34a; }
.badge-rarity-pill--rare      { background: #eff6ff; color: #2563eb; }
.badge-rarity-pill--epic      { background: #f5f3ff; color: #7c3aed; }
.badge-rarity-pill--legendary { background: #fef9ee; color: #b8860b; }


/* --------------------------------------------------------------------------
   13. ANIMATIONS
   -------------------------------------------------------------------------- */

@keyframes slide-in-left {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
