/* ============================================================
   assets/ristoranti/faq.css — Bouncy Accordion & FAQ del locale
   Feature "FAQ e politiche chiare" (/ristoranti/#funzioni).

   Architettura:
   - Fisica Spring / Bouncy: cubic-bezier(0.34, 1.4, 0.5, 1)
   - Morphing dinamico bordi e margini (Connected Groups <-> Floating Card)
   - Transizione fluida altezza con CSS Grid 0fr -> 1fr
   - Filtro categorie e ricerca live
   - Piena responsività e supporto ridotto movimento
   ============================================================ */

:root {
  --faq-ease-bounce: cubic-bezier(0.34, 1.4, 0.5, 1);
  --faq-ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ------------------------------------------------------------
 * 1. Frame Finestra FAQ (.rt-win--faq)
 * ------------------------------------------------------------ */
.rt-win--faq .rt-win__frame {
  max-width: 100%;
  width: 100%;
  height: min(90dvh, 840px);
  background: #f8faf9;
  color: #111827;
  font-family: var(--ff-sans);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.22);
  border: 1px solid #e2e8f0;
  box-sizing: border-box;
}

/* ------------------------------------------------------------
 * 2. Layout Applicazione FAQ
 * ------------------------------------------------------------ */
.faq-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #f8faf9;
  overflow: hidden;
}

/* Header */
.faq-head {
  padding: 1.5rem 1.6rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid #eef2f6;
  flex-shrink: 0;
}

.faq-head__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0.4rem;
}

.faq-badge-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.faq-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.faq-venue-tag {
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
}

.faq-title {
  font-family: var(--ff-display);
  font-weight: 900;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.15;
  margin: 0.2rem 0 0.4rem;
}

.faq-subtitle {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
  margin: 0 0 1rem;
}

/* Barra di ricerca */
.faq-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.faq-search-ico {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  pointer-events: none;
}

.faq-search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  background: #f1f5f9;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 0.88rem;
  color: #0f172a;
  transition: all 0.2s ease;
  outline: none;
}

.faq-search-input:focus {
  background: #ffffff;
  border-color: #1e3a34;
  box-shadow: 0 0 0 4px rgba(30, 58, 52, 0.08);
}

.faq-search-clear {
  position: absolute;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #475569;
  border: none;
  font-size: 0.7rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* Filtri Orizzontali */
.faq-filters {
  padding: 0.65rem 1.6rem;
  background: #ffffff;
  border-bottom: 1px solid #eef2f6;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.faq-filters::-webkit-scrollbar { display: none; }
.faq-filters { scrollbar-width: none; }

.faq-filters__track {
  display: flex;
  gap: 0.45rem;
  width: max-content;
}

.faq-filter-btn {
  background: #f1f5f9;
  border: 1px solid transparent;
  color: #475569;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.faq-filter-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.faq-filter-btn.is-active {
  background: #1e3a34;
  color: #ffffff;
  border-color: #1e3a34;
  box-shadow: 0 2px 8px rgba(30, 58, 52, 0.2);
}

/* ------------------------------------------------------------
 * 3. Area Scorrevole & BOUNCY ACCORDION
 * ------------------------------------------------------------ */
.faq-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.4rem 1.6rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Singolo elemento Accordion */
.faq-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  position: relative;
  overflow: hidden;
  transition:
    margin 0.52s var(--faq-ease-bounce),
    border-radius 0.52s var(--faq-ease-bounce),
    border-color 0.3s ease,
    box-shadow 0.4s ease;
}

/* Bordo finale per l'ultimo elemento chiuso */
.faq-item:last-child {
  border-bottom: 1px solid #e2e8f0;
}

/* Arrotondamenti di gruppo a riposo */
.faq-item:first-child {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.faq-item:last-child {
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}

/* STATO APERTO (FLOATING CARD CON RIMBALZO) */
.faq-item.is-open {
  margin: 14px 0;
  border-radius: 22px !important;
  border: 1.5px solid #1e3a34 !important;
  box-shadow: 0 14px 34px rgba(30, 58, 52, 0.09);
  z-index: 2;
}

/* Morphing dei gruppi adiacenti all'elemento aperto */
.faq-item.is-open + .faq-item {
  border-top-left-radius: 20px !important;
  border-top-right-radius: 20px !important;
  border-top: 1px solid #e2e8f0;
}

.faq-item:has(+ .faq-item.is-open) {
  border-bottom-left-radius: 20px !important;
  border-bottom-right-radius: 20px !important;
  border-bottom: 1px solid #e2e8f0;
}

/* Pulsante Trigger */
.faq-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.05rem 1.3rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease;
}

.faq-trigger:hover {
  background: rgba(241, 245, 249, 0.6);
}

.faq-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.faq-item.is-open .faq-tag {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.faq-q-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  flex: 1;
  letter-spacing: -0.01em;
}

.faq-chevron {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.48s var(--faq-ease-bounce), background-color 0.2s ease;
}

.faq-item.is-open .faq-chevron {
  transform: rotate(180deg);
  background: #1e3a34;
  color: #ffffff;
}

/* ------------------------------------------------------------
 * 4. Contenuto Espandibile (Grid 0fr -> 1fr)
 * ------------------------------------------------------------ */
.faq-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.52s var(--faq-ease-bounce);
}

