/* ==================================================
   BASE LAYOUT
   ================================================== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden; /* ✅ evita micro-scroll orizzontali e “tagli” a destra */
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
}

/* ✅ FIX: evita tagli/sforamenti a destra (input, textarea, ecc.) */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ==================================================
   VIEWPORT PIANTINA — FIX “TAGLIO SOTTO”
   ================================================== */
#svgContainer {
  width: 100%;

  /* ✅ altezza = viewport - header - barra fissa in basso */
  height: calc(100vh - 180px);

  display: flex;
  justify-content: center;

  /* ✅ meglio di center: evita che la parte bassa finisca “sotto” la barra */
  align-items: flex-start;

  padding: 0;
  margin: 0;

  touch-action: none;
  user-select: none;
  position: relative;

  /* ✅ invece di hidden: posso scrollare se serve */
  overflow-y: auto;
  overflow-x: hidden;
}

/* Desktop: header un po’ più basso, ma la barra in basso resta */
@media (min-width: 1024px) {
  #svgContainer {
    height: calc(100vh - 140px);
  }
}

#svgContainer svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
}

/* ==================================================
   CONTROLLI ZOOM COMPATTI
   ================================================== */
#zoomControls {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 4px auto;
}

#zoomControls button {
  background-color: #ccc;
  border: none;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  margin: 0;
}

#zoomControls button + button { margin-left: -1px; }
#zoomControls button:hover { background-color: #bbb; }

/* ==================================================
   STATI POSTI
   ================================================== */
