/* Race Results Page Styles */

/* Section Header */
.results-section {
    min-height: 100vh;
    padding: 120px 40px 80px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a25 50%, #0d1a2d 100%);
}

.results-container {
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-header .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.section-header h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin: 0 0 1.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
}

.section-description {
    font-size: 1.2rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Race Selector / Filters */
.race-selector {
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px 32px;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.filter-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-item select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-item select:hover {
    border-color: var(--accent);
}

.filter-item select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.filter-item select option {
    background: #1a1a2e;
    color: #fff;
}

/* Race List */
.race-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* Race Card */
.race-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.race-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.2);
    filter: brightness(1.1);
}

.race-card.completed::before {
    content: "✓ Hoàn thành";
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 2;
}

.race-card .track-image {
    width: 100%;
    height: 160px;
    object-fit: fill;
    background: rgba(255, 255, 255, 0.05);
}

.race-card .card-content {
    padding: 20px;
}

.race-card .round-badge {
    display: inline-block;
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.race-card .track-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.race-card .race-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.race-card .meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.race-card .race-date {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.race-card .race-date::before {
    content: "📅";
}

.race-card .participants {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 13px;
}

.race-card .participants::before {
    content: "👥";
}

/* Race Results Detail */
.race-results-detail {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Race Info Header */
.race-info-header {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(138, 43, 226, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: center;
}

.race-info-header .track-image-wrapper {
    flex: 0 0 200px;
}

.race-info-header .track-image-wrapper img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.race-info-header .race-details {
    flex: 1;
    min-width: 250px;
}

.race-info-header .race-round {
    display: inline-block;
    background: var(--accent);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.race-info-header .race-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.race-info-header .race-track {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
}

.race-info-header .race-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.race-info-header .meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.race-info-header .meta-item .icon {
    font-size: 18px;
}

/* Results Table */
.results-table-wrapper {
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    margin-bottom: 32px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.results-table thead {
    background: rgba(0, 255, 136, 0.05);
}

.results-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    color: #fff;
}

.results-table tbody tr {
    transition: all 0.2s ease;
}

.results-table tbody tr:hover {
    background: rgba(0, 255, 136, 0.05);
}

/* Position styling */
.results-table .position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
}

.results-table .position.p1 {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #000;
}

.results-table .position.p2 {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #000;
}

.results-table .position.p3 {
    background: linear-gradient(135deg, #cd7f32, #b06820);
    color: #fff;
}

.results-table .position.points-zone {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent);
}

.results-table .position.no-points {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.results-table .position.dnf {
    background: rgba(255, 50, 50, 0.2);
    color: #ff5050;
}

/* Driver Cell */
.results-table .driver-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-table .driver-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.results-table .driver-info {
    display: flex;
    flex-direction: column;
}

.results-table .driver-name {
    font-weight: 600;
    color: #fff;
}

.results-table .driver-username {
    font-size: 12px;
    color: var(--text-secondary);
}

.results-table .country-flag {
    width: 24px;
    margin-left: 8px;
    border-radius: 2px;
}

/* Fastest lap indicator */
.fastest-lap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.fastest-lap.is-fastest {
    color: #a855f7;
    font-weight: 600;
}

.fastest-lap.is-fastest::after {
    content: "🟣";
    font-size: 10px;
}

/* Points */
.points-badge {
    display: inline-block;
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent);
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.points-badge.zero {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-state .spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* DNF Text */
.dnf-text {
    color: #ff5050;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .results-section {
        padding: 100px 20px 60px;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .race-selector {
        padding: 20px;
    }

    .filter-group {
        flex-direction: column;
    }

    .filter-item {
        min-width: 100%;
    }

    .race-list {
        grid-template-columns: 1fr;
    }

    .race-info-header {
        padding: 20px;
        flex-direction: column;
        text-align: center;
    }

    .race-info-header .track-image-wrapper {
        flex: unset;
        width: 100%;
    }

    .race-info-header .race-meta-info {
        justify-content: center;
    }

    .results-table th,
    .results-table td {
        padding: 12px 8px;
        font-size: 12px;
    }

    .results-table .driver-cell {
        gap: 8px;
    }

    .results-table .driver-avatar {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .section-header h2 {
        font-size: 1.75rem;
    }

    .section-header {
        margin-bottom: 2rem;
    }
}

@media (max-width: 375px) {
    .section-header h2 {
        font-size: 1.5rem;
    }
}