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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000000;
    color: #fff;
    min-height: 100vh;
    padding: 15px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

.header-section {
    text-align: center;
    margin-bottom: 20px;
}

.header-logo {
    height: 64px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(255, 210, 0, 0.35));
}

.header-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 6px;
}

.header-text {
    text-align: center;
}

.header-text h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin: 0;
}

.header-vincere {
    color: #ffd200;
}

.header-subtitle {
    font-size: 0.85rem;
    color: #888;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 3px;
}

.header-credit {
    font-size: 0.65rem;
    color: #444;
    letter-spacing: 0.05em;
    text-transform: none;
}

.header-dev {
    color: #ffd200;
    font-weight: 600;
}

.date-range-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.date-btn {
    padding: 8px 16px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    color: #666;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.date-btn:hover {
    border-color: #4a9eff;
    color: #fff;
}

.date-btn.active {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #fff;
}

.custom-date-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: flex-end;
    margin-top: 12px;
}

.custom-date-inputs label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #666;
    font-size: 0.8rem;
}

.custom-date-inputs input[type="date"] {
    padding: 6px 10px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    color: #fff;
    font-size: 0.85rem;
}

.custom-date-inputs input[type="date"]:focus {
    outline: none;
    border-color: #4a9eff;
}

.apply-btn {
    padding: 6px 16px;
    background: #4a9eff;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.apply-btn:hover {
    background: #3a8eef;
}

.stats-selector {
    margin-bottom: 20px;
    background: #0a0a0a;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #1a1a1a;
}

.selector-header {
    margin-bottom: 15px;
}

.selector-header h2 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: #999;
    font-weight: 500;
}

.selector-header .date-range-selector {
    margin-bottom: 10px;
}

.stat-categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-category {
    background: #000;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #1a1a1a;
}

.stat-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-category label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #666;
    font-size: 0.75rem;
    transition: color 0.2s;
    padding: 3px 0;
}

.stat-category label:hover {
    color: #fff;
}

input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #4a9eff;
}

.chart-container {
    background: #0a0a0a;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #1a1a1a;
    height: 400px;
    margin-bottom: 20px;
}

canvas {
    max-height: 100%;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #1a1a1a;
    border-top: 4px solid #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    color: #666;
    font-size: 1rem;
}

.loading-overlay.hidden {
    display: none;
}

.player-table-section {
    margin-top: 20px;
}

.player-table-section h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #999;
    font-weight: 500;
}

.table-container {
    background: #0a0a0a;
    border-radius: 6px;
    border: 1px solid #1a1a1a;
    overflow-x: auto;
}

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

thead th {
    background: #000;
    padding: 10px 12px;
    text-align: left;
    color: #4a9eff;
    font-weight: 500;
    font-size: 0.8rem;
    border-bottom: 1px solid #1a1a1a;
}

tbody td {
    padding: 8px 12px;
    color: #666;
    border-bottom: 1px solid #0a0a0a;
    font-size: 0.85rem;
}

tbody tr:hover {
    background: #000;
}

tbody tr td:first-child {
    color: #fff;
    font-weight: 500;
}

tfoot tr.team-average {
    background: #000;
}

tfoot td {
    padding: 10px 12px;
    color: #4a9eff;
    font-weight: 500;
    border-top: 1px solid #4a9eff;
    font-size: 0.85rem;
}

.info-btn {
    background: #4a9eff;
    border: none;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    margin-left: 4px;
    transition: all 0.2s;
    vertical-align: middle;
}

.info-btn:hover {
    background: #3a8eef;
    transform: scale(1.1);
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
}

.modal-content {
    background-color: #0a0a0a;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    color: #fff;
}

.modal-content h2 {
    color: #4a9eff;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.modal-content h3 {
    color: #999;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.modal-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.close-btn {
    color: #666;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-btn:hover {
    color: #fff;
}

.formula-section code {
    display: block;
    background: #000;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #1a1a1a;
    color: #4aff9e;
    font-size: 0.85rem;
    line-height: 1.8;
    overflow-x: auto;
}

.weights-section ul {
    list-style: none;
    padding: 0;
}

.weights-section li {
    padding: 8px 0;
    color: #666;
    border-bottom: 1px solid #0a0a0a;
}

.weights-section li strong {
    color: #4a9eff;
    display: inline-block;
    width: 150px;
}

.example-section {
    background: #000;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #1a1a1a;
    margin-top: 20px;
}

.example-section code {
    display: block;
    color: #ffa500;
    font-size: 0.8rem;
    line-height: 1.8;
    margin-top: 10px;
}

.example-section code strong {
    color: #4aff9e;
    font-size: 1.2rem;
}

@media (max-width: 1200px) {
    .stat-categories {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .date-range-selector {
        flex-wrap: wrap;
    }
    
    .custom-date-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header-section h1 {
        font-size: 1.2rem;
    }
    
    .stat-categories {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 250px;
        padding: 15px;
    }
    
    .stat-category label {
        font-size: 0.7rem;
    }
}

/* Category header toggle button */
.category-header {
    display: block;
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 10px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #444;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.category-header.active {
    background: #0d2a4a;
    border-color: #4a9eff;
    color: #4a9eff;
}

.category-header:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

/* Flatpickr custom range input */
#dateRangePicker {
    padding: 6px 10px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 220px;
}

#dateRangePicker:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Flatpickr calendar dark theme overrides */
.flatpickr-calendar {
    background: #0a0a0a !important;
    border: 1px solid #1a1a1a !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8) !important;
}

.flatpickr-day {
    color: #666 !important;
}

.flatpickr-day:hover,
.flatpickr-day.inRange {
    background: #1a1a1a !important;
    border-color: #1a1a1a !important;
    color: #fff !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #4a9eff !important;
    border-color: #4a9eff !important;
    color: #fff !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-weekdays,
.flatpickr-weekday {
    background: #000 !important;
    color: #666 !important;
    fill: #666 !important;
}

.flatpickr-current-month,
.flatpickr-current-month .numInputWrapper input,
.flatpickr-current-month select {
    color: #fff !important;
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
    fill: #666 !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: #fff !important;
}

/* ============================================
   FORM SUBMISSION CALENDAR
   ============================================ */

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.cal-nav-btn {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #fff;
    font-size: 1.4rem;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    transition: border-color 0.2s, color 0.2s;
}

.cal-nav-btn:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

.cal-month-label {
    font-size: 1rem;
    color: #fff;
    font-weight: 600;
    min-width: 140px;
    text-align: center;
}

.calendar-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 0.78rem;
    color: #666;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-dot.green  { background: #4aff9e; }
.legend-dot.red    { background: #ff4a4a; }
.legend-dot.grey   { background: #2a2a2a; }

#calendarTable thead th {
    font-size: 0.72rem;
    padding: 6px 8px;
    white-space: nowrap;
}

#calendarTable tbody td {
    padding: 5px 8px;
    font-size: 0.78rem;
    white-space: nowrap;
}

#calendarTable tbody td:first-child {
    color: #fff;
    font-weight: 600;
    min-width: 60px;
}

.cal-cell {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-block;
}

.cal-cell.submitted  { background: #4aff9e; }
.cal-cell.missing    { background: #ff4a4a; }
.cal-cell.no-session { background: #1a1a1a; border: 1px solid #2a2a2a; }
