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

:root {
    /* Colori F1 ufficiali */
    --f1-red: #E10600;
    --f1-dark: #15151E;
    --f1-gray: #38383F;
    --f1-light-gray: #949498;
    --f1-white: #FFFFFF;
    --f1-background: #0F0F0F;

    /* Colori secondari */
    --card-bg: #1E1E28;
    --card-border: #2A2A35;
    --hover-bg: #252530;

    /* Ombre */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-red: 0 4px 16px rgba(225, 6, 0, 0.3);
}

/* ========== TIPOGRAFIA ========== */
body {
    font-family: 'Titillium Web', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--f1-background);
    color: var(--f1-white);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background pattern subtile */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(180deg, rgba(15, 15, 15, 0.95) 0%, rgba(15, 15, 15, 0.98) 100%),
        repeating-linear-gradient(90deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.01) 100px,
            rgba(255, 255, 255, 0.01) 101px);
    z-index: -1;
    pointer-events: none;
}

/* ========== NAVBAR ========== */
.navbar {
    background: linear-gradient(135deg, var(--f1-dark) 0%, #1a1a24 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 3px solid var(--f1-red);
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

.nav-brand {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 0;
    justify-self: start;
}

.nav-brand img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

.nav-brand:hover img {
    transform: scale(1.05);
}

.nav-page-title {
    font-weight: 900;
    font-size: 1.4em;
    letter-spacing: -0.5px;
    color: var(--f1-white);
    text-transform: uppercase;
    text-align: center;
    justify-self: center;
}

.nav-page-title .icon {
    color: var(--f1-red);
    margin-right: 8px;
}

.nav-links {
    display: flex;
    gap: 5px;
    justify-self: end;
}

.nav-link {
    color: var(--f1-light-gray);
    text-decoration: none;
    padding: 20px 18px;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-link:hover {
    color: var(--f1-white);
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom-color: var(--f1-red);
}

/* ========== LOGIN PAGE STYLES ========== */

/* Background per login page */
body.login-page {
    background: radial-gradient(circle at top, #1a1a1a, #000);
    overflow: hidden;
}

/* Griglia animata di sfondo */
.grid {
    position: fixed;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(255, 0, 0, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 0, 0.15) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: moveGrid 20s linear infinite;
    transform: rotateX(60deg);
    top: -50%;
    left: -50%;
}

@keyframes moveGrid {
    from {
        transform: translateY(0) rotateX(60deg);
    }

    to {
        transform: translateY(40px) rotateX(60deg);
    }
}

/* Login card */
.login-card {
    position: relative;
    z-index: 10;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

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

.title {
    text-shadow: 0 0 15px #f44336;
}

.input {
    background: #111;
    color: white;
    border: none;
    border-bottom: 2px solid #f44336;
    padding: 12px;
    width: 100%;
    font-size: 1em;
    transition: all 0.3s ease;
}

.input:focus {
    outline: none;
    background: #000;
    border-bottom: 2px solid #00ff00;
}

.error {
    display: none;
    animation: shake 0.4s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.scanline {
    position: absolute;
    width: 100%;
    height: 3px;
    background: rgba(0, 255, 0, 0.5);
    animation: scan 3s linear infinite;
}

@keyframes scan {
    from {
        top: 0;
    }

    to {
        top: 100%;
    }
}

/* F1 cars animation */
.f1-car {
    position: fixed;
    bottom: 10%;
    left: -400px;
    width: 320px;
    opacity: 0.85;
    filter: drop-shadow(0 10px 20px rgba(244, 67, 54, 0.6));
    animation: drive 6s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.f1-car.fast {
    bottom: 18%;
    width: 260px;
    opacity: 0.6;
    animation-duration: 4s;
    filter: blur(1px) drop-shadow(0 8px 16px rgba(255, 0, 0, 0.6));
}

.f1-car.slow {
    bottom: 6%;
    width: 360px;
    opacity: 0.9;
    animation-duration: 8s;
}

@keyframes drive {
    from {
        transform: translateX(-500px) scale(1);
    }

    to {
        transform: translateX(140vw) scale(1.05);
    }
}

/* Navbar login */
.login-navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(244, 67, 54, 0.5);
    padding: 15px 20px;
}

.login-navbar a {
    color: white;
    font-weight: bold;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: inline-block;
}

.login-navbar a:hover {
    background: #f44336 !important;
}

/* Contenitore login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    padding-bottom: 40px;
}

/* Toggle password */
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.3em;
    user-select: none;
    color: #bbb;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--f1-red);
}

/* ========== HERO SECTION ========== */
.hero {
    margin-top: 70px;
    padding: 60px 20px 40px;
    text-align: center;
    position: relative;
    background: linear-gradient(180deg, rgba(225, 6, 0, 0.08) 0%, transparent 100%);
}

.hero-title {
    font-size: 4.5em;
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 15px;
    text-transform: uppercase;
    line-height: 1;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, var(--f1-red) 0%, #ff4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2em;
    color: var(--f1-light-gray);
    font-weight: 400;
    max-width: 700px;
    margin: 0 auto;
}

/* Decorazione hero */
.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--f1-red), transparent);
}

/* ========== HERO INDEX (animazione macchina) ========== */
.hero-index {
    height: 85vh;
    margin-top: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(225, 6, 0, 0.05) 0%, transparent 50%);
}

.hero-content {
    text-align: center;
    z-index: 10;
    position: relative;
}

.hero-logo {
    max-width: 220px;
    margin-bottom: 30px;
    filter: drop-shadow(0 4px 12px rgba(225, 6, 0, 0.3));
}

.hero-main-title {
    font-size: 5em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -2px;
    margin-bottom: 15px;
    line-height: 1;
}

.hero-description {
    font-size: 1.3em;
    color: var(--f1-light-gray);
    margin-bottom: 40px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== BOTTONI ========== */
.btn {
    padding: 16px 40px;
    font-size: 1.1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--f1-red);
    color: var(--f1-white);
    box-shadow: var(--shadow-red);
}

.btn-primary:hover {
    background: #c00500;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(225, 6, 0, 0.5);
}

.btn-primary:disabled {
    background: var(--f1-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--f1-white);
    border: 2px solid var(--f1-red);
}

.btn-secondary:hover {
    background: rgba(225, 6, 0, 0.1);
    transform: translateY(-3px);
    box-shadow: var(--shadow-red);
}

/* ========== ANIMAZIONE MACCHINA F1 ========== */
@keyframes runCar {
    0% {
        left: -300px;
        transform: scale(1);
    }

    15% {
        left: 10%;
        transform: scale(1.08) translateY(-3px);
    }

    50% {
        left: 50%;
        transform: scale(1.1) translateY(-5px);
    }

    85% {
        left: 85%;
        transform: scale(1.05) translateY(-2px);
    }

    100% {
        left: calc(100% + 50px);
        transform: scale(1) translateY(0);
    }
}

@keyframes speedLines {
    0% {
        opacity: 0;
        transform: translateX(0);
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
        transform: translateX(-100px);
    }
}

.car-animation {
    position: absolute;
    top: 50%;
    left: -300px;
    width: 300px;
    filter: drop-shadow(0 10px 20px rgba(244, 67, 54, 0.5));
    transition: filter 0.3s;
    z-index: 5;
}

.car-animation.racing {
    filter: drop-shadow(0 15px 30px rgba(244, 67, 54, 0.8)) drop-shadow(-30px 0 20px rgba(244, 67, 54, 0.4));
}

.speed-line {
    position: absolute;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(244, 67, 54, 0.8), transparent);
    top: 50%;
    left: -100px;
    width: 150px;
    animation: speedLines 0.3s linear infinite;
    pointer-events: none;
}

