/*
 * EDH League Site - Moderate CSS Improvements
 *
 * Changes implemented:
 * 1. Enhanced color palette with elevation system (bg-color, bg-elevated, bg-card)
 * 2. Added box-shadow system (shadow-sm, shadow-md, shadow-lg)
 * 3. Sticky navigation bar with improved spacing
 * 4. Increased border-radius from 4px to 6-8px throughout
 * 5. Added smooth transitions with cubic-bezier easing
 * 6. Improved typography with font weight hierarchy
 * 7. Added zebra striping to tables
 * 8. Enhanced hover states with elevation changes
 * 9. Better focus states for form inputs
 * 10. Improved button styles with lift effect
 * 11. Added active states for nav links and filter buttons
 * 12. Refined card designs with proper shadows
 * 13. Better color contrast with text-muted variable
 * 14. Increased max-width from 1200px to 1400px
 * 15. Improved mobile responsiveness
 */

/* Dark mode (default) */
:root,
:root[data-theme="dark"] {
    --bg-color: #0f1419;
    --bg-elevated: #1a1f26;
    --bg-card: #1e2329;
    --text-color: #e6edf3;
    --text-muted: #9198a1;
    --header-bg: #161b22;
    --accent-color: #4a9eff;
    --accent-hover: #6bb0ff;
    --border-color: #30363d;
    --success-bg: #2d5016;
    --success-text: #90ee90;
    --error-bg: #5d1616;
    --error-text: #ff6b6b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Light mode */
:root[data-theme="light"] {
    --bg-color: #ffffff;
    --bg-elevated: #f6f8fa;
    --bg-card: #ffffff;
    --text-color: #1f2328;
    --text-muted: #656d76;
    --header-bg: #f6f8fa;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #d0d7de;
    --success-bg: #d4edda;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
}

header {
    background-color: var(--header-bg);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.9375rem;
}

nav a:hover {
    background-color: var(--bg-elevated);
    color: var(--accent-hover);
}

nav a.active {
    background-color: var(--bg-elevated);
    color: var(--accent-color);
}

nav #theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    width: auto;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

nav #theme-toggle:hover {
    transform: scale(1.05);
    background-color: var(--bg-elevated);
}

nav #theme-toggle img {
    width: 24px;
    height: 24px;
    display: block;
    filter: brightness(0) saturate(100%) invert(82%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(97%) contrast(91%);
}

:root[data-theme="light"] nav #theme-toggle img {
    filter: brightness(0) saturate(100%) invert(0%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(10%) contrast(100%);
}

main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem;
}

section {
    margin-bottom: 3rem;
}

h2 {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-elevated);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

tbody tr {
    transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

tbody tr:nth-child(even) {
    background-color: var(--bg-elevated);
}

tbody tr:hover {
    background-color: var(--bg-elevated);
}

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

form {
    max-width: 800px;
}

form > div {
    margin-bottom: 1rem;
}

/* Commissioner form player groups */
.player-input-group {
    background-color: var(--bg-card);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.player-input-group h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.player-input-group > div {
    margin-bottom: 1rem;
}

.player-input-group > div:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, select, button {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-elevated);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

button {
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    font-weight: 600;
    border: none;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-left: 3px solid var(--success-text);
}

.error {
    background-color: var(--error-bg);
    color: var(--error-text);
    border-left: 3px solid var(--error-text);
}

footer {
    background-color: var(--header-bg);
    padding: 1.5rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Constitution page styles */
.constitution-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.constitution-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.constitution-section ul {
    list-style-type: none;
    padding-left: 0;
}

.constitution-section li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.constitution-section li:last-child {
    border-bottom: none;
}

.constitution-section li:before {
    content: "→ ";
    color: var(--accent-color);
    font-weight: bold;
    margin-right: 0.5rem;
}

.season-info {
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

.loading {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
    text-align: center;
}

/* Schedule page styles */
.schedule-filters {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-row label {
    font-weight: 500;
    margin-right: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.filter-row select {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: var(--bg-elevated);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    min-width: 150px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-row select:hover {
    background-color: var(--bg-card);
    border-color: var(--accent-color);
}

.filter-row select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.schedule-filters button {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: var(--bg-elevated);
    color: var(--text-color);
    box-shadow: none;
}

.schedule-filters button:hover {
    background-color: var(--bg-card);
    transform: none;
}

.schedule-filters button.active {
    background-color: var(--accent-color);
    color: white;
}

.player-stats {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.player-stats h3 {
    margin-bottom: 0.75rem;
    color: var(--accent-color);
    font-size: 1.25rem;
}

.player-stats p {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.match-card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.match-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.match-card.completed {
    border-left-color: #90ee90;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.match-number {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-color);
}

.match-type {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.match-players {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.player-name {
    padding: 0.75rem;
    background-color: var(--bg-elevated);
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-name:hover {
    background-color: var(--bg-color);
}

/* Deck page styles */
.deck-filters {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.deck-filters select {
    width: auto;
    min-width: 200px;
}

.player-decks {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.player-decks h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

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

.deck-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.deck-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
}

.deck-card h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.deck-card .commander {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.deck-card a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.deck-card a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

@media (max-width: 768px) {
    header, main, footer {
        padding: 1rem;
    }

    nav {
        gap: 0.5rem;
    }

    nav a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .schedule-filters,
    .deck-filters {
        flex-direction: column;
    }

    .schedule-filters button,
    .deck-filters select {
        width: 100%;
    }

    .match-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Results page styles */
.results-table {
    width: 100%;
    margin-top: 1rem;
}

.results-table th,
.results-table td {
    padding: 0.5rem;
}

.results-table thead {
    background-color: var(--bg-color);
}

/* Commissioner page - centered floating card */
.commissioner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem 1rem;
}

.commissioner-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 3rem;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

:root[data-theme="light"] .commissioner-card {
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.1);
}

.commissioner-card h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.commissioner-card #auth-status {
    text-align: center;
    margin-bottom: 2rem;
}

.commissioner-card #auth-status button {
    width: auto;
    padding: 0.75rem 2rem;
    margin: 1rem auto 0;
    display: block;
}

/* Google Sign-In button container */
#login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

#google-signin-button {
    max-width: 400px;
    width: 100%;
    display: flex;
    justify-content: center;
}

@media (max-width: 768px) {
    .commissioner-card {
        padding: 2rem 1.5rem;
    }
}
