@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Accessibility & Contrast Focused Palette */

    /* Dark Mode (Default) - High Contrast */
    --bg-primary: hsl(222, 47%, 7%);
    /* Almost Black Slate */
    --bg-secondary: hsl(217, 33%, 13%);
    /* Dark Slate */
    --bg-tertiary: hsl(217, 33%, 20%);
    /* Lighter for inputs */

    /* Accessible Accents - Verified for CVD */
    /* Indigo (Primary) - Distinct from background */
    --accent-primary: hsl(250, 80%, 70%);
    /* Teal/Cyan (Secondary) - Distinct from Indigo */
    --accent-secondary: hsl(190, 90%, 45%);
    --accent-gradient: linear-gradient(135deg, hsl(250, 70%, 60%), hsl(190, 80%, 40%));

    /* Text - Maximum Contrast */
    --text-primary: hsl(0, 0%, 100%);
    /* Pure White */
    --text-secondary: hsl(210, 20%, 85%);
    /* Very Light Gray */
    --text-muted: hsl(215, 15%, 65%);

    /* Functional Colors - Shapes & Contrast matter, but we ensure distinct hues */
    --success: hsl(150, 60%, 45%);
    /* Distinct Green */
    --warning: hsl(40, 90%, 60%);
    /* Amber/Orange */
    --error: hsl(0, 85%, 65%);
    /* Bright Red/Pinkish for visibility */

    /* Net Types */
    --net-high: hsl(340, 80%, 70%);
    /* Pink/Red */
    --net-mix: hsl(40, 90%, 60%);
    /* Amber */
    --net-low: hsl(190, 80%, 50%);
    /* Cyan */

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Shadows - Stronger for depth */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.7);

    --transition: 0.2s ease-out;
}

[data-theme="light"] {
    /* Light Mode - High Contrast "Paper" Style */
    --bg-primary: hsl(0, 0%, 98%);
    /* Off White */
    --bg-secondary: hsl(0, 0%, 100%);
    /* Pure White */
    --bg-tertiary: hsl(210, 10%, 94%);
    /* Very Light Gray inputs */

    /* Text - Almost Black for max contrast */
    --text-primary: hsl(222, 47%, 5%);
    --text-secondary: hsl(215, 25%, 30%);
    --text-muted: hsl(215, 20%, 50%);

    /* Stronger Shadows for light mode visibility */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);

    /* Darker accents for visibility on white */
    --accent-primary: hsl(250, 70%, 45%);
    /* Deep Indigo */
    --accent-secondary: hsl(180, 100%, 25%);
    /* Deep Teal */
    --accent-gradient: linear-gradient(135deg, hsl(250, 70%, 50%), hsl(190, 90%, 35%));

    /* Functional - Darker for contrast */
    --success: hsl(150, 80%, 35%);
    --warning: hsl(35, 90%, 45%);
    --error: hsl(0, 70%, 50%);

    /* Badges - Darker text */
    --net-high: hsl(340, 70%, 45%);
    --net-mix: hsl(35, 90%, 40%);
    --net-low: hsl(180, 90%, 35%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Gradient background animation */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%,
            hsla(270, 80%, 60%, 0.1) 0%,
            transparent 50%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

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

/* Header */
header {
    text-align: center;
    padding: 3rem 0 2rem;
    position: relative;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Glass Card */
.card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: hsl(10, 80%, 50%);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Net Type Badges - Gentile & Accessible */
.badge {
    display: inline-block;
    padding: 0.35em 0.8em;
    border-radius: 9999px;
    /* Pill shape */
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border: 1px solid transparent;
    /* Prepare for border */
}

/* Light Mode - Pastel Backgrounds, Dark Text */
[data-theme="light"] .badge-high {
    background-color: hsl(350, 100%, 96%);
    /* Very Light Pink */
    color: hsl(350, 80%, 30%);
    /* Deep Red */
    border-color: hsl(350, 60%, 85%);
}

[data-theme="light"] .badge-mix {
    background-color: hsl(40, 100%, 94%);
    /* Light Cream/Orange */
    color: hsl(35, 90%, 25%);
    /* Deep Brown/Orange */
    border-color: hsl(35, 60%, 80%);
}

[data-theme="light"] .badge-low {
    background-color: hsl(190, 90%, 95%);
    /* Light Cyan */
    color: hsl(185, 90%, 25%);
    /* Deep Teal */
    border-color: hsl(185, 60%, 80%);
}

/* Dark Mode (Default) - Muted Backgrounds, Light Text */
.badge-high {
    background-color: hsl(350, 60%, 20%);
    /* Muted Dark Red */
    color: hsl(350, 100%, 90%);
    /* Light Pink Text */
    border-color: hsl(350, 50%, 30%);
}

.badge-mix {
    background-color: hsl(35, 60%, 20%);
    /* Muted Dark Orange */
    color: hsl(35, 100%, 90%);
    /* Light Orange Text */
    border-color: hsl(35, 50%, 30%);
}

.badge-low {
    background-color: hsl(190, 60%, 15%);
    /* Muted Dark Cyan */
    color: hsl(190, 100%, 90%);
    /* Light Cyan Text */
    border-color: hsl(190, 50%, 25%);
}

/* Finale Badge - High Impact */
.badge-final {
    margin-left: 0.5rem;
    padding: 0.35em 1em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: hsl(190, 90%, 60%);
    /* Bright Cyan for Dark Mode */
    color: #000000;
    /* Black text on bright BG */
}

[data-theme="light"] .badge-final {
    background-color: hsl(200, 100%, 30%);
    /* Strong Blue/Teal for Light Mode */
    color: #ffffff;
    /* White text on dark BG */
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
}

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

tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background var(--transition);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Match Card */
.match-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border-left: 4px solid var(--accent-primary);
    transition: transform var(--transition), box-shadow var(--transition);
}

.match-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.match-time {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.match-teams {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.match-info {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--error);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
}

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

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .container {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.btn-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Filter Button */
.filter-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
    font-size: 0.9em;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Add compact table styles */
.table-sm th,
.table-sm td {
    padding: 0.25rem 0.5rem;
    font-size: 0.85em;
}

/* Ensure modal fits in viewport */
.modal {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Ensure footer is always visible */
.modal-footer {
    flex-shrink: 0;
    z-index: 10;
}

/* Highlight for earliest time */
.highlight-earliest {
    color: var(--success);
    font-weight: 700;
}