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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 25px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.add-racer-form, .race-setup, .standings-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.add-racer-form h3, .race-setup h3 {
    margin-bottom: 15px;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select,
#race-category,
#standings-category {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.form-group input:focus,
.form-group select:focus,
#race-category:focus,
#standings-category:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

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

/* Racers List */
.racers-list h3 {
    margin-bottom: 15px;
    color: #333;
}

#racers-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.racer-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s;
}

.racer-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.racer-card h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.racer-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.racer-info span {
    color: #666;
    font-size: 0.9em;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-right: 5px;
}

.category-Beginner {
    background: #d4edda;
    color: #155724;
}

.category-Intermediate {
    background: #fff3cd;
    color: #856404;
}

.category-Advanced {
    background: #cce5ff;
    color: #004085;
}

.category-Expert {
    background: #f8d7da;
    color: #721c24;
}

.racer-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* Cars inside racer card */
.car-section {
    margin-top: 12px;
}

.car-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.car-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.car-name {
    font-weight: 600;
    color: #333;
}

.add-car-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.add-car-row input {
    flex: 2;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.add-car-row select {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
}

.car-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.car-type {
    font-size: 0.8em;
    color: #666;
    font-weight: normal;
}

.car-stats {
    font-size: 0.75em;
    color: #888;
    font-style: italic;
}

.car-bracket {
    font-size: 0.8em;
    color: #667eea;
    font-weight: 600;
    background: #e8f0ff;
    padding: 2px 6px;
    border-radius: 8px;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.85em;
}

/* Race Sets */
#race-sets-container {
    display: grid;
    gap: 20px;
}

.race-set {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
} 

.race-set h3 {
    color: #333;
    margin-bottom: 15px;
}

.race-participants {
    display: grid;
    gap: 10px;
}

.participant-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.participant-position {
    font-weight: bold;
    font-size: 1.2em;
    color: #667eea;
    min-width: 60px;
}

.participant-name {
    flex: 1;
    font-weight: 600;
}

.car-select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
    min-width: 120px;
    background: white;
}

.participant-score {
    color: #666;
    font-size: 0.9em;
    min-width: 80px;
}

.car-name-display {
    font-weight: 600;
    color: #667eea;
    font-style: italic;
    min-width: 100px;
}

.position-select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    min-width: 100px;
}

.car-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}

/* Bracket sections */
.bracket-section {
    margin-bottom: 30px;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 20px;
    background: #f8f9ff;
}

.bracket-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Clear data section */
.clear-data-section {
    margin-top: 30px;
    padding: 20px;
    background: #fff5f5;
    border: 2px solid #fc8181;
    border-radius: 10px;
    text-align: center;
}

.warning-text {
    margin-top: 10px;
    color: #e53e3e;
    font-size: 0.9em;
    font-weight: 600;
}

/* Bracket standings */
.bracket-standings {
    display: grid;
    gap: 30px;
}

.bracket-standing-section {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    background: #fafafa;
}

.bracket-standing-section.bracket-1 {
    border-color: #ffd700;
    background: #fffbf0;
}

.bracket-standing-section.bracket-1 h3 {
    color: #b8860b;
    border-bottom: 2px solid #ffd700;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.bracket-standing-section.bracket-2 {
    border-color: #c0c0c0;
    background: #f8f8f8;
}

.bracket-standing-section.bracket-2 h3 {
    color: #6c757d;
    border-bottom: 2px solid #c0c0c0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.bracket-standing-section.bracket-3 {
    border-color: #cd7f32;
    background: #fdf6f0;
}

.bracket-standing-section.bracket-3 h3 {
    color: #8b4513;
    border-bottom: 2px solid #cd7f32;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.record-results-btn {
    margin-top: 15px;
}

.info-text {
    margin-top: 10px;
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

/* Standings Table */
#standings-container {
    overflow-x: auto;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.standings-table thead {
    background: #667eea;
    color: white;
}

.standings-table th,
.standings-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

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

.standings-rank {
    font-weight: bold;
    font-size: 1.2em;
    color: #667eea;
}

.standings-rank-1 {
    color: #ffd700;
}

.standings-rank-2 {
    color: #c0c0c0;
}

.standings-rank-3 {
    color: #cd7f32;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

/* Single Race Interface */
.race-progress {
    margin-bottom: 25px;
    text-align: center;
}

.race-progress h2 {
    color: #333;
    margin-bottom: 15px;
}

.sub-race-indicator {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.sub-race-indicator h3 {
    color: #1565c0;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.sub-race-indicator p {
    color: #1976d2;
    margin: 0;
    font-size: 0.9em;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 30px;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    max-width: 400px;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-weight: bold;
    z-index: 1;
}

.current-race-section {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.current-race-section h3 {
    color: #856404;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.current-race {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.next-race-section {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    border: 1px solid #17a2b8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.next-race-section h4 {
    color: #0c5460;
    margin-bottom: 15px;
}

.next-race-preview {
    display: grid;
    gap: 8px;
}

.next-participant {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.7);
    border-radius: 5px;
}

.next-lane {
    font-weight: bold;
    color: #0c5460;
    min-width: 60px;
}

.next-name {
    font-weight: bold;
    color: #333;
}

.next-car {
    color: #666;
    font-style: italic;
}

.round-complete {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
    border-radius: 12px;
}

.round-complete h2 {
    color: #155724;
    margin-bottom: 15px;
    font-size: 2em;
}

.round-complete p {
    color: #155724;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.final-race-notice {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-radius: 8px;
    border: 1px solid #ffc107;
}

.final-race-notice p {
    color: #856404;
    font-weight: bold;
    margin: 0;
}

/* Car Type Standings */
.car-type-standings {
    display: grid;
    gap: 25px;
}

.car-type-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #667eea;
}

.car-type-section h3,
.car-type-section h4 {
    color: #333;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    #racers-container {
        grid-template-columns: 1fr;
    }
    
    .current-race-section,
    .next-race-section {
        padding: 15px;
    }
    
    .progress-bar {
        max-width: 100%;
    }
}

/* Phantom Racer Styling */
.phantom-racer {
    background-color: rgba(128, 128, 128, 0.1);
    border-left: 4px solid #888;
    opacity: 0.7;
}

.phantom-racer .participant-name {
    font-style: italic;
    color: #666;
}

.phantom-racer .car-name-display {
    font-style: italic;
    color: #888;
}
