/* --- GLOBAL VARIABLES --- */
:root {
    --primary-color: #0033A0;
    --secondary-color: #E31837;
    --bg-color: #f4f6f9;
    --text-color: #333333;
    --card-bg: #ffffff;
}
*, *::before, *::after {
    box-sizing: border-box;
}
/* --- BASE STYLES --- */
body {
    font-family: 'Montserrat', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding-bottom: 40px;
    overflow-x: hidden;
}
header {
    background-color: var(--primary-color);
    color: white;
    padding: 0 15px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}
.logo-left { 
    height: 60px;
    width: auto; 
    max-width: 100%;
}
h1 {
    margin: 0;
    font-size: clamp(1rem, 4vw, 1.5rem);
}
.container {
    width: 95%;
    max-width: 1800px; /* Increased from 800px to allow tables more room */
    margin: 0 auto;    /* Centers the container in the browser */
    padding: 10px;
}
/* --- CARDS & GRIDS --- */
.card {
    background-color: var(--card-bg);
    padding: 20px 10px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
    /* FIX: Force card to fill its container */
    width: 100%;       
    /* FIX: Align content left instead of center so tables/forms look professional */
    text-align: left;  
}
.subtitle {
    font-weight: 600;
    margin-bottom: 30px;
    margin-top: 0;
    font-size: 1.1rem;
}
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.nav-card {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 15px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    transition: background 0.3s ease;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
    width: 100%; 
    box-sizing: border-box;
    margin: 0;
}
.nav-card:hover {
    background-color: var(--secondary-color);
}
.modal-overlay {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: left;
}
.close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover {
    color: var(--secondary-color);
}
.modal-content h2 {
    margin-top: 0;
    color: var(--primary-color);
}
.modal-content input[type="password"] {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
}
.modal-content button {
    width: 100%;
    padding: 15px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    font-family: inherit;
}
.modal-content button:hover {
    background-color: #c0142e;
}
.flash-messages {
    margin-bottom: 20px;
}
.flash-alert {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 10px;
}
@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 5px;
    }
}
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}
th, td {
    border: 1px solid #dee2e6;
    padding: 12px 10px;
    text-align: center;
}
th {
    background-color: var(--primary-color);
    color: white;
}
tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}
/* Make text inputs match your password/select inputs */
input[type="text"], input[type="email"], input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    box-sizing: border-box;
}
.form-group {
    margin-bottom: 15px;
    text-align: left;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color);
}
/* --- SCHEDULE ADMIN PAGE STYLES --- */
.filters {
    padding: 20px;
    background-color: #f0f4f8;
    border-radius: 8px;
    border: 1px solid #e1e5eb;
    margin-bottom: 25px;
}
.filters form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
}
.filters label {
    font-weight: 600;
    color: var(--primary-color);
}
.time-slot {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    display: block;
    padding: 10px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.2s;
}
.time-slot:hover {
    background-color: #e9ecef;
    color: var(--secondary-color);
}
.actions {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 6px;
}
.actions form {
    display: inline-block;
    margin: 2px;
}
.actions select {
    min-width: 120px;
    padding: 8px;
    margin-bottom: 5px;
}
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

.button {
    display: inline-block;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    transition: background 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: 0.9rem;
}

.button:hover { background-color: var(--secondary-color); }

.button-outline { background-color: #6c757d; }
.button-outline:hover { background-color: #5a6268; }

.filter-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    border-radius: 8px;
    background-color: #f0f4f8;
    border: 1px solid #e1e5eb;
    margin-bottom: 20px;
}
/* --- PRACTICE SCHEDULE PAGE STYLES --- */
.header-row {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.button-container {
    text-align: center;
    margin-top: 20px;
}

.filter-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f0f4f8;
    margin-bottom: 25px;
}
/* --- TEAM ADMIN SPECIFIC --- */
.responsive-wrapper {
    width: 100%;
    overflow-x: auto; /* Allows scrolling on small phones */
    margin: 20px 0;
}

.col-name { width: 10%; }
.col-age { width: 65px; }
.col-coach { width: 15%; }
.col-id { min-width: 280px; }
/* Ensure filter labels/inputs look consistent with other pages */
#filterForm label {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 10px;
}
.filter-container label {
    font-weight: 600;
    color: var(--primary-color);
}
.header-row {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.button-container {
    text-align: center;
    margin-top: 20px;
}

.filter-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f0f4f8;
    margin-bottom: 25px;
}

/* Ensure filter labels/inputs look consistent with other pages */
#filterForm label {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 10px;
}
select {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    min-width: 200px;
    cursor: pointer;
    background-color: #ffffff;
}
.success-header {
    color: #28a745; /* A nice success green */
    margin-bottom: 20px;
}
.login-form {
    display: none;
    background-color: #f0f4f8;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e1e5eb;
    margin-top: 15px;
    max-width: 400px;
}
.btn-save {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 6px rgba(227, 24, 55, 0.2);
    white-space: nowrap;
}

