/* ==========================================================================
   1. CORE VARIABLES & RESET
   ========================================================================== */
:root {
    /* Dynamic school theme colors.
       These are default fallbacks and are intended to be overwritten by theme.js. */
    --school-primary: #b91c1c;
    --school-secondary: #0a0a0b;
    
    /* Global RackStat color system used throughout the app */
    --rackstat-black: #000000;
    --rackstat-gray-dark: #0a0a0b;
    --rackstat-gray-med: #111827;
    --rackstat-gray-light: #1f2937;
    --rackstat-border: #374151;
}

/* Global reset and base font stack for consistent rendering */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Base page styling used across app screens */
body {
    background-color: var(--rackstat-black);
    color: white;
    min-height: 100vh;
    line-height: 1.5;
}

/* ==========================================================================
   2. BOARD HEADER (Small, Centered Layout)
   ========================================================================== */

/* Shared logo container used in compact header layouts */
.header-logo-container {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible; 
}

/* Ensures logos scale cleanly inside the header container */
.header-logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
}

/* Enlarges the non-school logo slightly for stronger RACKSTAT branding */
.header-logo-container img:not(#school-logo) {
    transform: scale(1.75); 
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1));
    image-rendering: -webkit-optimize-contrast;
}

/* ==========================================================================
   3. BRANDING / LOGIN PAGES (Large Branding)
   ========================================================================== */

/* Large-format branded header used on onboarding/login-type pages */
.brand-header {
    background: linear-gradient(to bottom, var(--school-secondary), var(--rackstat-black));
    padding: 40px 20px;
    border-bottom: 2px solid var(--rackstat-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Primary large RACKSTAT logo styling */
.rackstat-logo-large {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Horizontal branding section that pairs school branding with platform branding */
.school-section-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px; 
    width: 100%;
    flex-wrap: wrap;
}

/* Large school logo used on branding-heavy screens; hidden until populated */
.school-logo-large {
    height: 48px;
    width: auto;
    object-fit: contain;
    display: none; 
}

/* ==========================================================================
   4. DATA TABLES (Weight Class Records)
   ========================================================================== */

/* Main table styling for leaderboard/record-style displays */
.record-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 10px; 
    background: var(--rackstat-gray-med); 
    border: 1px solid var(--rackstat-gray-light); 
}

/* Table header row styling with dynamic school accent color */
.record-table th { 
    background: var(--rackstat-gray-light); 
    color: var(--school-primary); 
    text-transform: uppercase; 
    padding: 8px; 
    border: 1px solid var(--rackstat-border); 
    font-weight: 900; 
}

/* Standard table cell styling for record values */
.record-table td { 
    border: 1px solid var(--rackstat-border); 
    padding: 6px; 
    text-align: center; 
}

/* Secondary text styling for athlete names or labels within a record cell */
.record-name { 
    color: #9ca3af; 
    font-weight: bold; 
    display: block; 
    font-size: 8px; 
    text-transform: uppercase;
}

/* Primary record number/value styling */
.record-value { 
    color: white; 
    font-weight: 900; 
    font-style: italic; 
    font-size: 11px; 
}

/* ==========================================================================
   5. CARDS & UI COMPONENTS
   ========================================================================== */

/* Generic card component used across dashboard-style content blocks */
.club-card { 
    background: var(--rackstat-gray-med); 
    border-radius: 8px; 
    padding: 1rem; 
    margin-bottom: 1rem; 
    border: 1px solid var(--rackstat-gray-light); 
    transition: transform 0.2s ease;
}

/* Slight scale effect for hover feedback on cards */
.club-card:hover {
    transform: scale(1.01);
}

/* Reusable primary button style tied to the active school theme */
.btn-primary {
    background-color: var(--school-primary);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-weight: 900;
    text-transform: uppercase;
    font-style: italic;
    cursor: pointer;
    transition: filter 0.2s ease;
}

/* Brightness increase on hover for button feedback */
.btn-primary:hover {
    filter: brightness(1.2);
}

.lobby-btn {
    width: 100%;
    padding: 1.5rem;
    border-radius: 1rem;

    /* ALL BUTTONS NOW USE PRIMARY */
    background-color: var(--school-primary);
    color: var(--school-secondary);

    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: -0.03em;

    border: 2px solid #ffffff;
    border-bottom: 4px solid rgba(0,0,0,0.4);

    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.6),
        0 0 10px color-mix(in srgb, var(--school-primary) 40%, transparent);

    transition: all 0.15s ease;
}

.lobby-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.1);

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.7),
        0 0 16px color-mix(in srgb, var(--school-primary) 60%, transparent);
}

.lobby-btn-primary {
    background-color: var(--school-primary);
}

.lobby-btn-secondary {
    background-color: var(--school-secondary);
    color: var(--school-primary);
    border: 2px solid #ffffff;
}