.posto { fill: #dddddd; cursor: pointer; }
.posto:hover { fill: #3ccc15; }
.posto.selected { fill: #007bff !important; }
.posto.occupied { fill: red !important; cursor: not-allowed; pointer-events: none; }
.posto.bloccato { fill: #ff8888 !important; cursor: not-allowed; pointer-events: none; opacity: 0.6; }

/* ==================================================
   MODALI (fix tagli + scroll sempre)
   ================================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);

  padding: 2rem;

  max-width: 400px;
  width: min(90vw, 400px);

  font-family: "Helvetica Neue", sans-serif;
  animation: fadeIn 0.3s ease-out;
  pointer-events: auto;

  /* ✅ evita modale “fuori schermo” */
  max-height: 92vh;
  overflow: hidden; /* lo scroll lo fa modal-content */
}

.modal-content {
  display: flex;
  flex-direction: column;
  position: relative;

  /* ✅ scroll verticale sempre quando serve */
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;

  /* piccolo margine per scrollbar */
  padding-right: 6px;
}

.modal h2 { font-size: 1.3rem; margin-bottom: 1rem; color: #333; }

.form-group { margin-bottom: 1.2rem; display: flex; flex-direction: column; }
.form-group label { font-size: 0.9rem; margin-bottom: 0.4rem; color: #444; }

.form-group input {
  width: 100%;
  max-width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
  font-weight: bold;
}

/* Riduce lo spazio tra input e label successiva nella modale */
.modal .form-group { margin-bottom: 2px; }
.modal .form-group label { margin-top: 2px; display: block; }
.modal .form-group input { margin-bottom: 2px; }

/* Pulsante di chiusura (X) */
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1.4rem;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: #000; }

/* ==================================================
   BOTTONI
   ================================================== */
button {
  display: block;
  margin: 20px auto;
  padding: 20px 40px;
  font-size: 20px;
  background-color: #3ccc15;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
button:disabled { background-color: #999; cursor: not-allowed; }

#bookButton {
  background-color: #007bff;
  font-size: 1.3rem;
  padding: 14px 32px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}
#bookButton:hover:enabled { background-color: #0056b3; }

/* Stato disabilitato del pulsante Prenota: grigio */
#bookButton:disabled {
  background-color: #bdbdbd !important;
  color: #f7f7f7;
  cursor: not-allowed;
  opacity: 0.9;
  box-shadow: none;
}

/* ==================================================
   GRUPPI DI BOTTONI NELLE MODALI
   ================================================== */
.button-group {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.button-group button {
  flex: 1;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.button-group button:hover:enabled { background-color: #0056b3; }
.button-group button:disabled { background-color: #999; cursor: not-allowed; }

/* ==================================================
   PULSANTI ANNULLA (uniforme ovunque)
   ================================================== */
button.annulla {
  background-color: #e0e0e0 !important;
  color: #333 !important;
  border: none !important;
}
button.annulla:hover:enabled { background-color: #cfcfcf !important; }

/* ==================================================
   ICONE CALENDARIO/TITOLO
   ================================================== */
#intestazioneSpettacolo .cal-wrap { display: inline-flex; align-items: center; gap: 10px; }
#intestazioneSpettacolo .cal-icon { width: 48px; height: 48px; display: inline-block; vertical-align: middle; }
#intestazioneSpettacolo .ora-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efefef;
  font-size: 14px;
  line-height: 1.2;
  color: #333;
  vertical-align: middle;
}

/* ==================================================
   DESKTOP / TABLET (>=601px)
   ================================================== */
@media (min-width: 601px) {
  #headerBar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:8px 10px;
    background:#fff;
    border-bottom:1px solid #ddd;
  }

  .header-title{
    display:flex;
    align-items:center;
    gap:12px;
    font-size:1.5rem;
    font-weight:bold;
  }

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

  .badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    background:#e0e0e0;
    color:#333;
    padding:4px 8px;
    border-radius:6px;
    font-size:0.95rem;
  }

  .divider{ width:1px; height:22px; background:#cfcfcf; }

  #zoomControls.zoom-compact{ display:flex; align-items:center; gap:6px; }
  #zoomControls.zoom-compact button{
    background:#c8cbd0;
    border:none;
    padding:4px 8px;
    border-radius:6px;
    font-size:14px;
    cursor:pointer;
  }
  #zoomControls.zoom-compact button:hover{ background:#bbb; }
}

/* ==================================================
   MOBILE (<=600px)
   ================================================== */
@media (max-width: 600px) {
  #headerBar{
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background:#fff;
    border-bottom:1px solid #ddd;
  }

  #intestazioneSpettacolo,
  .header-title{
    display:flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap:12px;
    font-size:1.4rem;
    font-weight:bold;
  }

  /* Toolbar centrata */
  #headerBar .toolbar{
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 auto;
  }

  .toolbar > * { display: flex; align-items: center; }

  .divider {
    display: inline-block;
    align-self: center;
    width: 1px;
    height: 24px;
    background: #cfcfcf;
  }

  .badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    background:#e0e0e0;
    color:#333;
    padding:4px 8px;
    border-radius:6px;
    font-size:0.9rem;
  }

  #zoomControls.zoom-compact button{
    padding: 4px 8px;
    font-size: 14px;
  }

  /* Più spazio verticale: header a 2 righe */
  #svgContainer {
    align-items: flex-start;
    height: calc(100vh - 260px);
  }

  /* Modali responsive */
  .modal {
    width: 92vw !important;
    max-width: none !important;
    padding: 1.25rem !important;
    border-radius: 14px !important;
    max-height: 90vh;
  }
  .modal-content {
    max-height: 90vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 6px;
  }
}

/* ==================================================
   RIEPILOGO
   ================================================== */
.riepilogo-info-spettacolo h3 {
  font-weight: bold;
  color: #222;
}
.riepilogo-info-spettacolo p {
  color: #555;
  font-style: italic;
}

/* ==================================================
   PRIVACY CHECKBOX
   ================================================== */
.privacy-row { margin-bottom: 16px; }

.privacy-text {
  margin-bottom: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #333;
}

.privacy-accept {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #222;
  cursor: pointer;
}

/* checkbox personalizzato */
.privacy-accept input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #007bff;
  border-radius: 4px;
  display: inline-block;
  position: relative;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s ease;
  margin: 0;
}

.privacy-accept input[type="checkbox"]:checked {
  background-color: #007bff;
  border-color: #007bff;
}

.privacy-accept input[type="checkbox"]:checked::after {
  content: "✔";
  color: #fff;
  font-size: 14px;
  position: absolute;
  top: -2px;
  left: 2px;
}

/* Evidenziazione blocco privacy quando manca il consenso */
.privacy-row.invalid{
  outline: 2px solid #ef4444;
  outline-offset: 4px;
  border-radius: 8px;
}

/* ==================================================
   TOAST CENTRATI (riusabili ovunque) — (deduplicato)
   ================================================== */
.toast-container{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  pointer-events: none;
}

.toast{
  pointer-events: auto;
  max-width: 90vw;
  width: 520px;

  padding: 12px 20px;
  border: 1px solid;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,.15);

  /* ✅ VISIBILITÀ + ANIMAZIONE */
  opacity: 0;
  transform: scale(0.96);
  transition: opacity .15s ease, transform .15s ease;

  /* ✅ FIX SCROLL */
  max-height: 80vh;        /* non supera mai lo schermo */
  overflow-y: auto;        /* scroll verticale */
  overflow-x: hidden;      /* niente tagli a destra */

  box-sizing: border-box;
}