.speed-line:nth-child(1) {
    top: 45%;
    animation-delay: 0s;
}

.speed-line:nth-child(2) {
    top: 50%;
    animation-delay: 0.1s;
    height: 2px;
}

.speed-line:nth-child(3) {
    top: 55%;
    animation-delay: 0.2s;
}

/* Semafori */
.lights-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    gap: 15px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    padding: 40px;
    border-radius: 12px;
    border: 3px solid var(--f1-red);
    box-shadow: 0 0 40px rgba(225, 6, 0, 0.5);
}

.light-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.light {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 3px solid #333;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.light.on {
    background: var(--f1-red);
    box-shadow: 0 0 30px var(--f1-red), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.announcement {
    position: fixed;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3em;
    font-weight: 900;
    color: #00ff00;
    text-shadow: 0 0 30px #00ff00;
    display: none;
    z-index: 10000;
    animation: pulse 0.5s ease-in-out;
    white-space: nowrap;
    text-transform: uppercase;
}

@keyframes pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.2);
    }
}

/* Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ========== CONTAINER PRINCIPALE ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-section {
    padding: 60px 0;
}

.grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

/* ========== CARDS ========== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}

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

.card-header {
    text-align: center;
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.card-title {
    font-size: 1.5em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--f1-white);
}

.card-content {
    text-align: center;
}

/* Card Race */
.circuit-image {
    max-width: 70%;
    margin: 20px auto;
    display: block;
    border-radius: 8px;
    border: 2px solid var(--f1-red);
    box-shadow: var(--shadow-md);
}

