/* Import di un font pulito da Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

:root {
    --primary-color: #D4AF37; /* Oro per accenti e titoli */
    --background-color: #181818;
    --card-background: #282828;
    --text-color: #FFFFFF;
    --text-secondary: #AAAAAA;
    --nav-height: 70px; /* Altezza della barra di navigazione */
    color-scheme: light dark;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    padding-top: var(--nav-height); /* Aggiunge spazio in alto per la navbar fissa */
}

/* === NUOVA NAVBAR FISSA === */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: rgba(24, 24, 24, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    z-index: 1000;
    padding: 0 2rem;
}

.nav-brand {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
}

/* Contenitore principale (mantiene la larghezza massima) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main-header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--primary-color);
    margin-bottom: 2rem;
}

.main-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin: 0;
}

.main-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.spettacoli-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.card-spettacolo {
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card-spettacolo:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.2);
}

.card-spettacolo img {
    width: 100%;
    aspect-ratio: 1 / 1; /* Mantiene le proporzioni quadrate (1:1) */
    object-fit: cover;
}

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

.card-content h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    color: var(--primary-color);
}

.card-content .artista {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.card-content .descrizione {
    color: var(--text-color);
    flex-grow: 1; /* Fa in modo che il testo occupi lo spazio disponibile */
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.btn-prenota {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: var(--background-color);
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    margin-top: auto; /* Spinge il pulsante in fondo alla card */
}

.btn-prenota:hover {
    background-color: #E8C35E;
}

/* Stili per il footer */
.main-footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    border-top: 1px solid #333;
    color: var(--text-secondary);
}

/* === STILI PAGINA DETTAGLIO SPETTACOLO === */

.spettacolo-container {
    display: grid;
    grid-template-columns: 1fr; /* Default a una colonna per mobile */
    gap: 2rem;
    align-items: flex-start;
}

/* Layout a 2 colonne per schermi più grandi */
@media (min-width: 768px) {
    .spettacolo-container {
        grid-template-columns: 1fr 2fr; /* Colonna immagine più stretta */
    }
}

.spettacolo-copertina img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.spettacolo-info h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.spettacolo-info .artista {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-style: italic;
}

.spettacolo-info .descrizione {
    line-height: 1.8;
    font-size: 1.1rem;
    text-align: justify;
}

.repliche-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #333;
}

.repliche-section h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.lista-repliche {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lista-repliche a {
    display: block;
    padding: 1rem 1.5rem;
    background-color: var(--card-background);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 5px;
    border-left: 5px solid var(--primary-color);
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.lista-repliche a:hover {
    background-color: #2a2a2a;
    transform: translateX(5px);
}

/* === STILI PAGINA PRENOTAZIONE POSTI === */

.booking-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 992px) {
    .booking-container {
        flex-direction: row;
    }
}

.seat-map-wrapper {
    flex: 2; /* Occupa più spazio */
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 8px;
}

.summary-wrapper {
    flex: 1; /* Occupa meno spazio */
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 8px;
    height: fit-content; /* Si adatta al contenuto */
}

.palco-display {
    width: 60%;
    margin: 0 auto 2.5rem auto;
    background-color: var(--primary-color);
    color: var(--background-color);
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
    border-radius: 0 0 50px 50px;
    letter-spacing: 5px;
}

.seat-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

/* Stili per i posti nella mappa pubblica (con interazione definitiva) */
.posto {
    width: 100%;
    aspect-ratio: 1.5 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    user-select: none;
    /* La transizione è solo sulla dimensione, il colore cambia subito */
    transition: transform 0.15s ease-in-out;
}

.posto.disponibile {
    background-color: #6c757d;
    cursor: pointer;
}

.posto.disponibile:hover {
    background-color: #8a939b; /* Grigio chiaro al passaggio */
}

/* Rimuoviamo l'outline di default del browser */
.posto.disponibile:focus {
    outline: none;
    box-shadow: none;
}

/* Feedback istantaneo al momento del click/tap */
.posto.disponibile:active {
    transform: scale(0.95);
}

.posto.selezionato,
.posto.selezionato:hover { /* REGOLA CHIAVE: Un posto selezionato rimane verde ANCHE in hover */
    background-color: #28a745; /* Verde */
    cursor: pointer;
    font-weight: bold;
    transform: scale(1.05); /* Effetto "pop" per confermare la selezione */
}

.posto.occupato {
    background-color: #dc3545; /* Rosso */
    cursor: not-allowed;
}

/* Stili per il riepilogo e form */
.summary-wrapper h3 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 1px solid #333;
    padding-bottom: 1rem;
}

