/* =========================================================
   QSE Sports — Theme Layer
   Font: Exo 2 Bold Italic (headings/wordmark) + Inter (body)
   ========================================================= */

:root {
    /* Font variables — overridden at runtime by the font picker */
    --qse-heading-font: 'Exo 2', system-ui, sans-serif;
    --qse-body-font: 'Inter', system-ui, sans-serif;

    /* Master brand */
    --qse-navy-deep: #0E1724;
    --qse-navy: #142244;
    --qse-navy-2: #1A2340;
    --qse-blue: #2C6FD6;
    --qse-blue-hover: #3A7BD5;
    --qse-blue-glow: rgba(44, 111, 214, 0.35);
    --qse-silver-1: #D9DDE3;
    --qse-silver-2: #8892A6;
    --qse-off-white: #F4F6FA;

    /* Sport accents */
    --qse-football: #1FA34A;
    --qse-baseball: #DC2626;
    --qse-basketball: #F97316;
    --qse-hockey: #38BDF8;

    /* Bootstrap overrides */
    --bs-primary: #2C6FD6;
    --bs-primary-rgb: 44, 111, 214;
    --bs-link-color: #3A7BD5;
    --bs-link-hover-color: #5B95E6;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* ---- Theme-aware surfaces (flipped by [data-theme=dark] below) ---- */
    --qse-app-bg: #f8f9fa;          /* page canvas behind the content */
    --qse-surface: #ffffff;         /* cards, bars, footer */
    --qse-surface-2: #f1f3f5;       /* subtle raised/striped surface */
    --qse-text: #1A2340;            /* default body text */
    --qse-text-muted: #6c757d;      /* secondary text */
    --qse-border: #e2e6ea;          /* hairlines */

    /* ---- Skeleton shimmer (consumed by Skeleton.razor) ---- */
    --qse-skel-base: rgba(136,146,166,0.18);
    --qse-skel-sheen: rgba(136,146,166,0.34);

    /* ---- Spacing scale ---- */
    --qse-space-2xs: 2px;
    --qse-space-xs: 4px;
    --qse-space-sm: 8px;
    --qse-space-md: 12px;
    --qse-space-lg: 16px;
    --qse-space-xl: 24px;
    --qse-space-2xl: 32px;

    /* ---- Radius scale ---- */
    --qse-radius-sm: 4px;
    --qse-radius-md: 8px;
    --qse-radius-lg: 12px;
    --qse-radius-pill: 999px;

    /* ---- Elevation scale ---- */
    --qse-shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
    --qse-shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --qse-shadow-lg: 0 12px 32px rgba(0,0,0,0.18);

    /* ---- Motion scale ---- */
    --qse-dur-fast: 0.15s;
    --qse-dur: 0.2s;
    --qse-dur-slow: 0.35s;
}

/* ---------- Typography ---------- */
body {
    font-family: var(--qse-body-font);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: var(--qse-heading-font);
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* QSE wordmark — mirrors the logo's chrome-bevel italic look */
.qse-wordmark {
    font-family: var(--qse-heading-font);
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, #F4F6FA 0%, #D9DDE3 40%, #8892A6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 0 rgba(255,255,255,0.12)) drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.qse-accent-text {
    color: var(--qse-blue);
    font-weight: 600;
}

/* ---------- Brand buttons ---------- */
.btn-qse {
    background: linear-gradient(135deg, #2C6FD6 0%, #3A7BD5 100%);
    color: #fff;
    border: none;
    font-family: var(--qse-heading-font);
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 14px var(--qse-blue-glow), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-qse:hover, .btn-qse:focus {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--qse-blue-glow), inset 0 1px 0 rgba(255,255,255,0.25);
    filter: brightness(1.08);
}
.btn-qse:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.btn-qse-outline {
    background: transparent;
    color: var(--qse-off-white);
    border: 1px solid rgba(255,255,255,0.35);
    font-family: var(--qse-heading-font);
    font-weight: 700;
    letter-spacing: 0.03em;
    transition: all 0.15s ease;
}
.btn-qse-outline:hover, .btn-qse-outline:focus {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.6);
}

/* ---------- Hero section ---------- */
.qse-hero {
    position: relative;
    background: radial-gradient(ellipse at 30% 20%, #1A2E5C 0%, #0E1724 65%);
    color: var(--qse-off-white);
    overflow: hidden;
}
.qse-hero::before {
    content: "";
    position: absolute;
    top: -30%;
    left: -15%;
    right: -15%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(44,111,214,0.2) 0%, transparent 65%);
    transform: rotate(-8deg);
    pointer-events: none;
}
.qse-hero > * {
    position: relative;
    z-index: 1;
}

/* Logo image in hero — let it breathe, drop-shadow to separate from bg */
.qse-hero-logo {
    max-width: 340px;
    width: 100%;
    filter: drop-shadow(0 8px 32px rgba(44,111,214,0.4)) drop-shadow(0 2px 8px rgba(0,0,0,0.6));
    border-radius: 16px;
}

/* ---------- Cards ---------- */
.qse-card {
    background: linear-gradient(180deg, rgba(26,35,64,0.85) 0%, rgba(14,23,36,0.85) 100%);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--qse-off-white);
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.qse-card:hover {
    transform: translateY(-3px);
    border-color: rgba(44,111,214,0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(44,111,214,0.2);
}

/* ---------- Sport cards with real PNG logos ---------- */
.accent-football  { --qse-accent: var(--qse-football); }
.accent-baseball  { --qse-accent: var(--qse-baseball); }
.accent-basketball{ --qse-accent: var(--qse-basketball); }
.accent-hockey    { --qse-accent: var(--qse-hockey); }

.sport-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08) !important;
    background: #000 !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}
.sport-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 2px var(--qse-accent, var(--qse-blue));
}

