/* Sticky first column for standings and results tables */
.standings-table th:first-child,
.standings-table td:first-child,
.results-matrix th:first-child,
.results-matrix td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.04);
}

/* Second column sticky for results-matrix (team names) */
.results-matrix th:nth-child(2),
.results-matrix td:nth-child(2) {
    position: sticky;
    left: 50px;
    z-index: 2;
    background: var(--surface);
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.04);
}

/* Horizontal scroll for results-matrix and standings-table on mobile */
.results-matrix,
.standings-table {
    display: block;
    overflow-x: auto;
    width: 100%;
    min-width: 400px;
}

/* Results matrix specific styling */
.results-matrix {
    table-layout: auto;
}

/* Fixed width for result cells to prevent wrapping */
.results-matrix th:not(:first-child):not(:nth-child(2)),
.results-matrix td:not(:first-child):not(:nth-child(2)) {
    min-width: 55px;
    width: 55px;
    white-space: nowrap;
    text-align: center;
}

/* First column (rank numbers) */
.results-matrix th:first-child,
.results-matrix td:first-child {
    min-width: 50px;
    width: 50px;
    text-align: center;
}

/* Second column (team names) */
.results-matrix th:nth-child(2),
.results-matrix td:nth-child(2) {
    min-width: 120px;
    white-space: nowrap;
}

/* Desktop: make table fill width when space available */
@media (min-width: 1024px) {
    .results-matrix {
        table-layout: fixed;
        width: 100%;
    }
    
    .results-matrix th:nth-child(2),
    .results-matrix td:nth-child(2) {
        width: auto;
        min-width: 150px;
    }
    
    .results-matrix th:not(:first-child):not(:nth-child(2)),
    .results-matrix td:not(:first-child):not(:nth-child(2)) {
        width: auto;
    }
}

@media (max-width: 640px) {
    .results-matrix,
    .standings-table {
        min-width: 350px;
        font-size: 0.82rem;
    }
    .standings-table th,
    .standings-table td {
        padding: 0.5rem 0.4rem;
    }
    .results-matrix th,
    .results-matrix td {
        padding: 0.5rem 0.3rem;
    }
    
    /* Ensure score cells don't wrap on mobile */
    .results-matrix th:not(:first-child):not(:nth-child(2)),
    .results-matrix td:not(:first-child):not(:nth-child(2)) {
        min-width: 50px;
        width: 50px;
        font-size: 0.8rem;
    }
    
    .results-matrix th:nth-child(2),
    .results-matrix td:nth-child(2) {
        min-width: 100px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
/* Modern Sports App Design System 2025 - FlashScore/SofaScore Inspired */

:root {
    --primary: #00a859;
    --primary-dark: #008a47;
    --accent: #ff6b00;
    --surface: #ffffff;
    --bg: #f4f5f7;
    --text: #1a1a2e;
    --text-secondary: #6a7178;
    --border: #e4e6eb;
    --success: #00a859;
    --danger: #dc2626;
    --warning: #f59e0b;
    --male: #0891b2;
    --female: #e91e63;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #00d170;
        --primary-dark: #00a859;
        --accent: #ff8534;
        --surface: #1a1d2e;
        --bg: #0d1117;
        --text: #e6edf3;
        --text-secondary: #8b949e;
        --border: #30363d;
        --success: #00d170;
        --danger: #f85149;
        --warning: #fbbf24;
        --male: #22d3ee;
        --female: #f472b6;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sports App Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 0;
    box-shadow: var(--shadow-sm);
}

header h1 {
    font-size: clamp(1.125rem, 2.5vw, 1.375rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}

header h1 a {
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

header h1 a:hover {
    opacity: 0.8;
}

/* Container with Air Design */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

main {
    padding: clamp(1.5rem, 4vw, 2rem) 0;
    min-height: calc(100vh - 180px);
}

/* Typography - Sports Focused */
h1 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--text);
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: clamp(0.875rem, 2vw, 1.25rem);
    color: var(--text);
}

h3 {
    font-size: clamp(1.125rem, 2.5vw, 1.375rem);
    font-weight: 600;
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    color: var(--text);
}

p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text);
}