.faq-item.is-open .faq-content {
  grid-template-rows: 1fr;
}

.faq-content__inner {
  overflow: hidden;
  opacity: 0;
  padding: 0 1.3rem;
  transition: opacity 0.22s ease, padding 0.52s var(--faq-ease-bounce);
}

.faq-item.is-open .faq-content__inner {
  opacity: 1;
  padding: 0 1.3rem 1.25rem;
  transition: opacity 0.3s ease 0.1s, padding 0.52s var(--faq-ease-bounce);
}

.faq-answer-text {
  font-size: 0.91rem;
  line-height: 1.6;
  color: #334155;
  margin: 0 0 0.9rem;
}

.faq-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.faq-hl-pill {
  font-size: 0.74rem;
  font-weight: 700;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 3px 9px;
  border-radius: 6px;
}

/* Stato vuoto */
.faq-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  background: #ffffff;
  border-radius: 20px;
  border: 1.5px dashed #cbd5e1;
}

.faq-empty-ico {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.faq-empty b {
  font-size: 1rem;
  color: #0f172a;
  display: block;
  margin-bottom: 0.3rem;
}

.faq-empty p {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

/* Box di Aiuto in Fondo */
.faq-foot-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.faq-foot-help__left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.faq-help-ico {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.faq-foot-help__left b {
  font-size: 0.92rem;
  color: #0f172a;
  display: block;
  line-height: 1.25;
}

.faq-foot-help__left span {
  font-size: 0.78rem;
  color: #64748b;
}

.faq-btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.28);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.faq-btn-wa:hover {
  background: #20bd5a;
  transform: translateY(-1px);
}

/* ------------------------------------------------------------
 * 5. Mini Anteprima nel Box Funzione (/ristoranti/#funzioni)
 * ------------------------------------------------------------ */
.rt-feature__preview--faq {
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0.85rem;
}

.rt-faq-mini {
  background: #ffffff;
  border: 1.5px solid #1e3a34;
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
  width: 100%;
  max-width: 230px;
  box-shadow: 0 6px 16px rgba(30, 58, 52, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rt-faq-mini__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.rt-faq-mini__tag {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 6px;
  text-transform: uppercase;
}

.rt-faq-mini__count {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748b;
}

.rt-faq-mini__q {
  font-family: var(--ff-display);
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.rt-faq-mini__ans {
  font-size: 0.62rem;
  color: #334155;
  line-height: 1.35;
  background: #f8fafc;
  border-left: 2px solid #22c55e;
  padding: 3px 6px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
 * 6. Responsive & Reduced Motion
 * ------------------------------------------------------------ */
@media (max-width: 640px) {
  .faq-head { padding: 1.2rem 1.1rem 0.9rem; }
  .faq-filters { padding: 0.5rem 1.1rem; }
  .faq-scroll { padding: 1.1rem 1.1rem 2rem; gap: 1.4rem; }
  .faq-foot-help {
    flex-direction: column;
    align-items: flex-start;
  }
  .faq-btn-wa { width: 100%; justify-content: center; }
}

html.reduce .faq-item,
html.reduce .faq-content,
html.reduce .faq-content__inner,
html.reduce .faq-chevron {
  transition: none !important;
}
