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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header and Navigation */
header {
    background: linear-gradient(135deg, #e10600 0%, #c10500 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

nav h1 {
    font-size: 1.5rem;
    font-weight: bold;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

nav a:hover,
nav a.active {
    opacity: 0.8;
    text-decoration: underline;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: white;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #e10600;
}

.hero p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #e10600;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 1rem;
}

.btn:hover {
    background: #c10500;
}

.btn-primary {
    background: #e10600;
}

.btn-primary:hover {
    background: #c10500;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

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

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

.stat-card h3,
.stat-card h4 {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #e10600;
}

.stat-value.large {
    font-size: 3rem;
}

/* Races Grid */
.races-section {
    margin-bottom: 3rem;
}

.races-section h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
}

.races-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.race-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.race-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.race-card h4 {
    color: #e10600;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.race-card p {
    color: #666;
    margin-bottom: 0.5rem;
}

.race-date {
    font-weight: 600;
    color: #333;
}

/* Auth Container */
.auth-container {
    max-width: 500px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-container h2 {
    margin-bottom: 1.5rem;
    color: #e10600;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #e10600;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

.auth-link a {
    color: #e10600;
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.alert-warning {
    background: #ffd;
    color: #993;
    border: 1px solid #ffc;
}

/* Tables */
.scores-table,
.leaderboard-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.scores-table thead,
.leaderboard-table thead {
    background: #e10600;
    color: white;
}

.scores-table th,
.leaderboard-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.scores-table td,
.leaderboard-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.scores-table tbody tr:hover,
.leaderboard-table tbody tr:hover {
    background: #f9f9f9;
}

.leaderboard-table .current-user {
    background: #fff3cd;
    font-weight: 600;
}

.medal {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.badge {
    display: inline-block;
    background: #e10600;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Predictions */
.prediction-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prediction-section h3 {
    color: #e10600;
    margin-bottom: 1rem;
}

.help-text {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.predictions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.prediction-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prediction-item label {
    font-weight: 500;
    color: #333;
}

.prediction-item input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.prediction-item input:focus {
    outline: none;
    border-color: #e10600;
}

.race-info {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

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

.no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    nav .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav ul {
        justify-content: center;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .races-grid {
        grid-template-columns: 1fr;
    }
    
    .predictions-grid {
        grid-template-columns: 1fr;
    }
    
    .scores-table,
    .leaderboard-table {
        font-size: 0.9rem;
    }
    
    .scores-table th,
    .scores-table td,
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem;
    }
}

