/* Stili Personalizzati */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bs-primary-rgb: 220, 53, 69;
    --bs-primary: #dc3545;
    --bs-dark-rgb: 33, 37, 41;
}

/* Regola per prevenire overflow orizzontale */
html, body {
    overflow-x: hidden;
    width: 100%;
}

.btn-primary {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

body {
    font-family: 'Poppins', sans-serif;
}

/* --- NAVBAR --- */
.navbar-brand {
    transform: translateX(-15px);
}

.navbar-brand img {
    height: 55px;
    width: auto;
    transition: all 0.3s ease;
}

.navbar-brand span {
    font-size: 1.4rem;
    vertical-align: middle;
}

#main-navbar .nav-link.active {
    color: var(--bs-primary) !important;
    font-weight: 700;
    position: relative;
}

.navbar {
    transition: background-color 0.4s ease-in-out, backdrop-filter 0.4s ease-in-out;
}

.navbar-transparent {
    background-color: transparent !important;
}

.navbar-scrolled {
    background-color: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.navbar-toggler {
    border: none !important;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Stile per l'icona hamburger personalizzata */
.hamburger-icon {
    width: 30px;
    height: 22px;
    position: relative;
    cursor: pointer;
}

.hamburger-icon span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: #fff; /* Colore delle linee */
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transition: 0.25s ease-in-out;
}

.hamburger-icon span:nth-child(1) {
    top: 0px;
}

.hamburger-icon span:nth-child(2) {
    top: 9px;
}

.hamburger-icon span:nth-child(3) {
    top: 18px;
}

.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
    background-color: var(--bs-primary);
}

.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
    background-color: var(--bs-primary);
}



/* --- SEZIONI E TITOLI --- */
section, header {
    scroll-margin-top: 80px;
}

.hero-section {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('Immagini/sfondo.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 225px 0;
    text-align: center;
}

.section-padding {
    padding: 80px 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.display-3, .display-5, .display-6 {
    font-weight: 700;
}

.section-title {
    margin-bottom: 4rem;
    position: relative;
}

.section-title h2 {
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--bs-primary);
}

.section-title {
    text-align: center;
}
.section-title::after {
    margin: 0 auto;
}

.col-md-4.section-title {
    text-align: left;
}

.col-md-4.section-title::after {
    margin: 0;
}


/* --- RACE CARDS --- */

.race-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}

.race-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 1rem 2rem rgba(0,0,0,.25);
}

.race-card-img-container {
    height: 200px;
    flex-shrink: 0;
}

.race-card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.race-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.race-card-title {
    color: var(--bs-primary);
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.race-card-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.race-card-stats .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
}

.race-card-stats .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

/* SEGNAPOSTO LOGHI */
.logo-placeholder {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 5px;
    min-height: 90px;
}

.logo-placeholder-text {
    display: grid;
    place-items: center;
    text-align: center;
    font-style: italic;
    color: #000;
    padding: 0 1rem;
    border: none;
}

.logo-container {
    display: grid;
    place-items: center;
    width: 100%;
}

.logo-placeholder-left {
    flex-basis: 50%;
}

.logo-placeholder-right {
    flex-basis: 50%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.logo-placeholder-right .logo-container {
    height: 35px;
    border-radius: 0.25rem;
}

.logo-img-left {
    max-width: 100%;
    max-height: 50px;
    object-fit: contain;
}

.logo-img-right {
    max-width: 100%;
    max-height: 90%;
    object-fit: contain;
}


.race-card-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-details {
    flex-grow: 1;
    background-color: #212529;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.75rem;
    border-radius: 0.25rem;
    transition: background-color 0.3s ease;
    border: none;
    text-align: center;
}

.btn-details:hover {
    background-color: #495057;
    color: #fff;
}

.btn-details.btn-icon {
    flex-grow: 0;
    flex-basis: 50px;
}

.race-card-footer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: var(--bs-primary);
}


/* --- SPONSOR --- */
.sponsor-wrapper {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    perspective: 1000px;
}

.sponsor-wrapper img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: grayscale(100%);
    transition: filter 0.4s ease-in-out, transform 0.4s ease-in-out;
}

.sponsor-wrapper:hover img {
    filter: grayscale(0%);
    transform: scale(1.15) translateZ(30px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}


/* --- MODALI --- */
.modal-backdrop.show {
    opacity: 0.9;
}

#sponsorModal .btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem; 
    background-color: rgba(0, 0, 0, 0.5); 
    border-radius: 50%;
    padding: 0.5rem;
    z-index: 1500; 
}

#hospitalityModal .modal-body li {
    margin-bottom: 1rem; /* Aggiunge spazio tra le voci della lista hospitality */
}

#modalImage {
    cursor: zoom-out;
    max-height: 80vh;
    width: auto;
}

