/* ============================================
   JDG League Management - Design System
   Mobile-First Responsive Stylesheet
   ============================================ */

/* ============================================
   CSS Variables - Design System
   ============================================ */
:root {
    /* Color Palette */
    --primary-color: #6AC129;
    --primary-dark: #5AB019;
    --primary-light: #8fd05e;
    --secondary-color: #1100A4;
    --secondary-dark: #0D0080;
    --accent-green: #D3DDCC;
    --accent-blue: #1C6EA4;

    /* Semantic Colors */
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;

    /* Neutrals */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #999999;
    --border-color: #dee2e6;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;

    /* Spacing Scale */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-xxl: 3rem;     /* 48px */

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 1rem;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
    --line-height-base: 1.6;
    --line-height-tight: 1.4;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;

    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1050;
    --z-tooltip: 1070;
}

/* ============================================
   Base Styles
   ============================================ */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--text-primary);
    background-color: var(--bg-light);
}

/* Remove fixed width wrappers - use responsive containers instead */
.wrapper {
    max-width: 100%;
    padding: var(--spacing-lg);
    margin: 0 auto;
}

@media (min-width: 768px) {
    .wrapper {
        padding: var(--spacing-xl);
    }
}

/* ============================================
   Typography Improvements
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    line-height: var(--line-height-tight);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: var(--spacing-md);
}

/* ============================================
   Enhanced Cards
   ============================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
    overflow: hidden;
}

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

.card-header {
    background: linear-gradient(to bottom, var(--primary-light) 0%, var(--primary-color) 66%, var(--primary-dark) 100%);
    color: white;
    font-weight: 600;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 2px solid var(--primary-dark);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    background-color: var(--bg-light);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* Scorecard Cards - Special Styling */
.scorecard-card {
    margin-bottom: var(--spacing-lg);
}

.scorecard-card .card-body {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-white);
}

.scorecard-card img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.scorecard-card .card-footer {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
}

@media (max-width: 767px) {
    .scorecard-card .card-body {
        min-height: 150px;
        padding: var(--spacing-md);
    }
}

/* ============================================
   Form Improvements
   ============================================ */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    display: inline-block;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(106, 193, 41, 0.25);
}

/* Enhanced File Input */
.file-upload-wrapper {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.file-upload-input {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-white);
    cursor: pointer;
    transition: all var(--transition-base);
}

.file-upload-input:hover,
.file-upload-input:focus {
    border-color: var(--primary-color);
    background-color: rgba(106, 193, 41, 0.05);
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    cursor: pointer;
}

.file-upload-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.file-upload-text {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    text-align: center;
}

.file-upload-text-mobile {
    font-size: var(--font-size-sm);
}

/* Custom file input styling */
input[type="file"] {
    font-size: var(--font-size-base);
    padding: var(--spacing-md);
}

input[type="file"]::file-selector-button {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    margin-right: var(--spacing-md);
    transition: background-color var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
    background-color: var(--primary-dark);
}

/* Mobile file input optimization */
@media (max-width: 767px) {
    input[type="file"] {
        font-size: var(--font-size-sm);
        padding: var(--spacing-sm) var(--spacing-md);
    }

    input[type="file"]::file-selector-button {
        padding: var(--spacing-sm);
        font-size: var(--font-size-sm);
        margin-right: var(--spacing-sm);
    }
}

/* ============================================
   Button Improvements
   ============================================ */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-lg);
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    border: 2px solid var(--secondary-color);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
    color: white;
}

/* Mobile-friendly button sizing */
.btn-mobile-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
    min-height: 44px;
    width: 100%;
}

@media (min-width: 768px) {
    .btn-mobile-lg {
        width: auto;
    }
}

/* Legacy button class support */
.btnSubmit {
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    padding: var(--spacing-sm) var(--spacing-xl);
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-base);
    min-height: 44px;
}

.btnSubmit:hover,
.btnSubmit:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 767px) {
    .btnSubmit {
        width: 100%;
        padding: var(--spacing-md);
        font-size: var(--font-size-lg);
    }
}

/* ============================================
   Image Handling
   ============================================ */
img {
    max-width: 100%;
    height: auto;
}

.img-fluid {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Image placeholder for missing scorecards */
.img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background-color: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-style: italic;
}