/* Grid Layout for Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(1rem, 3vw, 2rem);
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 3vw, 1.75rem);
    box-shadow: var(--shadow);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

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

.card-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Sports Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.9375rem;
}

thead {
    background: var(--bg);
}

th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9375rem;
}

tbody tr {
    transition: background-color 0.15s;
}

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

.standings-table td:first-child,
.standings-table th:first-child {
    text-align: center;
    width: 50px;
    font-weight: 700;
    color: var(--primary);
}

.standings-table td:nth-child(2),
.standings-table th:nth-child(2) {
    font-weight: 600;
}

.standings-table td:last-child,
.standings-table th:last-child {
    text-align: center;
    color: var(--text-secondary);
}

/* Buttons - Sports App Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    line-height: 1;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 168, 89, 0.25);
}

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

.btn-success:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 168, 89, 0.25);
}

.btn-danger {
    background: var(--danger) !important;
    color: white !important;
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: #b91c1c !important;
    border-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

/* Forms - Clean & Accessible */
.form-group {
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: clamp(0.625rem, 2vw, 0.875rem);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: clamp(0.875rem, 2vw, 1rem);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3125rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success {
    background: rgba(0, 168, 89, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.badge-published {
    background: rgba(0, 168, 89, 0.1);
    color: var(--success);
}

.badge-draft {
    background: rgba(106, 113, 120, 0.1);
    color: var(--text-secondary);
}

.badge-male {
    background: rgba(8, 145, 178, 0.1);
    color: var(--male);
}

.badge-female {
    background: rgba(233, 30, 99, 0.1);
    color: var(--female);
}

/* Match List - Sports App Style */
.match-list {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.match-item {
    background: var(--surface);
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all 0.2s;
    position: relative;
}

.match-item:hover {
    background: var(--bg);
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.match-link {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.match-date {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    min-width: 55px;
    text-align: center;
}

.match-teams {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
}

.match-score {
    font-weight: 700;
    color: var(--text);
    font-size: 1.125rem;
    min-width: 50px;
    text-align: center;
}

.video-icon {
    padding: 0.375rem 0.625rem;
    background: rgba(0, 168, 89, 0.1);
    color: var(--primary);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
    display: inline-block;
}

.match-item:hover .video-icon {
    background: rgba(0, 168, 89, 0.2);
    transform: scale(1.1);
}

/* Modal - Modern Overlay */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    margin: clamp(2rem, 5vh, 5rem) auto;
    border-radius: 16px;
    width: min(90%, 600px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    margin: 0;
}

.close {
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    transition: color 0.2s;
}

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

.modal-content form {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.modal-footer {
    padding: clamp(1rem, 3vw, 1.5rem);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg);
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

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

code {
    background: var(--bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.875em;
    color: var(--primary);
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 0.7;
}

/* Schedule Specific */
.schedule-header {
    margin-bottom: 1.5rem;
}

.filters {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
    margin-top: 1rem;
}

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

.filter-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
    margin: 0;
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9375rem;
    min-width: 180px;
    background: var(--surface);
    color: var(--text);
}

.date-group {
    margin-bottom: 1rem;
}

.date-header {
    margin-top: 1.5rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.date-header:hover {
    background: var(--border);
}

.date-header.collapsed {
    background: var(--surface);
}

.toggle-icon {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 1rem;
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: var(--bg);
    border-color: var(--primary);
}

/* Print Styles */
.print-header {
    text-align: center;
    margin-bottom: 2rem;
}

.print-header h2 {
    margin-bottom: 0.5rem;
}

.print-header h3 {
    font-weight: normal;
    color: var(--text-secondary);
}

.print-actions {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

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

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

.schedule-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.875rem;
}

.schedule-table tbody tr:hover {
    background: var(--bg);
}

.schedule-table td:nth-child(1) { width: 12%; }
.schedule-table td:nth-child(2) { width: 10%; }
.schedule-table td:nth-child(3) { width: 40%; }
.schedule-table td:nth-child(4) { width: 28%; }
.schedule-table td:nth-child(5) {
    width: 10%;
    text-align: center;
    font-weight: 600;
}

/* Match Detail Page */
.match-header {
    padding: clamp(2rem, 5vw, 3rem) 1rem;
    text-align: center;
}

.tournament-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.teams-score {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: clamp(1rem, 3vw, 2rem);
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.team {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-name {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
}

.team-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.team.home {
    text-align: right;
}

.score {
    font-size: clamp(3rem, 10vw, 4.5rem);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-divider {
    opacity: 0.3;
}

.match-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.info-value {
    font-size: 0.9375rem;
    font-weight: 500;
}

.video-container {
    padding: clamp(2rem, 5vw, 3rem) 1rem;
}

.video-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.video-aspect {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
}

.video-aspect iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.no-video {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.7;
}

/* Responsive - Mobile First */
@media (max-width: 640px) {
    .match-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.5rem;
    }

    .match-date,
    .match-teams,
    .match-score {
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.625rem 0.5rem;
    }

    .teams-score {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .team {
        text-align: center !important;
    }

    .team.home {
        order: 1;
    }

    .score {
        order: 2;
        justify-content: center;
    }

    .team.away {
        order: 3;
    }

    .match-info {
        gap: 1rem;
    }

    .info-item {
        flex: 1 1 auto;
        min-width: calc(50% - 0.5rem);
    }

    .filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .info-item {
        min-width: 100%;
    }
}

@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border);
    }
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: clamp(2rem, 5vh, 4rem) auto;
}

.login-card {
    background: var(--surface);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Alerts */
.alert {
    padding: clamp(0.875rem, 2vw, 1rem);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* Admin Specific */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(1.5rem, 3vw, 2rem);
    gap: 1rem;
    flex-wrap: wrap;
}

.data-table {
    width: 100%;
}

.data-table th {
    background: var(--bg);
}

.data-table tr:hover {
    background: var(--bg);
}