/* The PNG tile — fills card top, crop bottom to hide baked-in accent lines */
.sport-card-img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: -6px;
    clip-path: inset(0 0 4% 0);
}

/* Bottom section of sport card (text area) */
.sport-card-body {
    background: #000;
    border-top: none;
    padding: 0.6rem 1rem;
    text-align: center;
    color: #fff;
}
.sport-card-body .text-muted {
    color: rgba(255,255,255,0.7) !important;
}
.sport-card-body small.text-muted {
    color: rgba(255,255,255,0.7) !important;
}
.sport-card-body .sport-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--qse-heading-font);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--qse-accent, var(--qse-blue));
    color: #fff;
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: #000000 !important;
    border-right: 1px solid rgba(255,255,255,0.08);
}
.sidebar .nav-link {
    border-radius: 6px;
    margin: 2px 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}
.sidebar .nav-link:hover {
    background: rgba(44, 111, 214, 0.15);
    color: #fff !important;
}
.sidebar .nav-link.active {
    background: rgba(44, 111, 214, 0.22);
    box-shadow: inset 3px 0 0 var(--qse-blue);
}

/* Sidebar logo image */
.sidebar-logo {
    max-width: 160px;
    border-radius: 0;
}

/* ---------- Swoosh decorative ---------- */
.qse-swoosh {
    display: inline-block;
    width: 120px;
    height: 10px;
    background: linear-gradient(90deg, transparent, var(--qse-blue), transparent);
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0.55;
}

/* =========================================================
   Dark mode — set on <html data-theme="dark" data-bs-theme="dark">
   by the early-paint script in App.razor (wired to the persisted
   platform_user_preferences.theme). data-bs-theme flips all Bootstrap
   components for free; the rules below flip our own QSE surfaces +
   token values so custom chrome (cards, footer, skeletons) follows.
   ========================================================= */
[data-theme="dark"] {
    --qse-app-bg: #0E1724;          /* navy-deep */
    --qse-surface: #142244;         /* navy */
    --qse-surface-2: #1A2340;       /* navy-2 */
    --qse-text: #F4F6FA;            /* off-white */
    --qse-text-muted: #8892A6;      /* silver-2 */
    --qse-border: rgba(255,255,255,0.10);

    --qse-skel-base: rgba(255,255,255,0.06);
    --qse-skel-sheen: rgba(255,255,255,0.16);

    --qse-shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --qse-shadow-md: 0 4px 12px rgba(0,0,0,0.55);
    --qse-shadow-lg: 0 12px 32px rgba(0,0,0,0.6);

    --bs-link-color: #5B95E6;
    --bs-link-hover-color: #7FB0F0;

    color-scheme: dark;
}

/* Body canvas + default text follow the tokens in dark mode (Bootstrap's
   data-bs-theme handles its own components; this covers the base page). */
[data-theme="dark"] body { background-color: var(--qse-app-bg); color: var(--qse-text); }

/* Our custom light-surface chrome that isn't a Bootstrap component. */
[data-theme="dark"] .lobby-card { background: var(--qse-surface); border-color: var(--qse-border); color: var(--qse-text); }
[data-theme="dark"] .lobby-card .text-muted { color: var(--qse-text-muted) !important; }
[data-theme="dark"] .sport-card-body { background: #000; }

/* =========================================================
   League shell (2026-07-18) — shared chrome for every league
   page: the persistent LeagueNavBar + dashboard panels +
   compact stat tables. Token-driven so dark mode is free.
   ========================================================= */

/* ---------- League nav bar ---------- */
.lg-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    background: var(--qse-surface);
    border: 1px solid var(--qse-border);
    border-radius: var(--qse-radius-md);
    padding: 4px 10px;
    margin-bottom: 14px;
    box-shadow: var(--qse-shadow-sm);
    font-size: 0.85rem;
}
.lg-nav-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--qse-heading-font);
    font-weight: 700;
    color: var(--qse-text);
    text-decoration: none;
    padding: 4px 8px 4px 2px;
    margin-right: 4px;
    border-right: 1px solid var(--qse-border);
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lg-nav-brand:hover { color: var(--qse-blue); }
.lg-nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1px;
    min-width: 0;
}
.lg-nav-link {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--qse-radius-sm);
    color: var(--qse-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--qse-dur-fast) ease;
}
.lg-nav-link:hover { background: rgba(44,111,214,0.10); color: var(--qse-blue); }
.lg-nav-link.active {
    background: rgba(44,111,214,0.14);
    color: var(--qse-blue);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--qse-blue);
}
.lg-nav-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--qse-text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
}

