/* ============================================================
   GameReps League Manager — Design System
   Mobile-first. System fonts. No framework.
   ============================================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.5; color: var(--color-text); background: var(--color-bg); -webkit-font-smoothing: antialiased; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- CSS Variables --- */
:root {
    --color-primary: #1F4E79;
    --color-primary-light: #2E6FA5;
    --color-primary-dark: #163A5C;
    --color-primary-bg: #EBF2F8;

    --color-success: #2D8A4E;
    --color-success-bg: #E6F4EC;
    --color-warning: #D4A017;
    --color-warning-bg: #FFF8E1;
    --color-danger: #C53030;
    --color-danger-bg: #FDE8E8;
    --color-info: #2B6CB0;
    --color-info-bg: #EBF4FF;

    --color-bg: #FFFFFF;
    --color-surface: #F7F8FA;
    --color-border: #E2E8F0;
    --color-border-dark: #CBD5E0;
    --color-text: #1A202C;
    --color-text-secondary: #718096;
    --color-text-muted: #A0AEC0;

    --color-accent: var(--color-primary);

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);

    --sidebar-width: 240px;
    --header-height: 56px;
    --bottom-bar-height: 60px;
}

/* --- Typography --- */
h1 { font-size: 24px; font-weight: 600; line-height: 1.3; color: var(--color-text); }
h2 { font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--color-text); }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--color-text); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 600; }

/* --- Layout --- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--space-md); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Spacing utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* --- Page Layouts --- */

/* Auth pages (signup, login, invite) */
.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: var(--color-surface);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl);
}
.auth-logo {
    text-align: center;
    margin-bottom: var(--space-lg);
}
.auth-logo h1 {
    font-size: 24px;
    color: var(--color-primary);
}
.auth-logo p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: var(--space-xs);
}

/* Dashboard layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (desktop) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-primary-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.2s ease;
}
.sidebar-header {
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h2 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-header .tier-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: var(--space-xs);
}
.tier-badge.lite { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.8); }
.tier-badge.pro { background: #D4A017; color: #1A202C; }

.sidebar-nav {
    flex: 1;
    padding: var(--space-sm) 0;
}
.sidebar-nav a, .sidebar-nav button {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: 10px var(--space-md);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    text-decoration: none;
}
.sidebar-nav a:hover, .sidebar-nav button:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left: 3px solid #fff;
    padding-left: calc(var(--space-md) - 3px);
}
.sidebar-nav .nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.35);
    padding: var(--space-md) var(--space-md) var(--space-xs);
    font-weight: 600;
}
.sidebar-nav .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}
.sidebar-footer .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--color-surface);
}
.content-header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.content-header h1 {
    font-size: 20px;
}
.content-body {
    padding: var(--space-lg);
    max-width: 1100px;
}

/* Mobile: sidebar hidden, bottom tabs shown */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        display: none;
    }
    .sidebar-overlay.open {
        display: block;
    }
    .main-content {
        margin-left: 0;
        padding-bottom: var(--bottom-bar-height);
    }
    .content-header {
        padding: var(--space-sm) var(--space-md);
    }
    .content-body {
        padding: var(--space-md);
    }
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--color-primary-dark);
        color: #fff;
        padding: var(--space-sm) var(--space-md);
        position: sticky;
        top: 0;
        z-index: 90;
    }
    .mobile-header h2 { color: #fff; font-size: 16px; }
    .mobile-header button {
        background: none;
        border: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        padding: var(--space-xs);
    }
}
@media (min-width: 768px) {
    .mobile-header { display: none; }
    .bottom-tabs { display: none !important; }
}

/* Bottom tabs (mobile) */
.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-bar-height);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 80;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--color-text-muted);
    padding: var(--space-xs) var(--space-sm);
    min-width: 64px;
    text-decoration: none;
}
.bottom-tabs a.active {
    color: var(--color-primary);
}
.bottom-tabs a .tab-icon {
    font-size: 22px;
}

/* --- Landing Page --- */
.landing-hero {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: #fff;
    padding: var(--space-2xl) var(--space-md);
    text-align: center;
}
.landing-hero h1 {
    font-size: 32px;
    color: #fff;
    margin-bottom: var(--space-md);
}
.landing-hero p {
    font-size: 18px;
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto var(--space-lg);
}
@media (min-width: 768px) {
    .landing-hero { padding: 80px var(--space-lg); }
    .landing-hero h1 { font-size: 44px; }
}
