/* Tema ispirato a sistemi eliminacode professionali (Welcome / visori sala) */
:root {
  --brand: #0066b3;
  --brand-dark: #004d88;
  --bg: #0a1628;
  --bg-panel: #0f2240;
  --surface: #152a4a;
  --text: #ffffff;
  --muted: #8eb4d9;
  --accent: #00c853;
  --accent-glow: rgba(0, 200, 83, 0.35);
  --danger: #ff5252;
  --border: #1e3a5f;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Barra stato connessione (nascosta su TV, visibile in setup) */
.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  background: var(--bg-panel);
  color: var(--muted);
}
.status-bar.online { color: var(--accent); }
.status-bar.offline { color: var(--danger); }
.page-display .status-bar { display: none; }

/* ========== DISPLAY TV (visore sala) ========== */
.page-display {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, #061018 100%);
}

.display-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--brand-dark);
  border-bottom: 4px solid var(--brand);
}

.display-top .brand-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.display-top img#site-logo {
  max-height: 56px;
  max-width: 180px;
  object-fit: contain;
}

.display-top h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.display-clock {
  font-size: 1.25rem;
  color: var(--muted);
}

.display-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: 0;
}

@media (max-width: 900px) {
  .display-body { grid-template-columns: 1fr; }
}

.display-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.display-hero .hero-label {
  font-size: clamp(1.25rem, 3vw, 2rem);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 0.5rem;
}

.display-hero .hero-number {
  font-size: clamp(6rem, 22vw, 14rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 60px var(--accent-glow);
  transition: transform 0.3s ease;
}

.display-hero.flash .hero-number {
  animation: pulse-call 0.8s ease;
}

@keyframes pulse-call {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.display-hero .hero-desk {
  margin-top: 1rem;
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--text);
}

.display-hero .hero-queue {
  margin-top: 0.5rem;
  font-size: 1.25rem;
  color: var(--muted);
}

.display-sidebar {
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
}

.display-sidebar h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.queue-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.queue-mini .qm-name { font-size: 0.95rem; }
.queue-mini .qm-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.recent-list {
  margin-top: 1.5rem;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.recent-item strong { color: var(--text); }

.display-footer-bar {
  text-align: center;
  padding: 0.75rem;
  background: var(--brand-dark);
  font-size: 1rem;
  color: var(--muted);
}

/* ========== TOTEM ========== */
.page-totem {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--brand-dark) 0%, var(--bg) 45%);
}

.totem-header {
  text-align: center;
  padding: 2rem 1.5rem 1rem;
}

.totem-header img#site-logo,
.booking-header img#site-logo {
  max-height: 72px;
  margin-bottom: 1rem;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

.display-top img#site-logo {
  background: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}

.totem-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
}

.totem-header p {
  color: var(--muted);
  font-size: 1.15rem;
  margin-top: 0.5rem;
}

.totem-services {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem 2rem 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.service-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: inherit;
  font: inherit;
}

.service-tile:hover,
.service-tile:focus {
  border-color: var(--brand);
  background: var(--bg-panel);
  transform: translateY(-2px);
  outline: none;
}

.service-tile .tile-code {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
}

.service-tile .tile-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.service-tile .tile-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.totem-ticket-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.totem-ticket-screen .ticket-label-text {
  font-size: 1.25rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.totem-ticket-screen .ticket-big {
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 800;
  color: var(--accent);
  margin: 0.5rem 0;
}

.totem-ticket-screen .ticket-wait {
  font-size: 1.35rem;
  color: var(--text);
  margin: 1rem 0 2rem;
}

.totem-ticket-screen .ticket-hint {
  color: var(--muted);
  max-width: 400px;
  line-height: 1.5;
}

/* ========== OPERATORE (postazione / Windows) ========== */
.page-operator {
  min-height: 100vh;
  background: #eef2f7;
  color: #1a2332;
}

.page-operator .status-bar {
  position: relative;
  background: #fff;
  border-bottom: 1px solid #d0d7e2;
}

.op-header {
  background: var(--brand);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.op-header h1 { font-size: 1.25rem; font-weight: 600; }

.op-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .op-main { grid-template-columns: 1fr; }
}

.op-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
}

.op-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.op-card select {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.op-now-serving {
  text-align: center;
  padding: 1.5rem 0;
  border: 2px dashed #d0d7e2;
  border-radius: 12px;
  margin: 1rem 0;
}

.op-now-serving .label { font-size: 0.85rem; color: #64748b; }
.op-now-serving .number {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.1;
}
.op-now-serving .desk { font-size: 1.25rem; margin-top: 0.25rem; }

.op-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.25rem;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-call {
  grid-column: 1 / -1;
  background: var(--brand);
  color: #fff;
  font-size: 1.35rem;
  padding: 1.25rem;
  min-height: 64px;
}
.btn-call:hover { background: var(--brand-dark); }

.btn-secondary { background: #e2e8f0; color: #1a2332; }
.btn-danger { background: #fee2e2; color: #b91c1c; }

.waiting-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
}

.waiting-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 1.1rem;
}

.waiting-list li .wl-num { font-weight: 700; color: var(--brand); }

.login-form {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.login-form input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.login-form .btn-primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
}

.error-msg { color: #b91c1c; font-size: 0.875rem; margin-bottom: 1rem; }

/* Setup panels */
.setup-panel {
  max-width: 420px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface);
  border-radius: 12px;
}

.setup-panel input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.setup-panel .btn { background: var(--brand); color: #fff; width: 100%; }

.totem-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
}
.totem-tab {
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.totem-tab.active { background: var(--brand); border-color: var(--brand); }

/* Overlay attivazione audio display (Chrome) */
#voice-unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(5, 15, 30, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.voice-unlock-box {
  text-align: center;
  max-width: 420px;
  padding: 2rem;
  border-radius: 16px;
  background: var(--surface, #1a2d4a);
  border: 2px solid var(--brand, #00aeef);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.voice-unlock-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #fff;
}

.voice-unlock-hint {
  color: var(--muted, #94a3b8);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  font-size: 0.95rem;
}

.voice-unlock-btn {
  padding: 0.85rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  background: var(--brand, #00aeef);
  color: #052e16;
  cursor: pointer;
}

#voice-unlock-overlay.voice-unlock-done {
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.signage-strip {
  background: var(--brand-dark);
  border-top: 3px solid var(--accent);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  text-align: center;
  transition: opacity 0.4s;
}
.signage-strip img { max-height: 64px; max-width: 100%; object-fit: contain; }
.signage-strip .sg-title { font-size: 1.25rem; font-weight: 600; }
.signage-strip .sg-body { color: var(--muted); margin-top: 0.25rem; }
