/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Race Header */
.race-header {
    margin-bottom: 2rem;
}

.race-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    color: #1a1a1a;
}

.race-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    color: #666;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Race Details */
.race-details {
    display: flex;
    gap: 3rem;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

.detail-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
}

/* Section Container */
.section-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.section-container h2 {
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

/* Riders List */
.riders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.rider-card {
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.rider-name {
    font-weight: 500;
    color: #333;
}

/* Starting Grid */
.grid-header {
    margin-bottom: 1.5rem;
}

.grid-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin: 0.5rem 0 0 0;
}

.grid-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-top: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.grid-row-header:first-of-type {
    margin-top: 0;
}

.row-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1a1a1a;
}

.row-positions {
    font-size: 0.875rem;
    color: #666;
}

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

.grid-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.grid-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.grid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.uci-position {
    color: #2b7cff;
    font-weight: 600;
}

.grid-position {
    color: #666;
}

.rider-initials {
    width: 48px;
    height: 48px;
    background: #e8f2ff;
    color: #2b7cff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    margin: 0.25rem 0;
}

.rider-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.uci-label {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rider-full-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.2;
}

.rider-country {
    font-size: 0.75rem;
    color: #666;
}

.recent-results {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

.rider-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.rider-tag {
    background: #f0f0f0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #333;
}

.grid-footer {
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 0.875rem;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .race-title {
        font-size: 1.75rem;
    }

    .race-metadata {
        gap: 1rem;
    }

    .race-details {
        flex-direction: column;
        gap: 1rem;
    }

    .section-container {
        padding: 1.25rem;
    }

    .riders-list {
        grid-template-columns: 1fr;
    }

    .grid-row {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .grid-card {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .race-title {
        font-size: 1.5rem;
    }

    .metadata-item {
        font-size: 0.875rem;
    }

    .icon {
        width: 16px;
        height: 16px;
    }
}

/* Results Section */
.results-section {
    margin-bottom: 2rem;
}

.results-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 0.9rem;
}

.results-table thead {
    background: #f8fbff;
    border-bottom: 2px solid #e0e0e0;
}

.results-table th {
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.875rem;
}

.result-row {
    transition: background-color 0.15s ease;
}

.result-row:hover {
    background-color: #f8fbff;
}

.rank-col {
    width: 80px;
}

.rider-col {
    min-width: 200px;
}

.country-col {
    width: 120px;
}

.team-col {
    min-width: 180px;
}

.time-col {
    width: 120px;
    font-family: 'Courier New', monospace;
}

.points-col {
    width: 100px;
    text-align: center;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    background: #666;
}

.rank-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.3);
}

.rank-silver {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    box-shadow: 0 2px 6px rgba(192, 192, 192, 0.3);
}

.rank-bronze {
    background: linear-gradient(135deg, #CD7F32 0%, #B8733B 100%);
    box-shadow: 0 2px 6px rgba(205, 127, 50, 0.3);
}

.gold-row {
    background-color: #fffdf0;
}

.silver-row {
    background-color: #f9f9f9;
}

.bronze-row {
    background-color: #fff9f5;
}

.hidden-result {
    display: none;
}

.show-more-container {
    text-align: center;
    margin-top: 1.25rem;
}

.show-more-btn {
    background: #2b7cff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.show-more-btn:hover {
    background: #1a5fd9;
}

@media (max-width: 768px) {
    .results-table th,
    .results-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .team-col,
    .country-col {
        display: none;
    }
}

/* Historic Results Section */
.historic-results-section {
    margin-bottom: 2rem;
}

.edition-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.edition-card:last-child {
    margin-bottom: 0;
}

.edition-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.edition-year {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.edition-location {
    background: #e8f2ff;
    color: #2b7cff;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.winner-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fffdf0;
    border-left: 4px solid #FFD700;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.winner-medal {
    font-size: 1.75rem;
}

.winner-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.winner-country {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

.podium-details {
    margin-top: 1rem;
}

.podium-summary {
    cursor: pointer;
    color: #2b7cff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    list-style: none;
    user-select: none;
}

.podium-summary::-webkit-details-marker {
    display: none;
}

.podium-summary::before {
    content: "▶ ";
    display: inline-block;
    transition: transform 0.2s;
}

.podium-details[open] .podium-summary::before {
    transform: rotate(90deg);
}

.podium-summary:hover {
    color: #1a5fd9;
}

.full-podium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.podium-position {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9f9f9;
    border-radius: 6px;
}

.podium-medal {
    font-size: 1.5rem;
}

.podium-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.podium-rider {
    font-size: 0.9rem;
    color: #1a1a1a;
}

.podium-country-small {
    font-size: 0.8rem;
    color: #666;
}

@media (max-width: 768px) {
    .edition-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .winner-display {
        flex-wrap: wrap;
    }
    
    .full-podium {
        grid-template-columns: 1fr;
    }
}
