/* ============================================================
   WEDDINGLIVE — MODALI (menu mobile + live chat)
   Richiede main.css (design tokens). Usato da: index, privacy,
   termini, cookie, gdpr.
   ============================================================ */

/* ── Menu mobile ────────────────────────────────────────────── */
.nav-mobile {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,18,8,0.97);
  /* Sopra la nav: altrimenti la nav fissa copre il pulsante di chiusura */
  z-index: calc(var(--z-nav) + 1);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  padding: var(--sp-16) var(--sp-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nav-mobile.open { display: flex; }
.nav-mobile .nav-link {
  font-size: var(--fs-2xl);
  color: #fff;
  font-family: var(--f-title);
}
.nav-mobile .nav-link:hover { color: var(--c-gold); }
.nav-mobile .btn { margin-top: var(--sp-4); }
.nav-mobile-close {
  position: absolute;
  top: var(--sp-6);
  right: var(--sp-6);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
}
.nav-mobile-close:hover { opacity: 1; }

/* Con il menu aperto la chat non deve galleggiare sopra */
.nav-mobile.open ~ .live-chat { display: none; }

/* ── Live chat ──────────────────────────────────────────────── */
.live-chat {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  z-index: calc(var(--z-modal) + 1);
  font-family: var(--f-body);
}
.live-chat-toggle {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--g-gold);
  color: var(--c-dark);
  box-shadow: var(--sh-gold);
  transition: var(--t);
}
.live-chat-toggle svg { width: 27px; height: 27px; }
.live-chat-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid var(--c-dark);
}
.live-chat-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 120px));
  max-height: min(720px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: var(--c-white);
  border: 1px solid rgba(201,168,76,0.26);
  box-shadow: var(--sh-xl);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--t), transform var(--t), visibility var(--t);
}
.live-chat.open .live-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}
.live-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--g-dark);
  color: #fff;
  flex-shrink: 0;
}
.live-chat-header strong {
  display: block;
  font-family: var(--f-title);
  font-size: 1.05rem;
  font-weight: 500;
}
.live-chat-header span {
  display: block;
  color: rgba(255,255,255,0.62);
  font-size: var(--fs-xs);
  margin-top: 2px;
}
.live-chat-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: rgba(255,255,255,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: var(--t);
}
.live-chat-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
/* Il corpo scorre dentro il pannello (flex) invece di un max-height calcolato a mano */
.live-chat-body {
  padding: var(--sp-5);
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
}
.live-chat-agent {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: var(--sp-3);
  align-items: start;
  margin-bottom: var(--sp-5);
}
.live-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--g-gold);
  color: var(--c-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.live-chat-bubble {
  border-radius: 8px;
  background: var(--c-ivory);
  padding: var(--sp-4);
  border: 1px solid var(--c-border);
}
.live-chat-bubble p {
  font-size: var(--fs-sm);
  line-height: 1.65;
  margin: 0;
}
.live-chat-quick {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.live-chat-chip {
  width: 100%;
  text-align: left;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-text);
  background: rgba(245,240,232,0.42);
  font-size: var(--fs-sm);
  transition: var(--t);
}
.live-chat-form {
  display: grid;
  gap: var(--sp-3);
}
.live-chat-form label {
  display: grid;
  gap: 6px;
  color: var(--c-text);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.live-chat-input,
.live-chat-textarea,
.live-chat-select {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: #fff;
  color: var(--c-text);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  outline: none;
  transition: var(--t);
}
.live-chat-textarea {
  min-height: 110px;
  resize: vertical;
}
.live-chat-input:focus,
.live-chat-textarea:focus,
.live-chat-select:focus {
  border-color: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.16);
}
.live-chat-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.live-chat-actions .btn { flex: 1; }
.live-chat-status {
  min-height: 20px;
  color: var(--c-sage);
  font-size: var(--fs-xs);
  line-height: 1.55;
}
.live-chat-status.error { color: #b45309; }
.live-chat-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* Hover solo su dispositivi con puntatore (su touch resterebbe "incollato") */
@media (hover: hover) {
  .live-chat-toggle:hover { transform: translateY(-3px); }
  .live-chat-chip:hover {
    border-color: var(--c-gold);
    background: rgba(201,168,76,0.12);
  }
}

@media (max-width: 768px) {
  .live-chat        { right: var(--sp-4); bottom: var(--sp-4); }
  .live-chat-toggle { width: 58px; height: 58px; }
  .live-chat-panel  { bottom: 70px; }
  /* iOS Safari fa zoom sui campi con testo sotto i 16px */
  .live-chat-input,
  .live-chat-textarea,
  .live-chat-select { font-size: 16px; }
}

@media (max-width: 480px) {
  .live-chat-actions .btn { width: 100%; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .live-chat-panel,
  .live-chat-toggle { transition: none; }
}