.race-info {
    font-size: 1.1em;
    color: var(--f1-light-gray);
    line-height: 1.8;
    margin: 20px 0;
}

.race-info strong {
    color: var(--f1-white);
}

.race-flag {
    width: 28px;
    margin-right: 8px;
    vertical-align: middle;
}

.countdown {
    font-size: 2em;
    font-weight: 900;
    color: var(--f1-red);
    padding: 20px;
    margin: 20px 0;
    background: rgba(225, 6, 0, 0.05);
    border-radius: 8px;
    border: 2px solid rgba(225, 6, 0, 0.2);
}

/* Card Team Radio */
.team-radio-icon {
    font-size: 5em;
    margin: 30px 0;
}

.team-radio-text {
    font-size: 1.1em;
    color: var(--f1-light-gray);
    margin-bottom: 20px;
}

/* Card Classifica */
.standings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.driver-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    border-left: 4px solid var(--f1-red);
    transition: all 0.3s ease;
}

.driver-row:hover {
    transform: translateX(5px);
    background: rgba(225, 6, 0, 0.05);
    box-shadow: var(--shadow-md);
}

.driver-row:nth-child(even) {
    background: rgba(0, 0, 0, 0.2);
}

.driver-row:nth-child(even):hover {
    background: rgba(225, 6, 0, 0.05);
}

.driver-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.driver-position {
    font-size: 1.8em;
    font-weight: 900;
    color: var(--f1-red);
    min-width: 50px;
    text-align: center;
}

.driver-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--f1-red);
    box-shadow: 0 0 0 4px rgba(225, 6, 0, 0.1);
}

.driver-details {
    text-align: left;
}

.driver-name {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--f1-white);
    margin-bottom: 4px;
}

.driver-team {
    font-size: 0.9em;
    color: var(--f1-light-gray);
}

.driver-points {
    font-weight: 900;
    font-size: 1.3em;
    color: var(--f1-red);
}

/* Badge anno */
.year-badge-info {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

.year-badge-info strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.year-badge-info small {
    font-size: 0.9em;
    opacity: 0.8;
}

/* ========== SEZIONI FILTRI ========== */
.filter-section {
    margin: 40px 0;
}

.filter-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}

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

.filter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-icon {
    font-size: 1.5em;
}

.filter-title {
    font-size: 1.3em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--f1-white);
}

/* ========== LOADING STATE ========== */
.loading-state {
    text-align: center;
    padding: 50px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--f1-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--f1-light-gray);
    font-size: 1em;
    font-weight: 600;
}

/* ========== BOTTONI FILTRO ========== */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    background: var(--f1-gray);
    color: var(--f1-white);
    border: 2px solid transparent;
    padding: 14px 24px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.filter-btn:hover {
    background: var(--hover-bg);
    border-color: var(--f1-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-red);
}

.filter-btn.active {
    background: var(--f1-red);
    border-color: var(--f1-red);
    box-shadow: var(--shadow-red);
}

.filter-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Badge anno */
.year-badge {
    min-width: 90px;
}

/* Info gara nei bottoni */
.race-name {
    display: block;
    font-size: 1em;
    margin-bottom: 4px;
}

