/* Swimming Statistics - Stylesheet */

/* CSS Variables */
:root {
    --primary-color: #0077b6;
    --primary-dark: #005a8c;
    --secondary-color: #00b4d8;
    --accent-color: #90e0ef;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --success-color: #198754;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-sm: 4px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Layout */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.header-top {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.header-top > div:first-child {
    flex: 1;
}

.header h1 {
    margin: 0;
    font-size: 2rem;
}

.header .subtitle {
    margin: 0.5rem 0 0;
    opacity: 0.9;
}

.lang-switcher {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lang-btn {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.lang-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    color: white;
    background: rgba(255, 255, 255, 0.25);
}

.lang-sep {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 0;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    flex-shrink: 0;
}

.nav h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: var(--text-color);
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-list li {
    margin-bottom: 0.5rem;
}

.nav-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

/* Content */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Report Form */
.report-form {
    margin-bottom: 2rem;
}

.form-container {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-container h2 {
    margin: 0 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

.report-params-form {
    display: grid;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group .required {
    color: var(--error-color);
}

.form-group input,
.form-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

.form-group .help-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.no-params {
    color: var(--text-muted);
    font-style: italic;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Report Output */
.report-output {
    min-height: 200px;
}

.report-result {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.report-title {
    margin: 0 0 0.5rem;
    color: var(--primary-color);
}

.report-subtitle {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

.filters-applied {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.filter-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--accent-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Section Headers */
.section-header {
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.section-subheader {
    margin: 1rem 0 0.5rem;
    color: var(--text-muted);
}

.section-text {
    margin: 0.5rem 0;
}

/* Club Period Header (for Swimmer History) */
.club-period-header {
    margin: 2rem 0 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.club-period-header h3 {
    margin: 0;
    color: white;
    font-size: 1.1rem;
}

.club-period-header.club-change {
    background: linear-gradient(135deg, var(--warning-color), #ff9800);
}

.club-change-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #856404;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.data-table th {
    background: var(--background-color);
    font-weight: 600;
    white-space: nowrap;
}

.data-table tr:hover {
    background: rgba(0, 119, 182, 0.05);
}

/* Improvement/Decrease cell styling */
.data-table td.improvement {
    background-color: rgba(25, 135, 84, 0.15);
    color: var(--success-color);
    font-weight: 500;
}

.data-table td.decrease {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--error-color);
    font-weight: 500;
}

.data-table td.no-change {
    background-color: rgba(108, 117, 125, 0.1);
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-card {
    background: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Swimmer Card */
.swimmer-card {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.swimmer-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.swimmer-header {
    margin-bottom: 1rem;
}

.swimmer-header h3 {
    margin: 0 0 0.5rem;
}

.swimmer-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Loading Indicator */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.htmx-request .loading,
.htmx-request.loading {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Placeholder */
.placeholder {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface-color);
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
}

/* No Data */
.no-data {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Footer */
.footer {
    background: var(--text-color);
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.9rem;
}

.footer p {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .swimmer-meta {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
}