@media (max-width: 767px) {
    .img-placeholder {
        min-height: 150px;
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   Alerts & Notifications
   ============================================ */
.alert {
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* ============================================
   Tables
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--spacing-lg);
}

/* Division Table Enhancements */
.table-responsive .table.table-striped.division-table {
    margin-bottom: 0;
    font-size: var(--font-size-base);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    table-layout: auto;
    width: 100%;
}

/* Division caption header */
.division-table .division-caption {
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
    padding: var(--spacing-md);
    background-color: var(--primary-color) !important;
    color: white;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Set minimum widths for better column balance with auto layout */
.division-table tbody td:first-child,
.division-table thead th:first-child {
    min-width: 200px;
    width: auto;
}

/* Column-specific styling */
.division-table .team-col {
    text-align: left;
    font-weight: 600;
}

.division-table .num-col {
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    padding: var(--spacing-sm) var(--spacing-xs);
}

/* Specific column widths for better balance - ultra high specificity */
.table-responsive .table.table-striped.division-table thead th:nth-child(1),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(1) {
    width: 35% !important;
    min-width: 35% !important;
    max-width: 35% !important;
}

.table-responsive .table.table-striped.division-table thead th:nth-child(2),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(2) {
    width: 6% !important;
}

.table-responsive .table.table-striped.division-table thead th:nth-child(3),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(3) {
    width: 5% !important;
}

.table-responsive .table.table-striped.division-table thead th:nth-child(4),
.table-responsive .table.table-striped.division-table thead th:nth-child(5),
.table-responsive .table.table-striped.division-table thead th:nth-child(6),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(4),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(5),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(6) {
    width: 3.5% !important;
}

.table-responsive .table.table-striped.division-table thead th:nth-child(7),
.table-responsive .table.table-striped.division-table thead th:nth-child(8),
.table-responsive .table.table-striped.division-table thead th:nth-child(9),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(7),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(8),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(9) {
    width: 4.5% !important;
}

.table-responsive .table.table-striped.division-table thead th:nth-child(10),
.table-responsive .table.table-striped.division-table thead th:nth-child(11),
.table-responsive .table.table-striped.division-table thead th:nth-child(12),
.table-responsive .table.table-striped.division-table thead th:nth-child(13),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(10),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(11),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(12),
.table-responsive .table.table-striped.division-table tbody tr td:nth-child(13) {
    width: 5% !important;
}

/* Vertical color grouping for better readability */
/* Override Bootstrap's box-shadow striping with custom colors */
/* Bootstrap uses: box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg) */

/* Team column - solid light green */
.table.table-striped.division-table tbody tr td:nth-child(1),
.table.table-striped.division-table tbody tr td.table-success:nth-child(1) {
    box-shadow: inset 0 0 0 9999px #d4edda !important;
}

/* Points and Played - light gray/neutral */
.table.table-striped.division-table tbody tr td:nth-child(2),
.table.table-striped.division-table tbody tr td:nth-child(3),
.table.table-striped.division-table tbody tr td.table-info:nth-child(2),
.table.table-striped.division-table tbody tr td.table-info:nth-child(3) {
    box-shadow: inset 0 0 0 9999px #e2e3e5 !important;
}

/* W/L/D group - solid light blue */
.table.table-striped.division-table tbody tr td:nth-child(4),
.table.table-striped.division-table tbody tr td:nth-child(5),
.table.table-striped.division-table tbody tr td:nth-child(6),
.table.table-striped.division-table tbody tr td.table-info:nth-child(4),
.table.table-striped.division-table tbody tr td.table-info:nth-child(5),
.table.table-striped.division-table tbody tr td.table-info:nth-child(6) {
    box-shadow: inset 0 0 0 9999px #cfe2ff !important;
}

/* Goals group (GF/GA/Diff) - solid light lavender */
.table.table-striped.division-table tbody tr td:nth-child(7),
.table.table-striped.division-table tbody tr td:nth-child(8),
.table.table-striped.division-table tbody tr td:nth-child(9),
.table.table-striped.division-table tbody tr td.table-info:nth-child(7),
.table.table-striped.division-table tbody tr td.table-info:nth-child(8),
.table.table-striped.division-table tbody tr td.table-info:nth-child(9) {
    box-shadow: inset 0 0 0 9999px #e0cffc !important;
}

/* Advanced stats - solid light yellow */
.table.table-striped.division-table tbody tr td:nth-child(10),
.table.table-striped.division-table tbody tr td:nth-child(11),
.table.table-striped.division-table tbody tr td:nth-child(12),
.table.table-striped.division-table tbody tr td:nth-child(13),
.table.table-striped.division-table tbody tr td.table-warning:nth-child(10),
.table.table-striped.division-table tbody tr td.table-warning:nth-child(11),
.table.table-striped.division-table tbody tr td.table-info:nth-child(12),
.table.table-striped.division-table tbody tr td.table-info:nth-child(13) {
    box-shadow: inset 0 0 0 9999px #fff3cd !important;
}

/* Header row styling */
.division-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
}

.division-table thead th {
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: var(--spacing-sm);
    vertical-align: middle;
    border-bottom: 2px solid var(--border-color);
}

/* Data cell styling */
.division-table tbody td {
    padding: var(--spacing-sm);
    vertical-align: middle;
    font-size: var(--font-size-base);
}

/* Team name cell */
.division-table tbody td:first-child {
    font-weight: 600;
    text-align: left;
}

/* Numeric data cells - center align */
.division-table tbody td:not(:first-child) {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Row hover effect for better readability */
.table.table-striped.division-table tbody tr:hover {
    box-shadow: inset 4px 0 0 var(--primary-color);
    cursor: pointer;
    outline: 2px solid rgba(106, 193, 41, 0.3);
    outline-offset: -2px;
    position: relative;
    z-index: 1;
}

/* Make cells relative for pseudo-element positioning */
.division-table tbody td {
    position: relative;
}

/* Create overlay effect with pseudo-element to avoid Bootstrap conflicts */
.table.table-striped.division-table tbody tr:hover td::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(106, 193, 41, 0.15);
    pointer-events: none;
    z-index: 1;
}

.table.table-striped.division-table tbody tr:hover td:first-child::after {
    background-color: rgba(106, 193, 41, 0.25);
}

/* Alternate row colors for better scanning */
.division-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Visual grouping - add subtle borders between stat groups */
.division-table td:nth-child(4),  /* Before W/L/D group */
.division-table th:nth-child(4),
.division-table td:nth-child(7),  /* Before GF/GA group */
.division-table th:nth-child(7),
.division-table td:nth-child(10), /* Before Conc group */
.division-table th:nth-child(10) {
    border-left: 1px solid var(--border-color);
}

/* Highlight important columns */
.division-table tbody td:nth-child(2) {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--primary-color);
}