.race-date {
    display: block;
    font-size: 0.8em;
    opacity: 0.7;
    font-weight: 400;
    text-transform: none;
}

/* ========== CONTATORE ========== */
.stats-bar {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--hover-bg) 100%);
    border-radius: 8px;
    padding: 20px 30px;
    margin: 30px 0;
    text-align: center;
    border-left: 4px solid var(--f1-red);
    box-shadow: var(--shadow-md);
}

.stats-number {
    font-size: 2.5em;
    font-weight: 900;
    color: var(--f1-red);
    line-height: 1;
    margin-bottom: 5px;
}

.stats-label {
    font-size: 1em;
    color: var(--f1-light-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== GRID COMUNICAZIONI RADIO ========== */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 24px;
    margin: 40px 0;
}

.radio-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
    position: relative;
}

.radio-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--f1-red);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

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

.radio-card:hover::before {
    transform: scaleY(1);
}

/* Header card con pilota */
.radio-card-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    border-bottom: 1px solid var(--card-border);
}

.driver-info {
    flex: 1;
    min-width: 0;
}

.team-name {
    font-size: 0.9em;
    color: var(--f1-light-gray);
    font-weight: 600;
    margin-bottom: 4px;
}

.radio-timestamp {
    font-size: 0.85em;
    color: var(--f1-light-gray);
    display: flex;
    align-items: center;
    gap: 12px;
}

.timestamp-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Audio player */
.radio-player {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
}

audio {
    width: 100%;
    height: 48px;
    outline: none;
    border-radius: 8px;
}

/* Personalizzazione player Chrome/Safari */
audio::-webkit-media-controls-panel {
    background: linear-gradient(135deg, var(--f1-gray) 0%, var(--hover-bg) 100%);
    border-radius: 8px;
}

audio::-webkit-media-controls-play-button {
    background-color: var(--f1-red);
    border-radius: 50%;
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: var(--f1-white);
    font-weight: 600;
}

/* ========== STATI VUOTI E ERRORI ========== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    max-width: 600px;
    margin: 60px auto;
}

.empty-icon {
    font-size: 5em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--f1-white);
}

.empty-message {
    font-size: 1.1em;
    color: var(--f1-light-gray);
    line-height: 1.6;
}

/* Stato errore */
.error-state {
    background: rgba(225, 6, 0, 0.05);
    border: 2px solid rgba(225, 6, 0, 0.2);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
}

.error-icon {
    font-size: 3em;
    margin-bottom: 16px;
    color: var(--f1-red);
}

.error-title {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--f1-red);
}

