/* F1 Driver Stats Styles - Updated for better color specificity */
.driver-stats-container {
    max-width: 1200px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.driver-stats-error {
    background: #fee;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    border-radius: 4px;
    color: #721c24;
}

/* Header */
.driver-stats-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.driver-stats-profile {
    display: flex;
    align-items: center;
    gap: 30px;
}

.driver-stats-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 5px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.driver-stats-info {
    flex: 1;
}

.driver-stats-name {
    font-size: 42px;
    margin: 0 0 10px 0;
    font-weight: 800;
    color: white;
}

.driver-stats-team {
    font-size: 20px;
    margin: 0 0 15px 0;
    opacity: 0.95;
    color: white;
}

.driver-stats-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.driver-number-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.driver-nationality {
    font-size: 16px;
    opacity: 0.9;
    color: white;
}

.driver-championships {
    margin-top: 20px;
    text-align: center;
}

.driver-championships p {
    color: white;
    margin: 10px 0 0 0;
}

.championship-trophy {
    font-size: 36px;
    margin: 0 5px;
}

/* Stats Section */
.stats-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.stats-section-title {
    margin: 0 0 25px 0;
    font-size: 24px;
    color: #2c3e50 !important;
    border-bottom: 3px solid #e74c3c;
    padding-bottom: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stats-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-grid-5 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

/* Gradient cards - keep white text */
.stat-card.stat-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
}

.stat-card.stat-success {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white !important;
}

.stat-card.stat-warning {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white !important;
}

.stat-card.stat-info {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    color: white !important;
}

/* Fix for non-gradient stat cards - force dark text */
.stat-card:not(.stat-primary):not(.stat-success):not(.stat-warning):not(.stat-info) {
    color: #2c3e50 !important;
}

.stat-card:not(.stat-primary):not(.stat-success):not(.stat-warning):not(.stat-info) .stat-value {
    color: #2c3e50 !important;
}

.stat-card:not(.stat-primary):not(.stat-success):not(.stat-warning):not(.stat-info) .stat-label {
    color: #6c757d !important;
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    margin: 10px 0;
}

.stat-value.stat-medium {
    font-size: 28px;
}

.stat-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    font-weight: 600;
}

/* Gradient cards - ensure all children are white */
.stat-primary .stat-value,
.stat-success .stat-value,
.stat-warning .stat-value,
.stat-info .stat-value {
    color: white !important;
}

.stat-primary .stat-label,
.stat-success .stat-label,
.stat-warning .stat-label,
.stat-info .stat-label {
    color: white !important;
}

.stat-primary .stat-icon,
.stat-success .stat-icon,
.stat-warning .stat-icon,
.stat-info .stat-icon {
    color: white !important;
}

/* Streaks */
.streaks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.streak-category {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.streak-category h4 {
    margin: 0 0 15px 0;
    color: #e74c3c !important;
    font-size: 18px;
}

.streak-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
}

.streak-item:last-child {
    border-bottom: none;
}

.streak-label {
    font-weight: 600;
    color: #6c757d !important;
}

.streak-value {
    font-weight: 700;
    color: #2c3e50 !important;
}

/* Seasons Table */
.seasons-table-wrapper {
    overflow-x: auto;
}

.seasons-table {
    width: 100%;
    border-collapse: collapse;
}

.seasons-table thead th {
    background: #2c3e50;
    color: white !important;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.seasons-table tbody td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    color: #2c3e50 !important;
}

.seasons-table tbody tr:hover {
    background: #f8f9fa;
}

.seasons-table tbody tr.best-season {
    background: #fff3cd;
    font-weight: 700;
}

.seasons-table tbody tr.best-season:hover {
    background: #ffe69c;
}

.seasons-table tbody tr.best-season td {
    color: #2c3e50 !important;
}

/* Recent Form */
.recent-stats {
    display: grid;
    gap: 20px;
}

.recent-summary {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.recent-stat {
    text-align: center;
}

.recent-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: #6c757d !important;
    font-weight: 600;
    margin-bottom: 5px;
}

.recent-value {
    font-size: 24px;
    font-weight: 800;
    color: #2c3e50 !important;
}

.recent-races {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.recent-race {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.recent-race.race-dnf {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.race-name {
    font-weight: 600;
    color: #2c3e50 !important;
    margin-bottom: 8px;
}

.race-position {
    font-size: 24px;
    font-weight: 800;
    color: #e74c3c !important;
    margin: 5px 0;
}

.race-points {
    font-size: 14px;
    color: #6c757d !important;
}

/* Team History */
.team-history {
    display: grid;
    gap: 15px;
}

.team-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c757d;
}

.team-entry.team-current {
    border-left-color: #28a745;
    background: #d4edda;
}

.team-name {
    font-weight: 700;
    font-size: 16px;
    color: #2c3e50 !important;
}

.current-badge {
    background: #28a745;
    color: white !important;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 10px;
    font-weight: 600;
}

.team-period {
    color: #6c757d !important;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .driver-stats-container {
        padding: 15px;
    }
    
    .driver-stats-header {
        padding: 25px;
    }
    
    .driver-stats-profile {
        flex-direction: column;
        text-align: center;
    }
    
    .driver-stats-avatar {
        width: 120px;
        height: 120px;
    }
    
    .driver-stats-name {
        font-size: 32px;
    }
    
    .driver-stats-meta {
        justify-content: center;
    }
    
    .stats-section {
        padding: 20px;
    }
    
    .stats-section-title {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .streaks-container {
        grid-template-columns: 1fr;
    }
    
    .recent-summary {
        flex-direction: column;
        gap: 20px;
    }
    
    .team-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid,
    .stats-grid-4,
    .stats-grid-5 {
        grid-template-columns: 1fr;
    }
    
    .recent-races {
        grid-template-columns: 1fr;
    }
}