/**
 * Shell cliente: index + grazie — allineata a subapps-core.
 * Colori sfondo e CTA primaria: Firebase → --locale-bg, --locale-btn-gradient
 */

:root {
  --locale-bg: linear-gradient(168deg, #f1f5f9 0%, #e0f2fe 45%, #fef3c7 100%);
  --locale-btn-gradient: linear-gradient(135deg, #0d9488 0%, #0ea5e9 50%, #6366f1 100%);
  --locale-glass: rgba(255, 255, 255, 0.78);
  --locale-glass-edge: rgba(255, 255, 255, 0.55);
  --locale-ink: var(--z-ink, #0b1020);
  --locale-ease: var(--z-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

html {
  background: var(--locale-bg);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  font-family: var(--z-font, system-ui, sans-serif);
  color: var(--locale-ink);
  background: var(--locale-bg);
  background-attachment: fixed;
}

/* Benvenuto: stessa logica di .benvenuto-splash--kids (azzurro → bianco ghiaccio + velo chiaro). */
#splash {
  overflow: hidden;
  --splash-welcome-bg:
    radial-gradient(120% 90% at 50% -12%, rgba(56, 189, 248, 0.45) 0%, transparent 48%),
    radial-gradient(90% 70% at 0% 80%, rgba(59, 130, 246, 0.18) 0%, transparent 45%),
    linear-gradient(180deg, #dbeafe 0%, #eff6ff 50%, #f8fafc 100%);
  --splash-ease-in: cubic-bezier(0.22, 1, 0.36, 1);
  --splash-ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  background: var(--splash-welcome-bg) !important;
  background-attachment: fixed;
  color: #0c2744;
}

#splash::before {
  content: "";
  position: absolute;
  inset: -40%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35) 0%, transparent 45%);
  opacity: 1;
}

#splash > * {
  position: relative;
  z-index: 1;
}

#splash .splash-logo {
  animation: splash-logo-in 0.88s var(--splash-ease-in) 0.05s both;
  filter: drop-shadow(0 16px 36px rgba(3, 105, 161, 0.22));
}

#splash .splash-tagline {
  font-family: var(--z-font, inherit) !important;
  color: rgba(12, 39, 68, 0.92) !important;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75),
    0 0 28px rgba(255, 255, 255, 0.55);
  font-weight: 700 !important;
  font-style: italic;
  font-size: clamp(1.05rem, 4vw, 1.5rem) !important;
  text-align: center;
  margin: 0;
  padding: 0 1rem;
  animation: splash-tagline-in 0.72s var(--splash-ease-soft) 0.22s both;
}

#splash .splash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 1.75rem;
  padding: 0 1rem;
  animation: splash-loading-in 0.6s var(--splash-ease-in) 0.5s both;
}

#splash .splash-loading-text {
  font-family: var(--z-font, inherit);
  font-size: clamp(0.9rem, 3.2vw, 1.05rem);
  font-weight: 700;
  color: rgba(12, 39, 68, 0.58);
  letter-spacing: 0.02em;
}

#splash .splash-loading-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(12, 39, 68, 0.12);
  border-top-color: rgba(3, 105, 161, 0.55);
  border-radius: 50%;
  flex-shrink: 0;
  animation: splash-spin 0.75s linear infinite;
}

@keyframes splash-spin {
  to { transform: rotate(360deg); }
}