/* ==========================================================================
   6. COACH REVIEW / INTELLIGENCE HEADER
   ========================================================================== */

/* Controlled school logo sizing to prevent oversized rendering */
.school-logo-primary {
    max-height: 60px;
    width: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

/* Fixed-height logo wrapper used to keep header layouts stable */
.logo-container-fixed {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==========================================================================
   7. UTILITIES
   ========================================================================== */

/* Hides scrollbar in WebKit while preserving scroll behavior */
.no-scrollbar::-webkit-scrollbar { 
    display: none; 
}

/* Theme utility classes for text, background, and borders */
.dynamic-text { color: var(--school-primary) !important; }
.dynamic-bg { background-color: var(--school-primary) !important; }
.dynamic-border { border-color: var(--school-primary) !important; }

/* Global custom scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

/* Scrollbar track color */
::-webkit-scrollbar-track {
    background: var(--rackstat-black);
}

/* Scrollbar thumb uses current school theme color */
::-webkit-scrollbar-thumb {
    background: var(--school-primary);
    border-radius: 10px;
}

/* ==========================================================================
   9. GLOBAL LEGAL FOOTER
   ========================================================================== */

.app-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 5rem;
    padding: 2rem 1rem;
    text-align: center;
}

.app-footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.app-footer-links a {
    color: #6b7280;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: color 0.2s ease;
    text-decoration: none;
}

.app-footer-links a:hover {
    color: white;
}

.app-footer-divider {
    color: #374151;
    font-size: 10px;
}

.app-footer-copy {
    color: #6b7280;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.app-footer-subtext {
    margin-top: 1rem;
    color: #4b5563;
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
/* ==========================================================================
   8. MOBILE HEADER RESPONSIVENESS
   ========================================================================== */

@media (max-width: 640px) {
    header {
        padding: 0.75rem 0.9rem !important;
    }

    header .max-w-6xl,
    header .max-w-5xl {
        gap: 0.5rem !important;
        max-width: 100% !important;
    }

    .header-logo-container {
        width: 36px;
        height: 36px;
    }

    .header-logo-container img {
        max-height: 28px;
        max-width: 44px;
    }

    .header-logo-container img:not(#school-logo) {
        transform: scale(1.25);
    }

    .school-logo-primary,
    #school-logo,
    #coach-school-logo {
        max-height: 34px !important;
        max-width: 72px !important;
        object-fit: contain !important;
    }

    .logo-container-fixed {
        height: 42px;
        max-width: 72px;
    }

    header h1 {
        font-size: 1rem !important;
        line-height: 1.1 !important;
    }

    header h2 {
        font-size: 0.6rem !important;
        line-height: 1.1 !important;
    }

    header p,
    header span {
        line-height: 1.1 !important;
    }

    #school-tag,
    #program-title {
        font-size: 0.7rem !important;
        max-width: 145px !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        text-align: center;
    }

    #lobby-status,
    #office-status,
    #settings-status,
    #rack-status,
    #review-status {
        font-size: 0.45rem !important;
        max-width: 145px !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    header button,
    header a {
        font-size: 0.55rem !important;
        padding: 0.35rem 0.5rem !important;
        white-space: nowrap !important;
    }

    header .h-10,
    header .w-\[1px\] {
        display: none !important;
    }
}

@media (max-width: 420px) {
    .header-logo-container {
        width: 30px;
        height: 30px;
    }

    .header-logo-container img {
        max-height: 24px;
        max-width: 36px;
    }

    .header-logo-container img:not(#school-logo) {
        transform: scale(1.1);
    }

    #school-tag,
    #program-title {
        max-width: 115px !important;
        font-size: 0.62rem !important;
    }

    header button,
    header a {
        font-size: 0.5rem !important;
        padding: 0.3rem 0.45rem !important;
    }
}

/* ==========================================================================
   SHARED APP HEADER - TRUE CENTER LAYOUT
   ========================================================================== */

.app-header {
    background: #000;
    border-bottom: 1px solid rgba(185, 28, 28, 0.55);
    position: sticky;
    top: 0;
    z-index: 40;
}

.app-header-inner {
    max-width: 72rem;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    min-height: 92px;
    padding: 1rem;
}

.app-header-left,
.app-header-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.app-header-left {
    justify-content: flex-start;
}

.app-header-right {
    justify-content: flex-end;
    gap: 1rem;
}

.app-header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    min-width: 0;
}

.app-header-title-wrap {
    text-align: center;
    min-width: 140px;
}

.app-header-title {
    font-size: 0.95rem;
    line-height: 1;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
}

.app-header-subtitle {
    margin-top: 0.25rem;
    font-size: 0.45rem;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #64748b;
}

.app-header-action {
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #64748b;
    transition: color 0.15s ease;
}

.app-header-action:hover {
    color: #fff;
}