/* Native <details> dropdown — works on static-SSR pages with zero JS. */
.lg-dd { position: relative; display: inline-block; }
.lg-dd > summary {
    list-style: none;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--qse-radius-sm);
    color: var(--qse-text);
    white-space: nowrap;
    user-select: none;
}
.lg-dd > summary::-webkit-details-marker { display: none; }
.lg-dd > summary::after { content: " ▾"; font-size: 0.7em; color: var(--qse-text-muted); }
.lg-dd > summary:hover { background: rgba(44,111,214,0.10); color: var(--qse-blue); }
.lg-dd > summary.active {
    background: rgba(44,111,214,0.14);
    color: var(--qse-blue);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--qse-blue);
}
.lg-nav-brand-name { overflow: hidden; text-overflow: ellipsis; }
.lg-dd[open] > summary { background: rgba(44,111,214,0.14); color: var(--qse-blue); }
.lg-dd-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1050;
    min-width: 200px;
    background: var(--qse-surface);
    border: 1px solid var(--qse-border);
    border-radius: var(--qse-radius-md);
    box-shadow: var(--qse-shadow-md);
    padding: 6px;
}
.lg-dd-menu a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--qse-radius-sm);
    color: var(--qse-text);
    text-decoration: none;
    white-space: nowrap;
}
.lg-dd-menu a:hover { background: rgba(44,111,214,0.10); color: var(--qse-blue); }
/* Close any open dropdown when the pointer leaves it (no-JS nicety). */
@media (hover: hover) {
    .lg-dd:not(:hover):not(:focus-within)[open] > .lg-dd-menu { display: none; }
    .lg-dd:not(:hover):not(:focus-within)[open] > summary { background: transparent; color: var(--qse-text); }
}

/* ---------- Dashboard / league panels ---------- */
.lg-panel {
    background: var(--qse-surface);
    border: 1px solid var(--qse-border);
    border-radius: var(--qse-radius-md);
    box-shadow: var(--qse-shadow-sm);
    margin-bottom: 14px;
}
.lg-panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--qse-border);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--qse-text-muted);
}
.lg-panel-title a { font-weight: 600; letter-spacing: normal; text-transform: none; font-size: 0.78rem; }
.lg-panel-body { padding: 10px 12px; }
.lg-panel-body.p-0 { padding: 0; }

/* ---------- Compact league stat table ---------- */
.lg-table { width: 100%; margin: 0; font-size: 0.83rem; border-collapse: collapse; }
.lg-table th {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qse-text-muted);
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 2px solid var(--qse-border);
    white-space: nowrap;
}
.lg-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--qse-border);
    font-variant-numeric: tabular-nums;
}
.lg-table tbody tr:last-child td { border-bottom: none; }
.lg-table tbody tr:hover { background: rgba(44,111,214,0.05); }
.lg-table .lg-row-me { background: rgba(44,111,214,0.10); font-weight: 600; }
.lg-table a { color: inherit; }
.lg-table a:hover { color: var(--qse-blue); }

/* Sortable header cells (SortableStatTable) */
.lg-table th.lg-sortable { cursor: pointer; }
.lg-table th.lg-sortable:hover { color: var(--qse-blue); }
.lg-table th .lg-sort-arrow { font-size: 0.62rem; color: var(--qse-blue); margin-left: 2px; }

/* Rating bars (RatingBarGrid — shared player-page attribute grid) */
.lg-rating-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 18px; }
.lg-rating-row { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; }
.lg-rating-row .lg-rating-name { width: 88px; color: var(--qse-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-rating-row .lg-rating-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--qse-surface-2); overflow: hidden; }
.lg-rating-row .lg-rating-fill { height: 100%; border-radius: 3px; }
.lg-rating-row .lg-rating-val { width: 24px; text-align: right; font-weight: 700; }

/* Quick-link columns (LeagueHome footer nav) */
.lg-linkcols { display: flex; flex-wrap: wrap; gap: 18px 34px; font-size: 0.82rem; }
.lg-linkcols .lg-linkcol { min-width: 150px; }
.lg-linkcols .lg-linkcol-title {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--qse-text-muted); margin-bottom: 4px;
}
.lg-linkcols a { display: block; padding: 2px 0; color: var(--qse-text); text-decoration: none; }
.lg-linkcols a:hover { color: var(--qse-blue); }