.summary-item {
    margin-bottom: 1rem;
}
.summary-item strong {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.form-dati-utente .form-group {
    margin-bottom: 1rem;
}
.form-dati-utente label {
    display: block;
    margin-bottom: 0.5rem;
}
.form-dati-utente input {
    width: 100%;
    padding: 0.7rem;
    box-sizing: border-box;
    background-color: #333;
    border: 1px solid #555;
    color: white;
    border-radius: 4px;
}

/* === STRUTTURA GRIGLIA MAPPA POSTI (FRONT-END) === */

.seat-map-grid {
    display: flex;
    flex-direction: column; /* Impila le file verticalmente */
    gap: 10px;              /* Spazio tra le file */
    max-width: 600px;
    margin: 1.5rem auto;
}

.seat-row {
    display: flex;
    justify-content: center; /* Centra i posti all'interno della loro fila */
    gap: 10px;               /* Spazio tra i posti */
}

.seat-wrapper {
    width: 65px; /* Dà una larghezza fissa a ogni posto per mantenere l'allineamento */
}

/* === STILI PAGINA DI CONFERMA === */

.confirmation-container {
    max-width: 700px;
    margin: 2rem auto;
    background-color: var(--card-background);
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    text-align: center;
    border-top: 5px solid #28a745; /* Verde successo */
}

.confirmation-header {
    margin-bottom: 2rem;
}

.confirmation-header i {
    font-size: 4rem;
    color: #28a745;
}

.confirmation-header h1 {
    margin: 1rem 0 0.5rem 0;
    font-size: 2.2rem;
    color: white;
}

.confirmation-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.booking-details {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
    text-align: left;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 1.5rem 0;
}

.booking-details li {
    padding: 0.8rem 0;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
}

.booking-details i {
    color: var(--primary-color);
    font-size: 1.3rem;
    width: 40px; /* Allinea le icone */
    text-align: center;
    margin-right: 1rem;
}

.booking-details strong {
    color: white;
}

.confirmation-footer {
    margin-top: 2rem;
}

/* Stile per il link "Torna Indietro" */
.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary-color);
}
/* === STILI SEZIONE COUPON === */
.coupon-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}
.coupon-form input {
    flex-grow: 1; /* Fa espandere il campo di testo */
    text-transform: uppercase; /* Scrive il codice in maiuscolo */
}
.coupon-feedback {
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 1rem;
    text-align: center;
}
.feedback-success {
    color: #0f5132;
    background-color: #d1e7dd;
}
.feedback-error {
    color: #842029;
    background-color: #f8d7da;
}

/* Stile per lo sconto nel riepilogo */
#discount-row {
    color: #28a745; /* Verde per lo sconto */
}
/* Stile per il box del disclaimer */
.disclaimer-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.disclaimer-box .form-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 0; /* Rimuove il margine extra */
}
.disclaimer-box input[type="checkbox"] {
    flex-shrink: 0; /* Impedisce alla checkbox di rimpicciolirsi */
    margin-top: 3px;
    width: auto; /* Sovrascrive lo stile generale degli input */
}

/* Stili per gli stati del biglietto in biglietto.php */
.ticket-container.status-ok {
    border-top-color: var(--primary-color); /* Oro */
}
.ticket-container.status-warning {
    border-top-color: #ffc107; /* Giallo */
}
.ticket-container.status-error {
    border-top-color: #dc3545; /* Rosso */
}

/* === STILI PER FILTRI E TAG (HOMEPAGE) === */

.filtri-container {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #333;
}

.filtri-gruppo {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.filtri-gruppo .etichetta {
    font-weight: bold;
    margin-right: 10px;
}

.filtro-btn {
    background-color: var(--card-background);
    color: var(--text-secondary);
    border: 1px solid #444;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filtro-btn:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
    border-color: var(--primary-color);
}

.filtro-btn.active {
    background-color: var(--primary-color);
    color: var(--background-color);
    font-weight: bold;
    border-color: var(--primary-color);
}

.card-tags {
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.card-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.tag-stagione {
    background-color: var(--primary-color);
    color: var(--background-color);
}

.tag-categoria {
    background-color: #6c757d; /* Grigio */
    color: white;
}

/* === STILI SEZIONE ABBONAMENTI (FRONT-END) === */

.abbonamenti-banner {
    background: linear-gradient(45deg, var(--primary-color), #ffcc4d);
    color: var(--background-color);
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    border-radius: 8px;
}

.abbonamenti-banner h2 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.abbonamenti-banner p {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
}

/* Riusiamo lo stile .btn-prenota ma con colori invertiti */
.btn-abbonamenti {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--background-color);
    color: var(--primary-color);
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.2s ease;
    border: 1px solid var(--background-color);
}
.btn-abbonamenti:hover {
    background-color: transparent;
    color: var(--background-color);
}

/* Stile per le card degli abbonamenti */
.abbonamenti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* === STILI AGGIUNTIVI PER PAGINA ABBONAMENTI === */

.spettacoli-inclusi-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #444;
}

.spettacoli-inclusi-container h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.spettacolo-card-abbonamento {
    text-align: center;
}

.spettacolo-card-abbonamento img {
    width: 100%;
    aspect-ratio: 1 / 1; /* Mantiene le copertine quadrate */
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.spettacolo-card-abbonamento img:hover {
    transform: scale(1.05);
}

.spettacolo-card-abbonamento h5 {
    margin: 0.5rem 0 0.2rem 0;
    font-size: 1rem;
    color: var(--text-color);
}

/* === STILI PER LA LIGHTBOX === */

.lightbox {
    display: none; /* Nascosta di default */
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    animation: zoom 0.3s ease;
}

@keyframes zoom {
    from {transform: scale(0.8);}
    to {transform: scale(1);}
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.lightbox-prev, .lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.3s ease;
    user-select: none;
    border-radius: 0 3px 3px 0;
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; border-radius: 3px 0 0 3px; }

.lightbox-prev:hover, .lightbox-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
}