.btn-save:hover { background-color: #c1122a; }
.btn-save:active { transform: scale(0.98); }

.btn-edit {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    margin-right: 5px;
}

.btn-delete {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

/* --- ADMIN TABLE (.table) --- */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch; 
    overflow-x: auto;
}

.table {
    width: 100%;
    margin: 0 auto;
    border-collapse: collapse;
}

.table th {
    background-color: #e9ecef;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    padding: 5px 5px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 2px -1px var(--border-color); 
}

.table td {
    padding: 5px 5px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    text-align: center;
}

.table tr:hover { background-color: #f8fafc; }

.table input[type="text"],
.table input[type="date"],
.table select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: var(--text-color);
    box-sizing: border-box;
    background-color: #ffffff;
    transition: border-color 0.2s ease;
}

.table input[type="text"]:focus,
.table input[type="date"]:focus,
.table select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 51, 160, 0.1);
}

/* --- TABLE FILTER & SORT STYLES --- */
.filterable-header { cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.filterable-header:hover { background-color: #d1d9e6 !important; }
.active-filter { color: var(--secondary-color) !important; background-color: #fce7e9 !important; }

.sortable-header { cursor: pointer; transition: background-color 0.2s; user-select: none; }
.sortable-header:hover { background-color: #d1d9e6 !important; }

.filter-menu {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 10px;
    z-index: 2000;
    min-width: 180px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Montserrat', sans-serif;
}

.filter-menu label {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
}

.filter-menu label:hover { background-color: #f1f5f9; }
.filter-menu input[type="checkbox"] { margin-right: 8px; cursor: pointer; }

.btn-clear-filter {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 6px;
    margin-bottom: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
}
.btn-clear-filter:hover { background: #e2e8f0; }

/* --- ALERTS --- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    font-weight: 600;
}

/* --- MODAL --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto; 
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover { color: #000; }

.modal-form-group { margin-bottom: 15px; }
.modal-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.modal-form-group input, .modal-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

.modal-save-btn {
    width: 100%;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}
.stats-row {
            display: flex;
            justify-content: space-between;
            gap: 15px;
            margin-bottom: 25px;
        }

        .stat-box {
            background-color: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.06);
            padding: 20px 10px;
            text-align: center;
            flex: 1;
            border-top: 4px solid var(--secondary-color);
        }

        .stat-box h3 {
            margin: 0 0 10px 0;
            font-size: 13px;
            text-transform: uppercase;
            color: #777;
        }

        .stat-box p {
            margin: 0;
            font-size: 28px;
            font-weight: 700;
            color: var(--primary-color);
        }

        .stat-sub {
            font-size: 11px;
            color: #999;
            margin-top: 5px;
            display: block;
        }
/* =========================================
   4. RESPONSIVE DESIGN (Media Queries)
   ========================================= */
@media (max-width: 1200px) {
    .table { min-width: 650px; }
    .table th, .table td { padding: 6px 5px; font-size: 12px; }
}

@media (max-width: 768px) {
    .card { padding: 10px; }
    .header-actions { flex-direction: column; align-items: stretch; text-align: center; }
    .btn-save { width: 100%; padding: 15px; font-size: 16px; }
    .table th, .table td { padding: 6px 4px; }
    .table input[type="text"], .table input[type="date"], .table select { font-size: 16px; }
    .team-list { grid-template-columns: repeat(2, 1fr); }
    .stats-row { flex-wrap: wrap; }
    .stat-box { min-width: 45%; }
}
@media (max-width: 480px) {
    .team-list { grid-template-columns: 1fr; }
    .stat-box { min-width: 100%; }
}
/* Specific widths for the Schedule Tables */
.schedule-table th:nth-child(1), .schedule-table td:nth-child(1) { width: 150px; }
.schedule-table th:nth-child(2), .schedule-table td:nth-child(2) { width: 100px; }
.schedule-table th:nth-child(3), .schedule-table td:nth-child(3) { width: 250px; }
.schedule-table th:nth-child(4), .schedule-table td:nth-child(4) { width: 250px; }
/* Freeze table headers */
.table-wrapper {
    max-height: 75vh; /* Adjust height as needed */
    overflow-y: auto;
}

.table thead th {
    position: sticky;
    top: 0;
    background-color: #ffffff; /* Must have a background color so rows don't show through */
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

/* Export button styling */
.btn-export {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-export:hover {
    background-color: #218838;
}

/* Flexbox for header actions to align title and button */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}