/* ===================================================================
   RidgeSurvivor — PenguinRidge Design System
   =================================================================== */

:root {
    /* Core brand colours */
    --brand-orange: #DD6B20;
    --brand-orange-light: #ED8936;
    --brand-orange-pale: #FBD38D;
    --brand-navy: #1B2A4A;
    --brand-navy-light: #2D3E5F;
    --brand-navy-dark: #111D35;

    /* Semantic colours */
    --success-color: #38A169;
    --warning-color: #D69E2E;
    --danger-color: #E53E3E;

    /* Surfaces */
    --light-bg: #F7F8FC;
    --card-bg: #FFFFFF;
    --border-color: #E2E8F0;

    /* Text */
    --text-primary: #1B2A4A;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    --brand-orange-text: #C05621;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #1B2A4A, #2D3E5F);
    --gradient-secondary: linear-gradient(135deg, #2D3E5F, #3D5175);
    --gradient-accent: linear-gradient(135deg, #3D5175, #4E6690);
    --gradient-light: linear-gradient(135deg, #4E6690, #6080AA);
    --gradient-orange: linear-gradient(135deg, #DD6B20, #ED8936);
    --gradient-success: linear-gradient(135deg, #38A169, #48BB78);
    --gradient-warning: linear-gradient(135deg, #D69E2E, #ECC94B);

    /* Effects */
    --shadow-sm: 0 1px 3px rgba(27, 42, 74, 0.06);
    --shadow-md: 0 4px 12px rgba(27, 42, 74, 0.08);
    --shadow-lg: 0 8px 25px rgba(27, 42, 74, 0.12);
    --shadow-orange: 0 4px 14px rgba(221, 107, 32, 0.25);

    /* Radius */
    --radius-sm: 8px;
    --radius-lg: 12px;

    /* Typography scale */
    --text-xs: 0.7rem;
    --text-sm: 0.8rem;
    --text-base: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
}

/* ===================================================================
   Base
   =================================================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--brand-orange-text); }
a:hover { color: var(--brand-orange); }

/* ===================================================================
   Navbar (56px, fixed top, gradient-primary)
   =================================================================== */

.navbar-top {
    height: 56px;
    background: var(--gradient-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    box-shadow: 0 2px 8px rgba(27, 42, 74, 0.15);
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.5rem;
}

.navbar-brand img {
    height: 36px;
    width: auto;
}

.navbar-brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: white;
}

.navbar-brand-text .brand-accent {
    color: var(--brand-orange);
}

/* Navbar stats */
.navbar-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
}

/* Navbar user section */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-user .nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.navbar-user .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
}

.navbar-user .nav-link.active {
    color: white;
    background: rgba(221, 107, 32, 0.3);
    border-bottom: 2px solid var(--brand-orange);
}

/* ===================================================================
   Sidebar (250px, navy)
   =================================================================== */

.sidebar {
    width: 250px;
    background: var(--brand-navy);
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 1020;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.5rem;
}

.sidebar-section-label {
    padding: 1rem 1rem 0.25rem;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.sidebar .nav-link.active {
    color: white;
    background: rgba(221, 107, 32, 0.15);
    border-left-color: var(--brand-orange);
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0;
}

/* ===================================================================
   Main content area
   =================================================================== */

.main-content {
    margin-top: 56px;
    margin-left: 250px;
    min-height: calc(100vh - 56px);
    padding: 1.5rem;
    flex: 1;
}

/* ===================================================================
   Footer
   =================================================================== */

.footer {
    background: var(--brand-navy);
    color: rgba(255, 255, 255, 0.85);
    border-top: none;
    padding: 2rem 0;
    margin-top: auto;
    margin-left: 250px;
}

.footer a {
    color: var(--brand-orange-light);
    transition: color 0.2s ease;
    text-decoration: none;
}

.footer a:hover { color: white; }
.footer p, .footer span { color: var(--brand-orange-light); }
.footer strong { color: white; }
.footer .footer-subtitle { color: rgba(255, 255, 255, 0.7); }
.footer .footer-copyright { color: rgba(255, 255, 255, 0.6); }
.footer-logo { max-height: 50px; width: auto; }

/* ===================================================================
   Buttons (3 variants)
   =================================================================== */

.btn-brand-primary {
    background: var(--gradient-orange);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: var(--text-base);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-brand-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-orange);
    color: white;
}

.btn-brand-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: var(--text-base);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-brand-secondary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-brand-danger {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: var(--text-base);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-brand-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(229, 62, 62, 0.25);
    color: white;
}

/* ===================================================================
   Cards
   =================================================================== */

.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header-gradient {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header-gradient i {
    font-size: 1rem;
}

.card-header-orange {
    background: var(--gradient-orange);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===================================================================
   Forms
   =================================================================== */

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-size: var(--text-base);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 0.2rem rgba(221, 107, 32, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

/* ===================================================================
   Tables
   =================================================================== */

.table th {
    background: var(--light-bg);
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.table-hover tbody tr:hover {
    background: rgba(221, 107, 32, 0.04);
}

/* ===================================================================
   Badges
   =================================================================== */

.badge-status {
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    letter-spacing: 0.03em;
}

.badge-active {
    background: var(--gradient-success);
    color: white;
}

.badge-eliminated {
    background: var(--danger-color);
    color: white;
}

.badge-pending {
    background: var(--gradient-orange);
    color: white;
}

.badge-draft {
    background: var(--gradient-secondary);
    color: white;
}

.badge-completed {
    background: var(--gradient-accent);
    color: white;
}

/* ===================================================================
   Team Pick Grid
   =================================================================== */

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

.team-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--card-bg);
}

.team-card:hover:not(.team-card-used):not(.team-card-selected) {
    border-color: var(--brand-orange);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.team-card-selected {
    border-color: var(--brand-orange);
    background: rgba(221, 107, 32, 0.08);
    box-shadow: 0 0 0 2px var(--brand-orange);
}

.team-card-used {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--light-bg);
}

.team-card img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.team-card-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.team-card-used .team-card-name {
    color: var(--text-light);
}

/* ===================================================================
   Leaderboard
   =================================================================== */

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.leaderboard-rank {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-muted);
    min-width: 2rem;
    text-align: center;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-status {
    font-size: var(--text-sm);
}

/* ===================================================================
   Auth Pages (no sidebar)
   =================================================================== */

.auth-page {
    margin-left: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
    background: var(--light-bg);
}

.auth-card {
    max-width: 420px;
    width: 100%;
    margin: 2rem;
}

.auth-card .card-body {
    padding: 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo img {
    height: 60px;
    margin-bottom: 0.75rem;
}

.auth-logo h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ===================================================================
   Stat cards
   =================================================================== */

.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    text-align: center;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-card-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

/* ===================================================================
   Empty state
   =================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.empty-state h5 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ===================================================================
   Toast notifications
   =================================================================== */

.toast-container {
    position: fixed;
    top: 70px;
    right: 1rem;
    z-index: 1050;
}

.toast {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
}

/* ===================================================================
   Focus & Accessibility
   =================================================================== */

*:focus-visible {
    outline: 2px solid var(--brand-orange);
    outline-offset: 2px;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===================================================================
   Responsive
   =================================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .footer {
        margin-left: 0;
    }

    .navbar-stats {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .team-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .stat-card-value {
        font-size: 1.25rem;
    }
}
