/* Dark Mode (Default) */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111111;
    --border-color: #1a1a1a;
    --border-accent: #2a2a2a;
    --border-bright: #4a9b6f;
    --text-primary: #b8b8b8;
    --text-secondary: #6a6a6a;
    --text-muted: #4a4a4a;
    --accent-red: #c94a44;
    --accent-orange: #d17a3a;
    --accent-blue: #4a9bb8;
    --accent-green: #4a9b6f;
    --accent-yellow: #c9b84a;
    --highlight: #4a9b6f;
    --code-bg: #000000;
    --shadow-sm: 0 0 15px rgba(74, 155, 111, 0.08);
    --shadow-md: 0 0 20px rgba(0, 0, 0, 0.5);
    --glow-text: 0 0 8px rgba(74, 155, 111, 0.2);
    --glow-hover: 0 0 8px rgba(74, 155, 111, 0.15);
}

/* Light Mode */
:root[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --nav-bg: #3f4d5c;
    --border-color: #e5e7eb;
    --border-accent: #d1d5db;
    --border-bright: #059669;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent-red: #dc2626;
    --accent-orange: #ea580c;
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-green-light: #d1fae5;
    --accent-yellow: #d97706;
    --highlight: #059669;
    --code-bg: #f9fafb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --glow-text: none;
    --glow-hover: 0 1px 2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.01em;
    font-size: 15px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
nav {
    background: var(--nav-bg, var(--bg-secondary));
    border-bottom: none;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

:root[data-theme="light"] nav {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.2s ease;
}

.nav-brand:hover {
    color: var(--accent-green);
}

:root[data-theme="light"] .nav-brand {
    color: var(--text-primary);
}

:root[data-theme="light"] .nav-brand:hover {
    color: var(--accent-green);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: #ffffff;
    border-bottom-color: var(--accent-green);
}

:root[data-theme="light"] .nav-links a {
    color: var(--text-secondary);
}

:root[data-theme="light"] .nav-links a:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-green);
}

/* Theme Toggle Switch */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    min-width: 40px;
}

.theme-toggle {
    position: relative;
    width: 52px;
    height: 26px;
    background: var(--border-accent);
    border: 2px solid var(--border-accent);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.theme-toggle:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(74, 155, 111, 0.3);
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle-slider #themeIcon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Light mode toggle state */
.theme-toggle[data-theme="light"] {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.theme-toggle[data-theme="light"] .theme-toggle-slider {
    left: 28px;
    background: #ffffff;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

:root[data-theme="light"] .container {
    background: transparent;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    transition: all 0.3s ease;
}

:root[data-theme="light"] .card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Headers */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2::before {
    content: '▸';
    color: var(--text-muted);
    font-size: 1rem;
}

h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Section Headers with Icons */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header::before {
    content: none !important;
}

.section-icon {
    font-size: 0.6em;
    line-height: 1;
    color: var(--accent-green);
}

:root[data-theme="light"] .section-header {
    border-bottom-color: #d1d5db;
}

:root[data-theme="light"] .section-icon {
    color: #059669;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    position: relative;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    border: none;
    border-radius: 0;
    overflow: visible;
}

:root[data-theme="light"] table {
    background: transparent;
}

th {
    background: transparent;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    position: relative;
}

th:hover {
    color: var(--text-primary);
}

th::after {
    content: '';
    display: none;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

:root[data-theme="light"] td {
    border-bottom: 1px solid #f0f2f4;
}

/* Removed hover background to preserve conditional formatting */

tbody tr:last-child td {
    border-bottom: none;
}

/* Sticky First Column - Keep player/team names visible when scrolling */
table th:first-child,
table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
}

table th:first-child {
    background: var(--bg-secondary);
    z-index: 11;
}

:root[data-theme="light"] table th:first-child {
    background: #ffffff;
}

table td:first-child {
    background: var(--bg-secondary);
    font-weight: 600;
}

:root[data-theme="light"] table td:first-child {
    background: #ffffff;
}

.stat-cell, .sc {
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
}

/* Sorted column highlighting - use borders instead of background */
.stat-highlight {
    font-weight: 700;
    border-left: 3px solid var(--accent-green) !important;
    border-right: 3px solid var(--accent-green) !important;
    position: relative;
}

/* Light mode specific stat highlight */
:root[data-theme="light"] .stat-highlight {
    border-left: 3px solid #059669 !important;
    border-right: 3px solid #059669 !important;
}

/* Winner score highlighting for games pages - matches original stat-highlight styling */
.winner-highlight {
    font-weight: 700;
    color: #22c55e;
    background-color: rgba(34, 197, 94, 0.15);
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

:root[data-theme="light"] .winner-highlight {
    background-color: #d1fae5;
    color: #065f46;
    text-shadow: none;
}

/* Header highlighting for sorted column */
th.stat-highlight {
    border-left: 3px solid var(--accent-green) !important;
    border-right: 3px solid var(--accent-green) !important;
    border-bottom: 3px solid var(--accent-green) !important;
}

:root[data-theme="light"] th.stat-highlight {
    border-left: 3px solid #059669 !important;
    border-right: 3px solid #059669 !important;
    border-bottom: 3px solid #059669 !important;
}

/* Row hover effect */
table tbody tr {
    transition: all 0.15s ease;
}

table tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--accent-green), inset -3px 0 0 var(--accent-green);
}

:root[data-theme="light"] table tbody tr:hover {
    box-shadow: inset 3px 0 0 #059669, inset -3px 0 0 #059669;
}

/* Make sure first column also shows the left border on hover */
table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--accent-green);
}

