/* ============================================
   FOODIE — Results Screen Design System
   Warm cream, brand-orange accent, green/amber status
   I token (:root) vivono in foodie-tokens.css, caricato prima
   di questo file. Qui solo componenti di schermata.
   ============================================ */

/* ---------- Segmented Toggle ---------- */
.fd-seg {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 4px;
}
.fd-seg button {
  flex: 1;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-results);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink-soft);
  padding: 11px 10px;
  border-radius: var(--r-pill);
  transition: color .15s ease, background .2s ease;
}
.fd-seg button.on {
  background: var(--accent);
  color: #fff;
}

/* ---------- Restaurant Card ---------- */
.rcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.rcard.top {
  border-color: #F3D7C7;
  box-shadow: 0 10px 30px -16px rgba(194, 64, 42, .40);
}
.rcard.voted {
  border-color: var(--green);
  box-shadow: 0 10px 30px -16px rgba(46, 168, 106, .45);
}
.rcard-photo {
  position: relative;
  height: 172px;
  background: var(--chip-bg);
  overflow: hidden;
  cursor: pointer;
}
.rcard-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rcard-photo .ph-badges {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.rcard-body {
  padding: 16px;
}
.rcard-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-family: var(--font-results);
}
.rcard-chips {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 11px;
}
.rcard-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.rcard-actions .fd-btn {
  flex: 1;
}

/* ---------- Badges ---------- */
.fd-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: var(--r-pill);
  padding: 7px 12px;
  line-height: 1;
  backdrop-filter: blur(6px);
  font-family: var(--font-results);
}
.fd-badge-top {
  background: rgba(255, 255, 255, .92);
  color: var(--tomato-dark);
}
.fd-badge-fit {
  background: var(--green);
  color: #fff;
}
.fd-badge-alt {
  background: rgba(255, 255, 255, .92);
  color: var(--ink-soft);
}

/* ---------- Chips ---------- */
.fd-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 6px 11px;
  line-height: 1;
  white-space: nowrap;
  font-family: var(--font-results);
}
.fd-chip-strong {
  background: #EDE7DB;
  color: #4A463F;
  font-weight: 700;
}

/* ---------- Rating ---------- */
.fd-rating {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  font-size: 14px;
  font-family: var(--font-results);
}
.fd-rating .score {
  font-weight: 800;
  color: var(--ink);
}
.fd-rating .count {
  color: var(--ink-soft);
  font-weight: 600;
}
.fd-stars {
  display: flex;
  gap: 1.5px;
}

/* ---------- Group Module ---------- */
.gmod {
  margin-top: 15px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
}
.gmod-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
  font-family: var(--font-results);
}
.gmod-h .spark {
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 7px;
}
.gmod-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  font-family: var(--font-results);
}

/* ---------- Buttons ---------- */
.fd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-results);
  font-weight: 700;
  font-size: 16px;
  border-radius: var(--r-pill);
  border: none;
  cursor: pointer;
  padding: 14px 18px;
  line-height: 1;
  white-space: nowrap;
  transition: transform .12s ease, background .15s ease;
}
.fd-btn:active {
  transform: scale(.97);
}
.fd-btn-primary {
  background: var(--accent);
  color: #fff;
}
.fd-btn-primary:active {
  background: var(--accent-dark);
}
.fd-btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.fd-btn-voted {
  background: var(--green-bg);
  color: var(--green-text);
}

/* ---------- Alternatives Divider ---------- */
.fd-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 2px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-results);
}
.fd-divider::before,
.fd-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* ---------- Ring Faces (Group Module) ---------- */
.gmod-faces {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px dashed var(--border-strong);
}
.gmod-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
  max-width: 72px;
}
.gmod-face-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-family: var(--font-results);
}
.gmod-ring {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 3px;
}
.gmod-ring.green { background: var(--green); }
.gmod-ring.amber { background: var(--amber); }
.gmod-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmod-ring-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.gmod-ring-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-results);
}
.gmod-ring-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmod-ring.green .gmod-ring-badge { background: var(--green); }
.gmod-ring.amber .gmod-ring-badge { background: var(--amber); }

/* ---------- Regenerate Button ---------- */
.fd-regen {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 15px;
  cursor: pointer;
  font-family: var(--font-results);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  transition: transform .12s ease;
}
.fd-regen:active {
  transform: scale(.98);
}
.fd-regen.spin svg {
  animation: fd-spin .8s linear infinite;
}
@keyframes fd-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Toast ---------- */
.fd-toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  gap: 9px;
  z-index: 60;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 12px 30px -8px rgba(33, 28, 22, .5);
  font-family: var(--font-results);
}
.fd-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Voter Avatars ---------- */
.voter-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tomato-tint);
  font-size: 10px;
  font-weight: 800;
  color: var(--tomato-dark);
  flex-shrink: 0;
}
.voter-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Match Score Chip ---------- */
.match-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--r-pill);
  padding: 5px 10px;
  line-height: 1;
  white-space: nowrap;
  font-family: var(--font-results);
}

/* ---------- Entrance Animation ---------- */
.fd-rise {
  animation: fd-rise .45s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes fd-rise {
  from { transform: translateY(14px); }
  to { transform: none; }
}

/* ============================================
   Accessibilità — focus tastiera & motion
   Additivo: :where() ha specificità 0, non
   sovrascrive gli stili esistenti degli elementi.
   ============================================ */
:where(button, a, input, textarea, select, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}
/* Non mostrare l'anello su click/touch, solo da tastiera */
:where(button, a, [role="button"]):focus:not(:focus-visible) {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