.error-message {
    font-size: 1em;
    color: var(--f1-light-gray);
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1024px) {
    .radio-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }

    .grid-2col {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 3em;
    }

    .hero-subtitle {
        font-size: 1em;
    }

    .hero-main-title {
        font-size: 3.5em;
    }

    .hero-description {
        font-size: 1.1em;
    }

    .hero-index {
        height: 70vh;
    }

    .grid-2col {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .filter-card {
        padding: 20px;
    }

    .filter-title {
        font-size: 1.1em;
    }

    .radio-grid {
        grid-template-columns: 1fr;
    }

    .nav-brand {
        font-size: 1.1em;
    }

    .nav-brand img {
        height: 32px;
    }

    .nav-page-title {
        font-size: 1.1em;
    }

    .nav-link {
        font-size: 0.85em;
        padding: 18px 12px;
    }

    .card {
        padding: 20px;
    }

    .card-title {
        font-size: 1.2em;
    }

    .btn {
        padding: 14px 30px;
        font-size: 1em;
    }

    .car-animation {
        width: 200px;
    }

    .login-card {
        margin: 0 15px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.2em;
        letter-spacing: -1px;
    }

    .hero {
        padding: 40px 15px 30px;
    }

    .hero-main-title {
        font-size: 2.5em;
    }

    .hero-logo {
        max-width: 150px;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .filter-buttons {
        gap: 8px;
    }

    .filter-btn {
        padding: 12px 16px;
        font-size: 0.85em;
    }

    .radio-card-header {
        padding: 16px;
    }

    .driver-avatar {
        width: 56px;
        height: 56px;
    }

    .driver-name {
        font-size: 1em;
    }

    .stats-number {
        font-size: 2em;
    }

    .countdown {
        font-size: 1.3em;
        padding: 15px;
    }

    .driver-position {
        font-size: 1.4em;
        min-width: 40px;
    }

    .driver-points {
        font-size: 1.1em;
    }

    .car-animation {
        width: 150px;
    }

    .announcement {
        font-size: 1.8em;
    }

    .nav-links {
        gap: 0;
    }

    .nav-link {
        padding: 18px 10px;
        font-size: 0.75em;
    }

    .nav-links .nav-link:last-child {
        display: none;
    }

    .nav-page-title {
        font-size: 0.9em;
    }

    .nav-brand img {
        height: 28px;
    }

    .f1-car {
        width: 200px;
    }

    .f1-car.fast {
        width: 160px;
    }

    .f1-car.slow {
        width: 240px;
    }
}

/* ========== FOOTER ========== */
.footer {
    background: var(--f1-dark);
    border-top: 1px solid var(--card-border);
    padding: 30px 20px;
    text-align: center;
    margin-top: 60px;
}

.footer-text {
    color: var(--f1-light-gray);
    font-size: 0.9em;
    margin: 0;
}

.footer-highlight {
    color: var(--f1-red);
    font-weight: 600;
}

/* Label filtri */
.filter-label {
    display: block;
    margin-bottom: 10px;
    color: var(--f1-light-gray);
    font-weight: 600;
}

/* ========== UTILITY CLASSES ========== */
.hide {
    display: none !important;
}

.show {
    display: block !important;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Animazione fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* ================= REACTION GAME ================= */

.reaction-lights {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.r-light {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #555;
}

.r-light.on {
    background: red;
}

/* ========== STORICO CLASSIFICHE PAGE ========== */

/* Tabs per piloti/costruttori */
.tabs-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 30px;
}

.tab-btn {
    background: var(--f1-gray);
    color: var(--f1-white);
    border: 2px solid transparent;
    padding: 14px 28px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--hover-bg);
    border-color: var(--f1-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-red);
}

.tab-btn.active {
    background: var(--f1-red);
    border-color: var(--f1-red);
    box-shadow: var(--shadow-red);
}

/* Year selector */
.year-selector {
    width: 100%;
    background: var(--f1-gray);
    color: var(--f1-white);
    border: 2px solid var(--card-border);
    padding: 14px 20px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.year-selector:hover,
.year-selector:focus {
    border-color: var(--f1-red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.1);
}

.year-selector option {
    background: var(--f1-dark);
    color: var(--f1-white);
}

/* Sezione podio */
.podium-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 40px 0;
}

.podium-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.podium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.podium-card.first {
    transform: translateY(-10px);
}

.podium-card.first::before {
    background: #FFD700;
}

.podium-card.second::before {
    background: #C0C0C0;
}

.podium-card.third::before {
    background: #CD7F32;
}

.podium-card:hover {
    transform: translateY(-14px);
    box-shadow: var(--shadow-lg);
}

.podium-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.podium-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    border: 3px solid;
}

.podium-card.first .podium-image {
    border-color: #FFD700;
    width: 120px;
    height: 120px;
}

.podium-card.second .podium-image {
    border-color: #C0C0C0;
}

.podium-card.third .podium-image {
    border-color: #CD7F32;
}

.podium-badge {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    border: 3px solid;
}

.podium-card.first .podium-badge {
    border-color: #FFD700;
    width: 120px;
    height: 120px;
}

.podium-card.second .podium-badge {
    border-color: #C0C0C0;
}

.podium-card.third .podium-badge {
    border-color: #CD7F32;
}

.podium-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--f1-white);
    margin-bottom: 8px;
}

.podium-card.first .podium-name {
    font-size: 1.4em;
}

.podium-points {
    font-size: 1.1em;
    font-weight: 900;
    color: var(--f1-red);
}

.podium-card.first .podium-points {
    font-size: 1.4em;
    color: #FFD700;
}

/* Tabella classifiche */
.standings-table {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
}

.standings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--card-border);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.standings-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--f1-red);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.standings-row:hover {
    background: rgba(225, 6, 0, 0.05);
    transform: translateX(8px);
}