/* --- CAROSELLO PERCORSO --- */
.img-percorso {
    width: 100%;
    height: 450px;
    object-fit: cover;
}

#carouselPercorso .carousel-item {
    transition: transform 0.6s ease-in-out;
}

#carouselPercorso .row {
    min-height: 450px;
}

#carouselPercorso .carousel-control-prev-icon,
#carouselPercorso .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
}

/* --- SEZIONE PROGRAMMA --- */
.programma-section {
    position: relative;
    padding: 100px 0;
    background: url('Immagini/percorso/percorso7.jpg') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    z-index: 1;
}

.programma-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

.programma-data {
    color: var(--bs-primary);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.programma-lista li {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.programma-orario {
    color: var(--bs-primary);
    font-weight: 600;
    display: inline-block;
    width: 60px;
}

.btn-regolamento:hover {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !importan;
    color: white !important;
    transform: translateY(-5px);
}

/* --- COOKIE BANNER --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(33, 37, 41, 0.95);
    color: white;
    padding: 1rem 0;
    z-index: 1050;
    display: none;
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner a {
    color: var(--bs-primary);
    text-decoration: underline;
}


/* --- FOOTER --- */
.footer {
    background-color: #212529;
    color: #ccc;
    padding: 40px 0;
}

.footer h5,
.footer h6 {
    color: var(--bs-primary);
}

.footer a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer .list-unstyled a:hover {
    color: var(--bs-primary);
}

.footer .social-icons i {
    font-size: 1.8rem;
    color: #fff;
    transition: color 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.footer .social-icons a:hover i {
    color: var(--bs-primary);
    transform: scale(1.1);
}

.contact-info a[href^="tel:"] {
    color: var(--bs-primary) !important;
    font-weight: 600;
}

/* --- COUNTDOWN --- */
.countdown-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: .5rem;
    text-align: center;
    min-width: 90px;
    backdrop-filter: blur(5px);
}

.countdown-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
}

.countdown-label {
    font-size: .9rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}



/* --- RESPONSIVE --- */
@media (max-width: 991.98px) {
    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        background-color: rgba(33, 37, 41, 0.9);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 1.5rem;
        margin-top: 0.5rem;
        border-radius: .5rem;
    }

    .navbar-dark .navbar-nav .nav-link:hover,
    .navbar-dark .navbar-nav .nav-link:focus {
        color: var(--bs-primary) !important;
    }
}

@media (max-width: 768px) {
    .img-percorso {
        height: 250px;
    }
    #carouselPercorso .row {
        min-height: 0; /* Resetta l'altezza minima per mobile */
    }
    .section-title h2 {
        font-size: 2rem;
    }
    .cookie-banner .container {
        flex-direction: column;
        text-align: center;
    }
    .cookie-banner p {
        margin-bottom: 1rem;
    }
    .logo-placeholder {
        min-height: 70px;
    }
    .logo-placeholder-right .logo-container {
        height: 50px; /* La tua modifica per il mobile, ora permanente */
    }

    /* Nasconde le colonne Club e Sesso nella tabella dei risultati su mobile */
    #risultati table th:nth-child(3),
    #risultati table td:nth-child(3),
    #risultati table th:nth-child(4),
    #risultati table td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 767.98px) {
    /* Stile per le card del percorso su mobile con scroll */
    #carouselPercorso .p-5 {
        height: 300px; /* Altezza fissa per il box di testo */
        min-height: auto; /* Resetta la min-height precedente */
        overflow-y: auto; /* Aggiunge lo scroll verticale se il testo eccede */
        display: block; /* Assicura il corretto funzionamento dello scroll */
        padding: 2rem !important; /* Mantiene un padding adeguato */
    }

    /* Stile custom per la scrollbar (WebKit) */
    #carouselPercorso .p-5::-webkit-scrollbar {
        width: 6px;
    }
    #carouselPercorso .p-5::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 3px;
    }
    #carouselPercorso .p-5::-webkit-scrollbar-thumb {
        background: var(--bs-primary);
        border-radius: 3px;
    }

    .page-controls {
        flex-direction: column;
        align-items: stretch !important;
    }
    .page-controls .form-control {
        width: 100% !important;
    }
    .page-controls .btn-group,
    .page-controls .dropdown {
        display: flex;
    }
    .page-controls .btn {
        flex-grow: 1;
    }

    .countdown-box { 
        padding: .5rem; 
        min-width: 70px; 
    }
    .countdown-value { font-size: 1.8rem; }
    .countdown-label { font-size: .7rem; }
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #e60000 !important; /* Rosso acceso e deciso */
    font-weight: 700; /* Assicurati che sia in grassetto */
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #e60000 !important; /* Stesso colore al passaggio del mouse */
    transform: scale(1.08);
    transition: all 0.2s ease-in-out;
}