/* Stati colore */
.toast.is-success{ background:#ecfdf5; border-color:#a7f3d0; color:#065f46; }
.toast.is-error  { background:#fef2f2; border-color:#fecaca; color:#991b1b; }
.toast.is-info   { background:#eff6ff; border-color:#bfdbfe; color:#1e3a8a; }

.toast.show { opacity: 1; transform: scale(1); }
.toast.hide { opacity: 0; transform: scale(0.97); }

/* bottone CHIUDI centrato */
.toast button{
  display: block;
  margin: 12px auto 0;
  padding: 6px 16px;
  font-size: 0.95rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(0,0,0,0.08);
}

.toast.is-success button { color: #065f46; }
.toast.is-error   button { color: #991b1b; }
.toast.is-info    button { color: #1e3a8a; }

.toast button:hover { background: rgba(0,0,0,0.15); }

/* Overlay per toast (blocca interazioni) */
.toast-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 99998;
  opacity: 0;
  transition: opacity .15s ease;
}
.toast-overlay.show{ opacity: 1; }
.toast-overlay.hide{ opacity: 0; }

/* ==================================================
   ERRORI / VALIDAZIONE CAMPI
   ================================================== */
.field-error{
  margin-top: 4px;
  font-size: .85rem;
  color: #b91c1c;
  min-height: 1em;
}

.is-invalid{
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.15);
}

.is-valid {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .2);
}

/* ==================================================
   POPUP ISTRUZIONI (PNG)
   ================================================== */
.tutorial-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 16px;
}

.tutorial-modal{
  position: relative;
  width: min(980px, 96vw);
  height: min(90vh, 720px);
  background: transparent;
  border-radius: 16px;
  box-shadow: none !important;
  border: none !important;
  outline: none !important;
  overflow: hidden;
}

.tutorial-close{
  position: absolute;
  top: 220px;
  right: 200px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}
.tutorial-close:hover{ background: rgba(255,255,255,.25); }

.tutorial-track{ display: none; }
.tutorial-track::-webkit-scrollbar{ height: 8px; }
.tutorial-track::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.25); border-radius: 999px; }

.tutorial-stage{
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-img{
  flex: 0 0 100%;
  width: auto;
  height: auto;
  max-width: min(600px, 70%);
  max-height: 70%;
  margin: auto;
  object-fit: contain;
  background: transparent;
  scroll-snap-align: center;
  user-select: none;
  -webkit-user-drag: none;
}

.tutorial-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}
.tutorial-arrow:hover{ background: transparent; }

.tutorial-arrow--prev{ left: 200px; }
.tutorial-arrow--next{ right: 200px; }

.tutorial-dots{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 235px;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}

.tutorial-dot{
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.35);
}
.tutorial-dot.is-active{ background: rgba(255,255,255,.95); }

/* Su mobile sistemiamo frecce/close/dots */
@media (max-width: 600px){
  .tutorial-modal{ height: min(92vh, 680px); }
  .tutorial-arrow--prev{ left: 45px; }
  .tutorial-arrow--next{ right: 45px; }
  .tutorial-close{ right: 5px; top: 12px; }
  .tutorial-dots{ bottom: 140px; }
}

.tutorial-modal:focus,
.tutorial-modal:focus-visible,
.tutorial-close:focus,
.tutorial-close:focus-visible,
.tutorial-arrow:focus,
.tutorial-arrow:focus-visible,
.tutorial-track:focus,
.tutorial-track:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

/* ==================================================
   MODALI PIÙ LARGHE SOLO DESKTOP
   ================================================== */
@media (min-width: 1024px) {
  .modal{
    max-width: 750px;
    width: min(75vw, 750px);
    padding: 2.8rem;
  }

  .modal-content{
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ==================================================
   FASCIA PRENOTAZIONE — overlay trasparente reale
   ================================================== */
#infoPrenotazione {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  background: rgba(255, 255, 255, 0.35) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);

  z-index: 1000;
}

#infoPrenotazione {
  pointer-events: auto;
}
/* ==================================================
   RECUPERO PDF (campo email in header)
   ================================================== */
.pdf-recover{
  display:flex;
  align-items:center;
  gap:6px;
  background:#ffffff;
  border:1px solid #ddd;
  border-radius:10px;
  padding:3px 6px;
}
.pdf-recover input{
  width: 220px;
  max-width: 34vw;
  border:none;
  outline:none;
  font-size: 0.92rem;
  padding: 6px 8px;
}
.pdf-recover button{
  margin:0;
  padding:6px 10px;
  font-size: 0.95rem;
  background:#007bff;
  border-radius:8px;
  cursor:pointer;
}
.pdf-recover button:hover{ background:#0056b3; }

@media (max-width: 600px){
  .pdf-recover{
    width: 100%;
    justify-content: center;
  }
  .pdf-recover input{
    width: min(320px, 70vw);
    max-width: 70vw;
  }
}

/* ==================================================
   MODALE RECUPERO PDF (lista)
   ================================================== */
.pdf-access-hint{
  margin: 10px 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
  color: #555;
}

.pdf-access-welcome{
  margin: 6px 0 10px;
  font-size: 0.95rem;
  color: #333;
}

.pdf-access-list{
  display:flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 6px;
}

.pdf-access-card{
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafafa;
}

.pdf-access-card h4{
  margin: 0 0 6px;
  font-size: 1rem;
  color: #111;
}

.pdf-access-items{
  display:flex;
  flex-direction: column;
  gap: 8px;
}

a.pdf-access-link{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  text-decoration:none;
  background:#ffffff;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  padding: 10px 12px;
  color: #0b4dbb;
}
a.pdf-access-link:hover{
  border-color:#9fb7e6;
  background:#f6faff;
}
.pdf-access-link .meta{
  color:#333;
  font-weight:600;
}
.pdf-access-link .icon{
  color:#b91c1c;
  font-size: 1.1rem;
}

/* ==================================================
   TOAST: scrollabile se testo lungo
   ================================================== */
.toast{
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
}