/* Section dividers within table */
.division-table tbody tr.table-info th {
    font-weight: 700;
    text-align: center;
    background-color: var(--primary-color) !important;
    color: white;
    padding: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.division-table tbody tr.table-light th {
    height: var(--spacing-md);
    padding: 0;
    border: none;
}

@media (max-width: 991px) {
    .division-table {
        font-size: var(--font-size-sm);
    }

    .division-table thead th,
    .division-table tbody td {
        padding: var(--spacing-xs);
    }

    .division-table .team-col {
        min-width: 140px;
    }

    .division-table .num-col {
        min-width: 42px;
    }

    .division-table .division-caption {
        font-size: 1rem;
        padding: var(--spacing-sm);
    }
}

@media (max-width: 767px) {
    table {
        font-size: var(--font-size-sm);
    }

    .division-table {
        font-size: 0.8rem;
    }

    .division-table thead th {
        font-size: 0.7rem;
        padding: 0.3rem 0.2rem;
    }

    .division-table tbody td {
        padding: 0.4rem 0.2rem;
    }

    .division-table .team-col {
        min-width: 100px;
    }

    .division-table .num-col {
        min-width: 35px;
    }

    .division-table .division-caption {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    .table-responsive {
        margin-bottom: var(--spacing-lg);
    }
}

/* ============================================
   Fixture Table Styles
   ============================================ */
.table-responsive .table.table-striped.fixture-table {
    margin-bottom: 0;
    font-size: var(--font-size-base);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    table-layout: auto;
    width: 100%;
}

/* Date header styling */
.fixture-table .date-header th.fixture-date {
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
    padding: var(--spacing-md);
    background-color: var(--primary-color) !important;
    color: white;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border: none;
}

/* First date header needs top rounded corners */
.fixture-table tbody:first-of-type .date-header th.fixture-date {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Subsequent date headers have spacing and top rounded corners */
.fixture-table tbody:not(:first-of-type) {
    border-top: var(--spacing-lg) solid transparent;
}

.fixture-table tbody:not(:first-of-type) .date-header th.fixture-date {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Main header row styling */
.fixture-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
}

.fixture-table thead th {
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: var(--spacing-sm);
    vertical-align: middle;
    border-bottom: 2px solid var(--border-color);
}

/* Data cell styling */
.fixture-table tbody td {
    padding: var(--spacing-sm);
    vertical-align: middle;
    font-size: var(--font-size-base);
    position: relative;
}

/* Team name cells */
.fixture-table tbody td:nth-child(3),
.fixture-table tbody td:nth-child(5) {
    font-weight: 500;
}

/* Numeric/centered cells */
.fixture-table tbody td:nth-child(1),
.fixture-table tbody td:nth-child(2) {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Row hover effect */
.table.table-striped.fixture-table tbody tr:not(.date-header):hover {
    box-shadow: inset 4px 0 0 var(--primary-color);
    cursor: pointer;
    outline: 2px solid rgba(106, 193, 41, 0.3);
    outline-offset: -2px;
    position: relative;
    z-index: 1;
}

/* Hover overlay effect */
.table.table-striped.fixture-table tbody tr:not(.date-header):hover td::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(106, 193, 41, 0.15);
    pointer-events: none;
    z-index: 1;
}

/* Button styling for teams and umpires */
.fixture-table .btn {
    width: 100%;
    min-width: 100px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px 0;
    border-width: 2px;
    font-weight: 500;
    position: relative;
    z-index: 2;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
}

.fixture-table .btn-outline-success {
    border-color: var(--success-color);
    color: var(--success-color);
    background-color: #f0f8f0;
}

.fixture-table .btn-outline-success:hover {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.fixture-table .btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #f5f9f5;
}

.fixture-table .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Center "vs" text between team buttons on mobile */
.fixture-table .vs-text {
    text-align: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
    margin: 4px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Link icons for teams and umpires */
.fixture-table .fixture-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.1em;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.fixture-table .fixture-link:hover {
    opacity: 1;
    color: var(--primary-dark);
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .fixture-table {
        font-size: var(--font-size-sm);
    }

    .fixture-table thead th,
    .fixture-table tbody td {
        padding: var(--spacing-xs);
    }

    .fixture-table .date-header th.fixture-date {
        font-size: 1rem;
        padding: var(--spacing-sm);
    }
}

@media (max-width: 767px) {
    .fixture-table {
        font-size: 0.8rem;
    }

    .fixture-table thead th {
        font-size: 0.7rem;
        padding: 0.3rem 0.2rem;
    }

    .fixture-table tbody td {
        padding: 0.4rem 0.2rem;
    }

    .fixture-table .date-header th.fixture-date {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumb {
    background-color: transparent;
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-lg);
}

@media (max-width: 767px) {
    .breadcrumb {
        font-size: var(--font-size-sm);
        flex-wrap: wrap;
    }

    .breadcrumb-item {
        max-width: 100%;
    }
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 600;
    color: var(--primary-color);
}

.nav-link {
    transition: color var(--transition-fast);
}

.badge {
    padding: 0.25em 0.6em;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

/* ============================================
   Utilities
   ============================================ */

/* Spacing Utilities */
.mt-mobile {
    margin-top: var(--spacing-md);
}

@media (min-width: 768px) {
    .mt-mobile {
        margin-top: 0;
    }
}

.mb-mobile {
    margin-bottom: var(--spacing-md);
}

/* Touch-friendly spacing */
.touch-spacing {
    padding: var(--spacing-md) 0;
}

/* Container improvements */
.container-sm,
.container-md,
.container-lg,
.container-fluid {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

@media (min-width: 768px) {
    .container-sm,
    .container-md,
    .container-lg,
    .container-fluid {
        padding-left: var(--spacing-lg);
        padding-right: var(--spacing-lg);
    }
}

/* ============================================
   Scorecard Upload Specific Styles
   ============================================ */
.scorecard-upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.scorecard-upload-form {
    background-color: var(--bg-white);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
}

@media (max-width: 767px) {
    .scorecard-upload-form {
        padding: var(--spacing-lg);
        border-radius: var(--radius-md);
    }
}

.scorecard-form-section {
    margin-bottom: var(--spacing-xl);
}

.scorecard-form-section:last-child {
    margin-bottom: 0;
}

.scorecard-instructions {
    background-color: rgba(106, 193, 41, 0.1);
    border-left: 4px solid var(--primary-color);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
}

.scorecard-instructions p {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

.scorecard-instructions p:last-child {
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .scorecard-instructions {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--font-size-sm);
    }
}

/* Scorecard display grid */
.scorecard-grid {
    display: grid;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

@media (min-width: 768px) {
    .scorecard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-rotate 0.75s linear infinite;
}

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

/* ============================================
   Accessibility Improvements
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Image Lightbox / Modal
   ============================================ */
.lightbox {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: auto;
    animation: fadeIn 0.3s ease-in-out;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease-in-out;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color var(--transition-fast);
    z-index: calc(var(--z-modal) + 1);
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.7);
}

.lightbox-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    max-width: 90%;
    text-align: center;
}

/* Clickable scorecard images */
.scorecard-card img {
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.scorecard-card img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* Mobile adjustments for lightbox */
@media (max-width: 767px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .lightbox-caption {
        bottom: 10px;
        font-size: var(--font-size-sm);
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Enhanced Table Responsiveness
   ============================================ */

/* Mobile card view for tables */
@media (max-width: 767px) {
    .table-mobile-cards {
        border: 0;
    }

    .table-mobile-cards thead {
        display: none;
    }

    /* Hide columns that should be hidden on mobile, regardless of Bootstrap responsive classes */
    .table-mobile-cards tbody td.d-none,
    .table-mobile-cards tbody td.d-sm-table-cell,
    .table-mobile-cards tbody td.d-md-table-cell {
        display: none !important;
    }

    .table-mobile-cards tbody,
    .table-mobile-cards tbody tr {
        display: block;
    }

    .table-mobile-cards tbody td {
        display: block;
    }

    .table-mobile-cards tbody tr {
        margin-bottom: var(--spacing-lg);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        background: var(--bg-white);
        overflow: hidden;
        page-break-inside: avoid;
    }

    .table-mobile-cards tbody td {
        padding: var(--spacing-md);
        border: none;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
        position: relative;
        padding-left: 50%;
    }

    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: var(--spacing-md);
        font-weight: 600;
        color: var(--text-secondary);
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .table-mobile-cards tbody td:first-child {
        background: var(--bg-light);
        font-weight: 600;
        font-size: var(--font-size-lg);
        text-align: center;
        padding-left: var(--spacing-md);
    }

    .table-mobile-cards tbody td:first-child::before {
        content: none;
    }
}

/* Sticky table headers for desktop */
@media (min-width: 768px) {
    .table-sticky-header {
        position: relative;
    }

    .table-sticky-header thead th {
        position: sticky;
        top: 0;
        z-index: var(--z-sticky);
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

/* ============================================
   Loading States & Animations
   ============================================ */

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

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

/* Spinner styles */
.spinner-large {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.spinner-text {
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
}

/* Button loading state */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner-rotate 0.6s linear infinite;
}

/* Smooth height transitions for collapsible content */
.collapsible {
    transition: max-height var(--transition-slow) ease-in-out, opacity var(--transition-slow) ease-in-out;
    overflow: hidden;
}

/* Fade in animation for new content */
.fade-in {
    animation: fadeIn var(--transition-base);
}

/* Slide in from bottom */
.slide-in-bottom {
    animation: slideInBottom 0.4s ease-out;
}

@keyframes slideInBottom {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Pulse animation for notifications */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ============================================
   Enhanced Form Interactions
   ============================================ */

/* Form validation states */
.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.invalid-feedback,
.valid-feedback {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.invalid-feedback {
    color: var(--danger-color);
}

.valid-feedback {
    color: var(--success-color);
}

/* Floating label enhancement */
.form-floating {
    position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-tooltip);
    max-width: 350px;
}

.toast {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--info-color);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.toast-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

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

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

@media (max-width: 767px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ============================================
   Smooth Scrolling & Performance
   ============================================ */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar,
    .breadcrumb,
    .btn,
    form,
    .lightbox,
    .toast-container,
    .loading-overlay {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #000;
    }

    body {
        background: white;
    }
}