@keyframes splash-logo-in {
  from {
    opacity: 0;
    transform: translateY(-52px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splash-tagline-in {
  from {
    opacity: 0;
    transform: translateY(36px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splash-loading-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #splash .splash-logo,
  #splash .splash-tagline,
  #splash .splash-loading {
    animation: none !important;
    opacity: 1;
    transform: none;
    filter: none;
  }

  #splash .splash-logo {
    filter: drop-shadow(0 12px 28px rgba(3, 105, 161, 0.2));
  }
}

/* —— Pulsanti primari (Firebase gradient) —— */
.carrello-sticky,
.ordina-paga,
#btn-aggiungi-carrello,
.btn-aggiungi-carrello-dup,
.banner-button,
/* .pdsBackdrop è un button full-screen: NO gradiente Firebase (altrimenti “arco” gigante) */
#popup-ordina-paga button:not(.pdsBackdrop),
#banner-contanti .chiudi-banner {
  background: var(--locale-btn-gradient) !important;
  color: var(--locale-ink) !important;
  border: 1px solid var(--locale-glass-edge) !important;
  border-radius: var(--z-radius-pill, 9999px) !important;
  font-family: var(--z-font, inherit);
  font-weight: 800 !important;
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
  transition:
    transform var(--z-fast, 0.18s) var(--locale-ease),
    box-shadow 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.carrello-sticky:active,
.ordina-paga:active,
.banner-button:active,
#popup-ordina-paga button:not(.pdsBackdrop):active {
  transform: scale(0.97);
}

.chiudi-banner {
  background: var(--locale-glass) !important;
  color: var(--locale-ink) !important;
  border: 1px solid var(--z-line-strong, rgba(15, 23, 42, 0.12)) !important;
  border-radius: var(--z-radius-pill, 9999px) !important;
  font-weight: 700 !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--z-shadow-sm, 0 8px 28px rgba(15, 23, 42, 0.08)) !important;
}

#banner-contanti .chiudi-banner {
  background: var(--locale-btn-gradient) !important;
  color: var(--locale-ink) !important;
  border: 1px solid var(--locale-glass-edge) !important;
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}

/* —— Lingua / tavolo —— */
.selected-lang,
.icona-tavolo-badge {
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: var(--z-radius, 22px);
  background: var(--locale-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--z-shadow-xs, 0 2px 12px rgba(15, 23, 42, 0.06));
  color: var(--locale-ink);
}

.lang-options {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--z-radius, 22px);
  box-shadow: var(--z-shadow-md);
  overflow: hidden;
}

.lang-options div {
  background: var(--z-white, #fff);
  font-weight: 600;
}

/* —— Categorie —— */
.categoria {
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: var(--z-radius-pill, 9999px);
  background: var(--locale-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--z-shadow-xs);
  color: var(--locale-ink);
}

.categoria.active {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(15, 23, 42, 0.28);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

/* —— Card prodotto —— */
.prodotto {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--z-radius-lg, 28px);
  background: var(--locale-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--z-shadow-sm);
}

.prodotto .quantita button {
  background: var(--locale-ink) !important;
  color: var(--z-white) !important;
  border-radius: 50%;
}

/* —— Overlay modali fullscreen —— */
.modal.modal-fullscreen {
  background: rgba(15, 23, 42, 0.28) !important;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.modal.modal-fullscreen .modal-content {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  border-top: 1px solid var(--locale-glass-edge);
  box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.08);
}

.modal:not(.modal-fullscreen) .modal-content {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--z-radius-xl, 36px);
  box-shadow: var(--z-shadow-lg);
}

#popup-prodotto .modal-content *:not(.ordina-paga):not(button) {
  color: var(--locale-ink);
}

#popup-prodotto .popup-note-textarea {
  border: 1px solid rgba(15, 23, 42, 0.14) !important;
  border-radius: var(--z-radius, 22px) !important;
  background: rgba(255, 255, 255, 0.65) !important;
}

.ingrediente-riga {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--z-radius, 22px);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--z-shadow-xs);
}

.extra-toggle {
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: var(--z-radius, 22px);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
}

.close-x {
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
}

.banner {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.45) !important;
}

.scroll-to-top {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--z-radius, 22px);
  background: var(--locale-glass);
  backdrop-filter: blur(12px);
  color: var(--locale-ink);
  box-shadow: var(--z-shadow-sm);
}

.scroll-to-top:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.5);
  outline-offset: 2px;
}

#banner-contenuto .riepilogo-prodotto {
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  background: rgba(255, 255, 255, 0.45) !important;
  border-radius: var(--z-radius, 22px) !important;
  box-shadow: var(--z-shadow-xs) !important;
}

.auth-loading,
.locale-blocked {
  font-family: var(--z-font, inherit);
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(16px);
}

.app-toast {
  font-family: var(--z-font, inherit);
  border-radius: var(--z-radius, 22px);
}

.modal-content--locale-sheet {
  text-align: center;
  color: var(--locale-ink);
}

#popup-actions {
  gap: 0.75rem;
}

#popup-actions .ordina-paga,
.btn-aggiungi-carrello-dup {
  margin-bottom: 0.75rem;
}

.popup-rimuovi-title {
  font-size: 1.5em;
  font-weight: 800;
  margin-bottom: 0.5em;
  color: var(--locale-ink);
}

#btn-ordina-e-paga {
  margin-top: 1.2rem;
}