.standings-row:hover::before {
    transform: scaleY(1);
}

.standings-row:last-child {
    border-bottom: none;
}

.standings-row.gold::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #FFD700;
}

.standings-row.silver::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #C0C0C0;
}

.standings-row.bronze::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #CD7F32;
}

.standings-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.standings-position {
    font-size: 1.8em;
    font-weight: 900;
    color: var(--f1-red);
    min-width: 50px;
    text-align: center;
}

.standings-row.gold .standings-position {
    color: #FFD700;
}

.standings-row.silver .standings-position {
    color: #C0C0C0;
}

.standings-row.bronze .standings-position {
    color: #CD7F32;
}

.standings-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--f1-red);
}

.standings-badge {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    border: 3px solid var(--f1-red);
}

.standings-info h3 {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--f1-white);
    margin-bottom: 4px;
}

.standings-info p {
    font-size: 0.9em;
    color: var(--f1-light-gray);
}

.standings-points {
    font-size: 1.3em;
    font-weight: 900;
    color: var(--f1-red);
}

/* Info banner */
.info-banner {
    background: linear-gradient(135deg, rgba(225, 6, 0, 0.1) 0%, rgba(225, 6, 0, 0.05) 100%);
    border: 2px solid rgba(225, 6, 0, 0.2);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 30px;
    text-align: center;
}

.info-banner h3 {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--f1-white);
    margin-bottom: 8px;
}

.info-banner p {
    color: var(--f1-light-gray);
    font-size: 1em;
}

/* Click hint */
.click-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(225, 6, 0, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--f1-red);
    font-weight: 600;
    margin-left: 12px;
    animation: pulse-hint 2s ease-in-out infinite;
}

@keyframes pulse-hint {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Responsive per storico classifiche */
@media (max-width: 768px) {
    .podium-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .podium-card.first {
        transform: translateY(0);
    }

    .tabs-container {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    .standings-left {
        gap: 12px;
    }

    .standings-position {
        font-size: 1.4em;
        min-width: 40px;
    }

    .standings-avatar,
    .standings-badge {
        width: 50px;
        height: 50px;
    }

    .standings-info h3 {
        font-size: 1em;
    }

    .standings-info p {
        font-size: 0.85em;
    }

    .click-hint {
        display: none;
    }
}

/* ================= MINI RACING GAME ================= */

.race-track {
    position: relative;
    width: 100%;
    height: 120px;
    background: #4a4a4a;
    /* asfalto */
    border: 4px solid #222;
    /* bordo pista */
    border-radius: 15px;
    margin: 20px 0;
    overflow: hidden;
}

/* Linea centrale tratteggiata */
.race-track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    background: repeating-linear-gradient(to right,
            #fff 0,
            #fff 20px,
            transparent 20px,
            transparent 40px);
    transform: translateY(-50%);
}

/* Auto */
.mini-car {
    position: absolute;
    font-size: 2.5em;
    transition: left 0.05s linear;
}

.mini-car img {
    width: 60px;
    height: auto;
    display: block;
    position: relative;
}

#playerCar {
    top: 0px;
}

#botCar {
    top: 50px;
}


/* Tooltip Best Reaction */

#reactionBest {
    position: relative;
    display: inline-block;
    cursor: help;
}

#reactionBest::after {
    content: "Salvato nel Local Storage del browser";
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#reactionBest:hover::after {
    opacity: 1;
}

/* ========== DETTAGLIO PILOTA / TEAM ========== */
.position-badge {
    display: inline-block;
    min-width: 35px;
    text-align: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pos-1 {
    background: #FFD700;
    color: #000;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.pos-2 {
    background: #C0C0C0;
    color: #000;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.pos-3 {
    background: #CD7F32;
    color: #fff;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.pos-other {
    background: var(--f1-gray);
    color: #fff;
}

.pos-dnf {
    background: var(--f1-red);
    color: #fff;
    box-shadow: 0 2px 8px rgba(225, 6, 0, 0.4);
}

@media (max-width: 768px) {
    .grid-2col {
        grid-template-columns: 1fr !important;
        text-align: center;
    }

    .grid-2col img {
        margin: 0 auto;
    }
}