@font-face {
  font-family: 'Futura';
  src: url('/fonts/FuturaLT-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Futura';
  src: url('/fonts/FuturaLT-Book.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Futura';
  src: url('/fonts/FuturaLT-Heavy.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

:root {
    --primary-red: #B02A37;
    --secondary-gold: #E2C76E;
    --light-gray: #E0E0E0;
    --dark-text: #4A4A4A;
    --header-h: clamp(180px, 28dvh, 250px);
    --footer-h: clamp(60px, 8dvh, 100px);
    --container-max-width: 1200px;
}

* {
    box-sizing: border-box; /* Fondamentale per non far uscire gli elementi dai bordi */
}

body {
    font-family: 'Futura', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

/* Il contenitore principale */
.app-container {
    width: 100%;
    max-width: var(--container-max-width);
    min-height: 100vh;
    margin: 0 auto;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Mobile-specific constraints */
@media (max-width: 767px) {
    .app-container {
        max-width: 450px;
        height: 100vh;
        overflow: hidden;
    }
}

/* Header fisso in alto */
header {
    grid-row: 1;
    background: white;
}

/* Footer fisso in basso */
footer {
    grid-row: 3;
    background: white;
    margin-top: auto;
}

.header-container {
    background: white;
    z-index: 1000;
}

.footer-container {
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

@media (max-width: 767px) {
    .header-container {
        position: fixed;
        top: 0;
        width: 100%;
        max-width: 450px;
        height: var(--header-h);
    }
    .footer-container {
        position: fixed;
        bottom: 0;
        width: 100%;
        max-width: 450px;
        height: var(--footer-h);
    }
}

@media (min-width: 768px) {
    .header-container {
        padding: 20px 0;
        border-bottom: 1px solid #eee;
    }
    .footer-container {
        height: 80px;
        border-top: 1px solid #eee;
        margin-top: auto;
    }
}


/* SPACER PER L'HEADER */
.header-spacer {
    height: var(--header-height, 150px); /* Valore di fallback */
    width: 100%;
    flex-shrink: 0;
}

/* SPACER PER IL FOOTER */
.footer-spacer {
    height: var(--footer-height, 70px); /* Valore di fallback */
    width: 100%;
    flex-shrink: 0;
}

/* Contenuto scorrevole */
.app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    .app-content {
        position: absolute;
        top: var(--header-h);
        bottom: var(--footer-h);
        left: 0;
        right: 0;
    }
}

@media (min-width: 768px) {
    .app-content {
        padding: 40px 0;
    }
}

/* Navigazione (Home / Esci) */
.top-nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
}

.btn-nav {
    background-color: var(--primary-red);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
}

.divider {
    width: 1px;
    height: 60px;
    background-color: #ccc;
}

/* Pattern circolare centrale */
.pattern-mid {
    width: 60%;
    margin: 10px 0;
}

/* Griglia Icone */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding: 20px;
    width: 100%;
}

@media (min-width: 768px) {
    .menu-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 40px;
        padding: 40px;
    }
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: black;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
}

.menu-icon {
    width: 85px;
    height: 85px;
    margin-bottom: 8px;
}

.footer-bar {
    border-top: 1px solid #eee;
    width: 100%;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-user-icon {
    height: 28px;
    display: block;
}

.footer-username {
    font-weight: bold;
    color: var(--primary-red);
    text-transform: uppercase;
    font-size: 0.85rem;
    line-height: 1; /* evita disallineamenti */
}

.footer-accent {
    width: 100%;
    height: 6px;
    background: #0055A4;
    z-index: 1001;
}

@media (max-width: 767px) {
    .footer-accent {
        position: fixed;
        bottom: 0;
        max-width: 450px;
    }
}

.btn-logout {
    background: var(--primary-red);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto; /* Spinge a destra */
}

/* CSS per i chip orari simili allo stile dei tuoi screenshot */
.btn-slot {
    background-color: white;
    border: 1px solid var(--primary-red);
    color: var(--primary-red);
    border-radius: 20px;
    padding: 8px 15px;
    margin: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn-slot.active {
    background-color: var(--primary-red);
    color: white;
}

.btn-slot:hover {
    background-color: var(--light-gray);
}

.btn-slot.disabled {
    background-color: var(--light-gray);
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
}

/* Container per l'header incolonnato */
.header-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

.row-centered {
    padding: 10px 0;
    display: flex;
    flex-direction: row; /* oppure puoi proprio rimuoverla */
    justify-content: center; /* centra orizzontalmente */
    align-items: center; /* allinea verticalmente */
    text-align: center;
    gap: 25px; /* opzionale: spazio tra le immagini */
}

.row-centered img.main-logo {
    height: 70px;
    width: auto;
}

.row-centered img.partner-logo {
    height: 25px;
    width: auto;
}

@media (min-width: 768px) {
    .row-centered img.main-logo {
        height: 100px;
    }
    .row-centered img.partner-logo {
        height: 35px;
    }
    .partner-logos {
        gap: 50px;
    }
}

.divider-full {
    width: 100%;
    height: 1px;
    background-color: #ddd;
    margin: 5px 0;
}

/* Sezione omino e nome */
.user-icon {
    height: 40px;
    margin-bottom: 5px;
}
.username-display {
    font-weight: bold;
    color: var(--primary-red);
    text-transform: uppercase;
}

/* Menu Verticale */
.vertical-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .vertical-menu {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 0;
    }
}

.menu-button-wide {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 25px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: transform 0.2s;
}

.menu-button-wide:hover {
    transform: scale(1.02);
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-icon {
    height: 30px;
    margin-right: 20px;
}

/* Footer ed Esci */
.footer-vertical {
    /*margin-top: auto;*/
    width: 100%;
    text-align: center;
}

/* AGGIUNGI QUESTO PER REGOLARE L'ALTEZZA DEL FOOTER */
.footer-container + .footer-accent {
    /* Il footer-accent sarà immediatamente sotto il footer-container */
    bottom: calc(100% - 6px); /* Posiziona alla base del footer */
}

/* Wrapper per il contenuto */
.content-wrapper {
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0; /* Assicurati che parta dall'inizio */
}

@media (min-width: 768px) {
    .content-wrapper {
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
}

.section-title {
    color: var(--primary-red);
    text-align: center;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 25px;
}

/* Form Verticale */
.vertical-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .vertical-form {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        align-items: start;
    }
    
    .vertical-form .input-group,
    .vertical-form .slots-section,
    .vertical-form .customer-details-section,
    .vertical-form .btn-confirm-main,
    .vertical-form .text-center {
        grid-column: span 2;
    }
    
    /* Alcuni campi possono stare affiancati */
    .vertical-form .input-group:has(#servizioSelect),
    .vertical-form .input-group:has(#dataPrenotazione) {
        grid-column: span 1;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #666;
    margin-left: 5px;
}

/* Stile Input Custom (Select, Date, Textarea) */
.custom-input {
    width: 100%;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 12px;
    background-color: #f8f9fa;
    font-size: 1rem;
    color: #333;
    outline: none;
    box-sizing: border-box;
    appearance: none; /* Rimuove stile nativo su mobile */
}

.custom-input:focus {
    border-color: var(--primary-red);
    background-color: #fff;
}

/* Griglia degli Slot */
.slots-section {
    margin: 10px 0;
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 bottoni per riga su mobile */
    gap: 10px;
    margin-top: 10px;
}

@media (min-width: 768px) {
    .slots-grid {
        grid-template-columns: repeat(8, 1fr); /* 8 bottoni per riga su desktop */
    }
}

/* Bottone Conferma Principale */
.btn-confirm-main {
    background-color: var(--primary-red);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    .btn-confirm-main {
        max-width: 300px;
        margin: 20px auto;
        display: block;
    }
}

.btn-confirm-main:active {
    transform: scale(0.98);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .history-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

.booking-card {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.card-icon {
    background: #f0f2f5;
    padding: 10px;
    border-radius: 12px;
    margin-right: 15px;
}

.card-icon img {
    height: 40px;
    width: 40px;
    object-fit: contain;
}

.card-details {
    flex-grow: 1;
}

.card-details h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #333;
}

.card-details p {
    margin: 2px 0;
    font-size: 0.85rem;
    color: #777;
    display: flex;
    align-items: center;
}

.card-status {
    text-align: right;
}

.badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-ok {
    background-color: #e6f4ea;
    color: #1e7e34;
}

/* Download di una guida: la forma del pulsante principale, in scala ridotta
   perché sta dentro una scheda accanto al titolo e non in fondo a un modulo. */
.btn-download {
    display: inline-block;
    background-color: var(--primary-red);
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    transition: transform 0.1s ease, opacity 0.2s ease;
}

.btn-download:hover {
    opacity: 0.9;
}

.btn-download:active {
    transform: scale(0.98);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.card-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    height: 100%;
}

.btn-delete-icon {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    margin-top: 10px;
    transition: transform 0.2s;
}

.btn-delete-icon:hover {
    transform: scale(1.2);
}

.comune-label {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
}

/* Intestazione: "Comune di XXX" centrata sopra i loghi */
.comune-label-top {
    display: flex;
    justify-content: center;
    padding: 2px 0;
}

.comune-label-top .comune-label {
    margin-top: 0;
    font-size: 0.95rem;
    color: var(--dark-text);
    font-weight: 700;
}

/* Logo partner accanto al logo del comune */
.row-centered img.partner-logo-top {
    height: 45px;
    width: auto;
    max-width: 45%;
    object-fit: contain;
}

@media (min-width: 768px) {
    .row-centered img.partner-logo-top {
        height: 60px;
    }
}

/* Ottimizzazione per dispositivi mobili */
@media (max-width: 768px) {
    .app-container {
        height: 100%;
        max-height: 100vh;
    }
    
    .app-content {
        padding-bottom: 10px; /* Spazio extra per evitare che il contenuto sia nascosto dal footer */
    }
    
    /* Assicurati che i pulsanti siano facili da toccare */
    .btn-slot, .btn-confirm-main, .menu-button-wide {
        min-height: 44px; /* Dimensione minima consigliata per touch */
    }
}

@media (max-height: 700px) {
    .header-container {
        padding: 10px 0;
    }
    
    .app-content {
        padding-top: 120px;
        padding-bottom: 70px;
    }
}

/* Per iOS Safari */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: -webkit-fill-available;
    }
}

/* Stili per campi beneficiario */
.staff-only-fields, .customer-details-section {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.staff-only-fields {
    background: #fff4f4;
    border: 1px dashed var(--primary-red);
}


.row-flex {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.flex-1 {
    flex: 1;
}

.row-flex:last-child {
    margin-bottom: 0;
}

/* Alert per messaggi di stato */
.alert {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Consenso privacy nella registrazione */
.gdpr-consent {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gdpr-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.45;
    cursor: pointer;
}

.gdpr-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--primary-red);
    cursor: pointer;
}

.gdpr-link {
    color: var(--primary-red);
    font-weight: bold;
    text-decoration: underline;
}

/* Evidenziazione della casella quando manca il consenso */
.gdpr-consent.gdpr-invalid .gdpr-checkbox-label {
    color: #991b1b;
}

.gdpr-consent.gdpr-invalid .gdpr-checkbox {
    outline: 2px solid #b91c1c;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Pagina informativa privacy */
.privacy-content {
    text-align: left;
}

.privacy-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin: -10px 0 25px;
}

.privacy-content h4 {
    color: var(--primary-red);
    font-size: 1rem;
    margin: 22px 0 8px;
}

.privacy-content p,
.privacy-content li {
    font-size: 0.9rem;
    color: #4a4a4a;
    line-height: 1.6;
}

.privacy-content ul {
    margin: 8px 0 8px 20px;
    padding: 0;
}

/* Messaggio di errore sotto al singolo campo di un form */
.field-error {
    display: block;
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #991b1b;
}

/* Link di navigazione tra le pagine di auth */
.auth-nav-container {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.auth-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.auth-link:hover {
    color: var(--primary-red);
    text-decoration: underline;
}

.auth-link-bold {
    color: var(--primary-red);
    font-weight: bold;
}
/* Hamburger Menu Styles */
.hamburger-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.hamburger-btn span {
    width: 30px;
    height: 3px;
    background: var(--primary-red);
    border-radius: 10px;
    transition: all 0.3s linear;
}

.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: white;
    z-index: 2000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.side-menu.active {
    left: 0;
}

.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.side-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.close-menu-btn {
    font-size: 2.5rem;
    background: none;
    border: none;
    color: var(--primary-red);
    cursor: pointer;
    line-height: 1;
}

.side-menu-nav {
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.side-menu-nav a {
    padding: 15px 0;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    border-bottom: 1px solid #f9f9f9;
    transition: color 0.2s, padding-left 0.2s;
    font-size: 0.9rem;
}

.side-menu-nav a:hover {
    color: var(--primary-red);
    padding-left: 10px;
}

@media (min-width: 768px) {
    .hamburger-btn {
        top: 35px;
        left: 40px;
        width: 35px;
        height: 25px;
    }
    .hamburger-btn span {
        width: 35px;
    }
}


/* --- Fase 3 — stato della prenotazione e intestatario --- */

/* Lo stato non è più una scritta fissa: la prenotazione ha un ciclo di vita. */
.badge.stato-confermata { background: #e6f4ff; color: #1a5b8f; }
.badge.stato-completata { background: #e8f6ec; color: #1f5c33; }
.badge.stato-assente    { background: #fdf3e3; color: #7b4a12; }
.badge.stato-annullata  { background: #fdecec; color: #8f2020; }

/*
 * Nome ed email non sono più campi da compilare: l'appuntamento è intestato
 * all'account, e qui si mostra soltanto a chi.
 */
.intestatario {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: #f6f7f9;
    border-radius: 10px;
}

.intestatario-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 700;
}

.intestatario-nome {
    font-weight: 700;
    color: #1f2937;
}

.intestatario-email {
    font-size: 0.85rem;
    color: #6b7280;
}
