/* ═══════════════════════════════════════════════════════════
   Suggestion Chips — shared interactive choice component
   Used by PTT (ptt.html) and regular chat (chat.html)
   ═══════════════════════════════════════════════════════════ */

/* ── Container ──
   v2 glow-up: the card is now a neon panel with a moving scan line at
   the top and an animated accent glow. The user wanted “dopamine spikes
   and glowing buttons” — so the whole card reads as an action surface
   instead of a muted info strip. */
.suggestion-card {
  position: relative;
  margin: 8px 0 10px;
  padding: 10px 12px 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent, #00f5ff) 45%, transparent);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent, #00f5ff) 10%, transparent),
    color-mix(in srgb, var(--accent, #00f5ff) 3%, rgba(0,0,0,.4)));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent, #00f5ff) 22%, transparent),
              inset 0 0 22px color-mix(in srgb, var(--accent, #00f5ff) 4%, transparent);
  overflow: hidden;
  animation: suggCardIn .28s cubic-bezier(.2,.8,.2,1);
}
.suggestion-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent,
    var(--accent, #00f5ff), color-mix(in srgb, var(--accent, #00f5ff) 60%, white),
    var(--accent, #00f5ff), transparent);
  animation: suggScan 2.6s linear infinite;
  pointer-events: none;
}
@keyframes suggScan { 0%,100% { opacity:.35 } 50% { opacity:.9 } }
@keyframes suggCardIn {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── Header ── */
.suggestion-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.suggestion-icon {
  font-size: 14px;
  filter: drop-shadow(0 0 4px var(--accent, #00f5ff));
}
.suggestion-label {
  font-size: 8.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent, #00f5ff);
  opacity: .85;
}

/* ── Question text ── */
.suggestion-text {
  font-size: 10.5px;
  color: var(--text, #e0e0e0);
  line-height: 1.5;
  margin-bottom: 8px;
}

/* ── Chip row ── */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

/* ── Individual chip — now a proper glowing neon button ──
   Gradient fill, pulsing outer glow, thicker border, bigger tap target
   (min-height 32px / 36px on mobile). Ripple + shimmer sweep on hover. */
.suggestion-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 32px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--accent, #00f5ff) 55%, transparent);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent, #00f5ff) 22%, transparent),
      color-mix(in srgb, var(--accent, #00f5ff) 8%, rgba(0,0,0,.35)));
  color: color-mix(in srgb, var(--accent, #00f5ff) 85%, white);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s, box-shadow .2s, border-color .2s, background .2s;
  animation: chipIn .32s cubic-bezier(.2,.8,.2,1) both,
             chipGlow 2.2s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * 70ms), calc(var(--i, 0) * 70ms + 500ms);
  user-select: none;
  position: relative;
  overflow: hidden;
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent, #00f5ff) 40%, transparent);
  -webkit-tap-highlight-color: transparent;
}
@keyframes chipIn {
  from { opacity: 0; transform: translateY(10px) scale(.88); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0) scale(1);      filter: none; }
}
@keyframes chipGlow {
  from { box-shadow: 0 0 6px color-mix(in srgb, var(--accent, #00f5ff) 20%, transparent),
                     0 0 14px color-mix(in srgb, var(--accent, #00f5ff) 8%, transparent); }
  to   { box-shadow: 0 0 14px color-mix(in srgb, var(--accent, #00f5ff) 55%, transparent),
                     0 0 28px color-mix(in srgb, var(--accent, #00f5ff) 25%, transparent); }
}
.suggestion-chip::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(120deg, transparent 35%,
    color-mix(in srgb, var(--accent, #00f5ff) 35%, white) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .6s cubic-bezier(.2,.8,.2,1);
  opacity: .5;
}
.suggestion-chip:hover {
  border-color: var(--accent, #00f5ff);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent, #00f5ff) 40%, transparent),
      color-mix(in srgb, var(--accent, #00f5ff) 18%, rgba(0,0,0,.2)));
  color:var(--text);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent, #00f5ff) 55%, transparent),
              0 0 50px color-mix(in srgb, var(--accent, #00f5ff) 22%, transparent);
}
.suggestion-chip:hover::before { transform: translateX(120%); }
.suggestion-chip:active {
  transform: translateY(0) scale(.96);
  transition-duration: .06s;
}
@media (max-width: 768px) {
  .suggestion-chip { min-height: 36px; padding: 9px 16px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .suggestion-chip, .suggestion-chip::before, .suggestion-card::before
    { animation: none !important; transition: none !important; }
}

/* Ripple effect on click */
.suggestion-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent, #00f5ff);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.suggestion-chip.ripple::after {
  animation: chipRipple .4s ease-out;
}
@keyframes chipRipple {
  0%   { opacity: .25; transform: scale(.8); }
  100% { opacity: 0;   transform: scale(1.2); }
}

/* Selected state */
.suggestion-chip.selected {
  border-color: var(--accent, #00f5ff);
  background: var(--accent, #00f5ff)28;
  color: var(--accent, #00f5ff);
  box-shadow: 0 0 12px var(--accent, #00f5ff)33;
  pointer-events: none;
}
.suggestion-chip.selected::before {
  content: '✓ ';
  font-size: 9px;
}

/* Dimmed state for non-selected after a choice is made */
.suggestion-chips.answered .suggestion-chip:not(.selected) {
  opacity: .35;
  pointer-events: none;
  filter: grayscale(.6);
}
/* ── Collapsed state: show only the answer + a "Change" link ── */
/* Applied by JS after a chip is tapped so the card shrinks to a compact
   receipt and stops hogging vertical space on mobile. */
.suggestion-card.collapsed { padding: 6px 10px; margin: 4px 0 6px; }
.suggestion-card.collapsed .suggestion-header { margin-bottom: 2px; }
.suggestion-card.collapsed .suggestion-text { display: none; }
.suggestion-card.collapsed .suggestion-other-row { display: none !important; }
.suggestion-card.collapsed .suggestion-chip:not(.selected) { display: none; }
.suggestion-card.collapsed .suggestion-chip.selected {
  opacity: 1; pointer-events: none; filter: none;
}
.suggestion-change {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px dashed var(--muted, #999)66;
  background: transparent;
  color: var(--muted, #999);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
  letter-spacing: .04em;
}
.suggestion-change:hover {
  border-color: var(--accent, #00f5ff)66;
  color: var(--accent, #00f5ff);
  border-style: solid;
}

/* ── "Other..." chip (special styling) ── */
.suggestion-chip.chip-other {
  border-style: dashed;
  border-color: var(--muted, #666)44;
  color: var(--muted, #999);
  font-style: italic;
  font-weight: 600;
}
.suggestion-chip.chip-other:hover {
  border-color: var(--accent, #00f5ff)66;
  color: var(--text, #e0e0e0);
  border-style: solid;
}

/* ── Other input row ── */
.suggestion-other-row {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  animation: chipIn .2s ease-out;
}
.suggestion-other-row.open {
  display: flex;
}
.suggestion-other-input {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  border-radius: 16px;
  border: 1px solid var(--accent, #00f5ff)44;
  background: var(--surface-2, rgba(255,255,255,.04));
  color: var(--text, #e0e0e0);
  font-size: 10px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.suggestion-other-input:focus {
  border-color: var(--accent, #00f5ff)88;
  box-shadow: 0 0 6px var(--accent, #00f5ff)22;
}
.suggestion-other-input::placeholder {
  color: var(--muted, #666);
  font-style: italic;
}
.suggestion-other-send {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--accent, #00f5ff)66;
  background: var(--accent, #00f5ff)18;
  color: var(--accent, #00f5ff);
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: all .12s;
}
.suggestion-other-send:hover {
  background: var(--accent, #00f5ff)30;
  box-shadow: 0 0 8px var(--accent, #00f5ff)33;
}

/* ── Color variants ──
   Each variant re-scopes `--accent` so the glow, border, text, ripple
   and hover shadow all retune to the new hue in one shot. */
.suggestion-card.gold   { --accent: #ffd700; }
.suggestion-card.purple { --accent: #b44dff; }
.suggestion-card.pink   { --accent: #ff2d78; }
.suggestion-card.green  { --accent: #00ffa3; }
.suggestion-card.cyan   { --accent: #00f5ff; }
.suggestion-card.orange { --accent: #ff8c42; }
.suggestion-card.red    { --accent: #ff4d6d; }

/* ── Responsive: stack on narrow ── */
@media (max-width: 480px) {
  .suggestion-chips { gap: 4px; }
  .suggestion-chip { padding: 4px 9px; font-size: 9px; }
}
/* ── Mobile viewport cap: card must never eat the whole screen ── */
@media (max-width: 768px) {
  .suggestion-card {
    max-height: 32vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .suggestion-card.collapsed {
    max-height: none;
    overflow: visible;
  }
}
