/* ========== STORICO GARE - STILI SPECIFICI ========== */

/* Hero section personalizzato per storico gare */
.hero {
    margin-top: 0;
    padding-top: 100px;
}

/* ========== YEAR SELECTOR ========== */
#yearSelectorContainer {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.year-selector-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--f1-red);
}

.year-selector-label {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--f1-white);
    margin-bottom: 15px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#yearSelector {
    background: var(--f1-dark);
    color: var(--f1-white);
    border: 2px solid var(--card-border);
    border-radius: 6px;
    padding: 14px 18px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

#yearSelector:hover {
    border-color: var(--f1-red);
}

#yearSelector:focus {
    outline: none;
    border-color: var(--f1-red);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.2);
}

/* ========== RACES CONTAINER ========== */
#racesContainer {
    padding: 40px 20px 60px;
}

#racesGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== RACE CARD ========== */
.race-card {
    width: calc(33.333% - 14px);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 25px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.race-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--f1-red);
}

.race-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg), var(--shadow-red);
    border-color: rgba(225, 6, 0, 0.3);
}

/* Link all'interno della card */
.race-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

/* Race header */
.race-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--card-border);
}

.race-header h3 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--f1-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.race-header img {
    width: 45px;
    height: 30px;
    object-fit: cover;
    border: 2px solid var(--card-border);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* Race info */
.race-info {
    font-size: 0.9em;
    color: var(--f1-light-gray);
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ========== PODIO ========== */
.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
}

.podium-position .driver-image {
    margin-top: 5px;
}

.podium-position {
    text-align: center;
    padding: 15px 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    flex: 1;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: var(--shadow-md);
}

.podium-position:hover {
    transform: translateY(-3px);
}

.podium-position.first {
    order: 2;
    height: 200px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

.podium-position.second {
    order: 1;
    height: 170px;
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
}

.podium-position.third {
    order: 3;
    height: 155px;
    background: linear-gradient(135deg, #CD7F32 0%, #B8722D 100%);
}

/* Driver image nel podio - override dello stile comune */
.podium-position .driver-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid rgba(0, 0, 0, 0.3);
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* Position number */
.position-number {
    font-weight: 900;
    font-size: 1.5em;
    margin-bottom: 6px;
    color: rgba(0, 0, 0, 0.8);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    line-height: 1;
}

/* Driver name nel podio */
.podium-position .driver-name {
    font-size: 0.85em;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.8);
    word-wrap: break-word;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 100%;
}

/* ========== LOAD MORE BUTTON ========== */
#loadMoreBtn {
    display: block;
    margin: 40px auto;
    padding: 16px 40px;
    background: var(--f1-red);
    color: var(--f1-white);
    border: 2px solid var(--f1-red);
    border-radius: 6px;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

#loadMoreBtn:hover {
    background: #c60500;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-red);
}

#loadMoreBtn:disabled {
    background: var(--f1-gray);
    border-color: var(--f1-gray);
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

/* ========== LOADING STATE ========== */
#mainLoading {
    padding: 80px 20px;
}

#loadMoreLoading {
    border-top: 1px solid var(--card-border);
    margin-top: 30px;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1024px) {
    .race-card {
        width: calc(50% - 10px);
    }
}

@media (max-width: 768px) {
    .race-card {
        width: 100%;
    }

    .race-header h3 {
        font-size: 1.3em;
    }

    .podium {
        gap: 8px;
    }

    .podium-position.first {
        height: 130px;
    }

    .podium-position.second {
        height: 110px;
    }

    .podium-position.third {
        height: 90px;
    }

    .podium-position .driver-image {
        width: 40px;
        height: 40px;
    }

    .position-number {
        font-size: 1.3em;
    }

    .podium-position .driver-name {
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    .race-card {
        padding: 20px;
    }

    .race-header {
        gap: 8px;
    }

    .race-header h3 {
        font-size: 1.1em;
    }

    .race-header img {
        width: 35px;
        height: 23px;
    }

    #loadMoreBtn {
        padding: 14px 30px;
        font-size: 0.9em;
    }
}