:root[data-theme="light"] table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 #059669;
}

/* Links */
a {
    color: var(--accent-green);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

a:hover {
    color: var(--accent-green);
    text-decoration: none;
    border-bottom-color: var(--accent-green);
}

:root[data-theme="light"] a {
    color: #059669;
}

:root[data-theme="light"] a:hover {
    color: #047857;
    border-bottom-color: #047857;
}

/* Light mode specific hover effects - removed to preserve conditional formatting */

/* Footer */
footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.75rem;
}

footer a {
    color: var(--accent-green);
}

/* Badges and Stats */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.badge-win {
    background: rgba(74, 155, 111, 0.12);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 155, 111, 0.15);
}

.badge-loss {
    background: rgba(201, 74, 68, 0.12);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 6px rgba(201, 74, 68, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    /* Navigation - Keep sticky on mobile */
    nav {
        position: sticky;
        padding: 0.75rem 1rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
    }

    .nav-container > div {
        flex-direction: column;
        gap: 0.75rem !important;
    }

    .nav-brand {
        font-size: 1.25rem;
        text-align: center;
        padding-right: 60px; /* Make room for theme toggle */
    }

    .nav-links {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        font-size: 0.75rem;
        width: 100%;
    }

    .nav-links a {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Theme Toggle - Compact top-right position */
    .theme-toggle-wrapper {
        position: absolute;
        top: 1rem;
        right: 1rem;
        gap: 0.35rem;
        flex-direction: row-reverse; /* Icon first, then label */
    }

    .theme-toggle-label {
        font-size: 0.6rem;
        min-width: auto;
        writing-mode: horizontal-tb;
    }

    .theme-toggle {
        width: 40px;
        height: 22px;
    }

    .theme-toggle-slider {
        width: 16px;
        height: 16px;
        top: 1px;
        left: 1px;
        font-size: 9px;
    }

    .theme-toggle[data-theme="light"] .theme-toggle-slider {
        left: 21px;
    }

    /* Container */
    .container {
        padding: 0 0.75rem;
        max-width: 100%;
    }

    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Headers */
    h1 {
        font-size: 1.5rem;
        padding-left: 0.75rem;
    }

    h2 {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    h2::before {
        font-size: 1rem;
    }

    h3 {
        font-size: 0.95rem;
    }

    /* Tables */
    table {
        font-size: 0.7rem;
    }

    th {
        padding: 0.75rem 0.4rem;
        font-size: 0.65rem;
        letter-spacing: 0.05em;
    }

    th::after {
        right: 0.25rem;
        font-size: 0.7rem;
    }

    td {
        padding: 0.75rem 0.4rem;
    }

    /* Enhance sticky column shadow on mobile */
    table th:first-child,
    table td:first-child {
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.15);
    }

    /* View Toggle Buttons */
    .view-toggle-btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.7rem !important;
    }

    /* Search Input */
    input[type="text"] {
        font-size: 0.85rem !important;
        padding: 0.75rem 0.75rem !important;
    }

    /* Flex containers with buttons - header with view toggles */
    .card > div[style*="display: flex"][style*="justify-content: space-between"] {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }

    .card > div[style*="display: flex"][style*="justify-content: space-between"] h2 {
        text-align: center;
    }

    .card > div[style*="display: flex"][style*="justify-content: space-between"] > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.4rem !important;
    }

    /* Box Score specific */
    .box-score-header {
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
        font-size: 0.75rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Faster tooltip delay for garbage time icons */
span[title*="garbage time"] {
    cursor: help;
    position: relative;
}

span[title*="garbage time"]::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}

span[title*="garbage time"]:hover::after {
    opacity: 1;
    transition-delay: 0.2s;
}

