/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

header h1 a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

header h1 a:hover {
    color: #764ba2;
}

header nav a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

header nav a:hover {
    color: #667eea;
}

/* Main Content */
main {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Leaderboard Header */
.leaderboard-header {
    margin-bottom: 2rem;
}

.class-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.class-selector-wrapper label {
    font-weight: 600;
    color: #333;
}

.class-selector {
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    min-width: 250px;
}

.class-selector:hover {
    border-color: #667eea;
}

.class-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Home Page */
.home-header {
    text-align: center;
    margin-bottom: 2rem;
}

.home-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.home-header p {
    color: #666;
    font-size: 1.1rem;
}

.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.class-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
}

.class-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.class-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.class-card .view-leaderboard {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.no-classes {
    text-align: center;
    padding: 3rem;
    color: #666;
}

/* Leaderboard Header */
.leaderboard-header {
    margin-bottom: 2rem;
}

.leaderboard-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 1.5rem;
}

.class-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.class-selector-wrapper label {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.class-selector {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

.class-selector:hover {
    border-color: #667eea;
}

.class-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Podium Cards for Top 3 */
.podium-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.podium-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.podium-card.first-place {
    background: #e3f2fd;
}

.podium-card.second-place,
.podium-card.third-place {
    background: white;
}

.podium-rank {
    font-size: 2.5rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.podium-driver {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.podium-driver a {
    color: #000;
    text-decoration: none;
}

.podium-driver a:hover {
    text-decoration: underline;
}

.podium-points {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    line-height: 1;
}

.points-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2196f3;
}

.points-label {
    font-size: 0.9rem;
    color: #000;
    font-weight: 400;
}

.podium-icon {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.5rem;
}

/* Leaderboard Table */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.leaderboard-table thead {
    background: transparent;
    color: #333;
}

.leaderboard-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.leaderboard-table tbody tr:hover {
    background: #f8f9fa;
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.leaderboard-table td {
    padding: 1rem;
}

.rank {
    text-align: left;
    font-weight: 600;
    width: 80px;
    color: #000;
}

.rank-number {
    font-size: 1.1rem;
    color: #666;
}

.medal {
    font-size: 1.5rem;
}

.driver-name {
    font-weight: 600;
    color: #333;
    font-size: 1.05rem;
}

.driver-name a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s;
}

.driver-name a:hover {
    color: #667eea;
    text-decoration: underline;
}

.points {
    font-weight: 600;
    color: #2196f3;
    font-size: 1rem;
}

.races, .wins {
    text-align: center;
    color: #666;
}

.wins {
    color: #28a745;
    font-weight: 600;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-results p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Footer */
footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem 0;
    text-align: center;
    color: #666;
    margin-top: 2rem;
}

/* Driver Results Page */
.driver-results-header {
    margin-bottom: 2rem;
}

.driver-results-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.driver-results-header h3 {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.driver-summary {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.summary-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.back-link {
    margin-bottom: 1.5rem;
}

.main-results-list {
    margin-top: 2rem;
}

.main-results-list h4 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.results-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.results-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.results-table tbody tr:hover {
    background: #f8f9fa;
}

.results-table tbody tr:last-child {
    border-bottom: none;
}

.results-table td {
    padding: 1rem;
    font-size: 0.95rem;
}

.event-name {
    font-weight: 600;
}

.special-event-badge {
    display: inline-block;
    background: #ffc107;
    color: #333;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.event-date {
    color: #666;
}

.position {
    text-align: center;
    font-weight: 600;
    width: 80px;
}

.result-type-inline {
    font-size: 0.85rem;
    color: #666;
    font-weight: normal;
    margin-left: 0.25rem;
}

.result-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.result-finished {
    background: #28a745;
    color: white;
}

.result-dnf {
    background: #ffc107;
    color: #333;
}

.result-dns {
    background: #dc3545;
    color: white;
}

.tq-badge {
    background: #17a2b8;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.laps {
    text-align: center;
}

.points {
    text-align: left;
    font-weight: 600;
    color: #2196f3;
    font-size: 1rem;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .classes-grid {
        grid-template-columns: 1fr;
    }
    
    .podium-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .podium-card {
        padding: 1rem 1.25rem;
    }
    
    .podium-rank {
        font-size: 2rem;
    }
    
    .podium-driver {
        font-size: 0.95rem;
    }
    
    .points-value {
        font-size: 1.5rem;
    }
    
    .points-label {
        font-size: 0.85rem;
    }
    
    .podium-icon {
        font-size: 1.25rem;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .leaderboard-table {
        font-size: 0.85rem;
        width: 100%;
        max-width: 100%;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .points {
        font-size: 1rem;
    }
    
    /* Make table narrower */
    .leaderboard-table {
        table-layout: auto;
    }
    
    .rank {
        width: 50px;
        padding: 0.75rem 0.25rem;
    }
    
    .driver-name {
        font-size: 0.9rem;
        min-width: 120px;
    }
    
    .points {
        min-width: 100px;
        font-size: 0.95rem;
    }
}

/* Driver results page - Top 5 highlighting */
.top-5-result {
    background-color: #e8f5e9 !important;
    border-left: 4px solid #4caf50;
}

.top-5-result:hover {
    background-color: #c8e6c9 !important;
}

.last-8-result {
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
}

.last-8-result:hover {
    background-color: #ffe0b2;
}

/* Counting badges */
.counting-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    background-color: #4caf50;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.not-counting-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    background-color: #ff9800;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Mobile class selector */
.class-selector-wrapper {
    flex-direction: column;
    align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .class-selector-wrapper label {
        font-size: 0.9rem;
    }
    
    .class-selector {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .results-table {
        font-size: 0.85rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.5rem;
    }
}

