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

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
}

/* Navbar */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    min-height: calc(100vh - 200px);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

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

.btn-primary:hover {
    background-color: #0056b3;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

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

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

/* Forms */
.register-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

.register-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

.register-card h1 {
    margin-bottom: 30px;
    color: var(--text-color);
}

.register-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Responsive utilities */
.desktop-only {
    display: table-cell;
}

.mobile-only {
    display: none;
}

/* Leaderboard */
.leaderboard-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-section {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.category-header {
    padding: 15px 20px;
    border-bottom: 2px solid var(--border-color);
}

.category-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.leaderboard-table thead {
    background-color: var(--light-bg);
}

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

.leaderboard-table th {
    font-weight: 600;
    background-color: #2c3e50;
    color: white;
}

.leaderboard-table tbody tr {
    border-left: 5px solid #ccc;
    transition: background-color 0.2s;
}

.leaderboard-table tbody tr:hover {
    background-color: var(--light-bg);
}

.leaderboard-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

.rider-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rider-name {
    font-weight: 500;
}

.rider-color {
    font-size: 11px;
    color: #666;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.badge-red {
    background-color: #dc3545;
}

.badge-blue {
    background-color: #007bff;
}

.badge-green {
    background-color: #28a745;
}

.badge-yellow {
    background-color: #ffc107;
    color: #333;
}

.time-value {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: bold;
    color: var(--primary-color);
}

.percentage-value {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: bold;
    color: #28a745;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--secondary-color);
    font-style: italic;
}

.rank {
    font-weight: bold;
    font-size: 18px;
    color: var(--primary-color);
    width: 30px;
}

.rank-1 {
    color: #FFD700;
    font-size: 20px;
}

.rank-2 {
    color: #C0C0C0;
    font-size: 20px;
}

.rank-3 {
    color: #CD7F32;
    font-size: 20px;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        gap: 10px;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: inline;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .leaderboard-table th {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .rank {
        font-size: 16px;
        width: 25px;
    }
    
    .rank-1, .rank-2, .rank-3 {
        font-size: 18px;
    }
    
    .badge {
        padding: 2px 8px;
        font-size: 10px;
    }
    
    .register-card {
        padding: 20px;
    }
    
    .container {
        margin: 15px auto;
    }
}

/* Loading indicator */
.indicator-dot {
    display: inline-block;
    color: #4CAF50;
    font-size: 14px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49%, 100% {
        opacity: 1;
    }
    50%, 99% {
        opacity: 0.5;
    }
}

.footer-links {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}
