/* ============================================================
   Aura chat — AI illatválasztó asszisztens (#B-037)
   Tokenek: css/design-system.css (--ds-*). Mobil-first: alsó lap (bottom sheet),
   desktopon jobb alsó panel. Rétegzés: keresőpanel 2000 < chat 2100.
   ============================================================ */

.ac-root { position: fixed; inset: 0; z-index: 2100; pointer-events: none; }
.ac-backdrop {
  position: absolute; inset: 0;
  background: rgba(26, 22, 18, 0.38);
  opacity: 0; transition: opacity .25s ease;
}
.ac-root.ac-open { pointer-events: auto; }
.ac-root.ac-open .ac-backdrop { opacity: 1; }

.ac-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 88dvh; max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--ds-bg, #FEFCFA);
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -0.5rem 2rem rgba(26, 22, 18, 0.18);
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
}
.ac-root.ac-open .ac-sheet { transform: none; }
body.ac-open { overflow: hidden; }

/* fejléc — az AI-jelölés kötelező, itt látszik mindig */
.ac-head {
  display: flex; align-items: center; gap: .625rem;
  padding: .75rem .875rem;
  background: var(--ds-bg-card, #fff);
  border-bottom: 1px solid var(--ds-border, rgba(26,22,18,.18));
  flex: 0 0 auto;
}
.ac-head__avatar { width: 40px; height: 40px; flex: 0 0 40px; }
.ac-head__title { flex: 1; min-width: 0; line-height: 1.25; }
.ac-head__title strong { font-size: 1rem; color: var(--ds-text, #1a1612); }
.ac-badge {
  display: inline-block; margin-left: .375rem; vertical-align: 1px;
  font-size: .625rem; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--ds-gold, #c49a4a); background: var(--ds-gold-subtle, rgba(196,154,74,.08));
  border: 1px solid var(--ds-gold-glow, rgba(196,154,74,.15));
  border-radius: var(--ds-radius-full, 9999px); padding: .1rem .45rem;
}
.ac-head__sub { display: block; font-size: .75rem; color: var(--ds-text-muted, rgba(26,22,18,.42)); margin-top: .125rem; }
.ac-head__sub a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ac-close {
  flex: 0 0 auto; width: 40px; height: 40px; border: 0; background: transparent;
  color: var(--ds-text-secondary, rgba(26,22,18,.65)); font-size: 1.5rem; line-height: 1; cursor: pointer;
  border-radius: 50%;
}
.ac-close:hover { background: var(--ds-bg-warm, #F5F0E9); }

/* üzenetlista */
.ac-list {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: .75rem .875rem .25rem;
  scroll-behavior: smooth;
}
.ac-msg { display: flex; gap: .5rem; margin: 0 0 .75rem; align-items: flex-start; }
.ac-msg__avatar { width: 36px; height: 36px; flex: 0 0 36px; margin-top: .125rem; }
.ac-msg__avatar .aura-svg { width: 36px; height: 36px; }
.ac-bubble {
  position: relative; max-width: 88%;
  padding: .625rem .75rem;
  border-radius: .875rem;
  font-size: .9375rem; line-height: 1.5; color: var(--ds-text, #1a1612);
  word-wrap: break-word;
}
.ac-bubble p { margin: 0 0 .5rem; }
.ac-bubble p:last-child { margin-bottom: 0; }
.ac-msg--a .ac-bubble {
  background: var(--ds-bg-card, #fff);
  border: 1px solid var(--ds-border, rgba(26,22,18,.18));
  box-shadow: 0 1px 4px rgba(0,0,0,.04), 2px 3px 0 rgba(61,46,34,.1);
}
.ac-msg--a .ac-bubble::before {
  content: ''; position: absolute; left: -7px; top: 14px; width: 12px; height: 12px;
  background: var(--ds-bg-card, #fff);
  border-left: 1px solid var(--ds-border, rgba(26,22,18,.18));
  border-bottom: 1px solid var(--ds-border, rgba(26,22,18,.18));
  transform: rotate(45deg);
}
.ac-msg--a.ac-msg--err .ac-bubble { color: var(--ds-text-secondary, rgba(26,22,18,.65)); }
.ac-msg--u { justify-content: flex-end; }
.ac-msg--u .ac-bubble { background: var(--ds-bg-warm, #F5F0E9); max-width: 84%; }

/* gépel… */
.ac-typing { display: inline-flex; align-items: center; gap: .5rem; color: var(--ds-text-secondary, rgba(26,22,18,.65)); font-size: .875rem; }
.ac-typing__dots { display: inline-flex; gap: 3px; }
.ac-typing__dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ds-gold-light, #dbb56c);
  animation: acDot 1.2s infinite ease-in-out;
}
.ac-typing__dots i:nth-child(2) { animation-delay: .15s; }
.ac-typing__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes acDot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* termékkártyák */
.ac-cards {
  display: flex; gap: .625rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: .25rem 0 .5rem 2.75rem; margin: -0.25rem 0 .5rem;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.ac-cards::-webkit-scrollbar { display: none; }
.ac-card {
  flex: 0 0 84%; scroll-snap-align: start;
  display: grid; grid-template-columns: 64px 1fr; gap: .375rem .625rem;
  background: var(--ds-bg-card, #fff);
  border: 1px solid var(--ds-border, rgba(26,22,18,.18));
  border-radius: var(--ds-radius-lg, 16px);
  padding: .625rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.04), 2px 3px 0 rgba(61,46,34,.08);
}
.ac-card__link { display: contents; color: inherit; text-decoration: none; }
.ac-card__img {
  width: 64px; height: 64px; object-fit: contain; border-radius: .5rem;
  background: var(--ds-bg-warm, #F5F0E9); grid-row: span 3;
}
.ac-card__kod { font-size: .6875rem; letter-spacing: .4px; text-transform: uppercase; color: var(--ds-gold, #c49a4a); font-weight: 600; }
.ac-card__nev { font-size: .9375rem; font-weight: 600; line-height: 1.25; color: var(--ds-text, #1a1612); }
.ac-card__meta { font-size: .75rem; color: var(--ds-text-muted, rgba(26,22,18,.42)); }
.ac-card__row { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .125rem; }
.ac-card__ar { font-weight: 700; font-size: 1rem; color: var(--ds-text, #1a1612); }
.ac-card__ar--akcios { color: var(--ds-cta, #D2553B); }
.ac-card__ar del { font-weight: 400; font-size: .8125rem; color: var(--ds-text-muted, rgba(26,22,18,.42)); margin-left: .25rem; }
.ac-stock { font-size: .75rem; font-weight: 600; }
.ac-stock--ok { color: var(--ds-success-dark, #2a8f2a); }
.ac-stock--uton { color: var(--ds-warning, #d57b36); }
.ac-stock--hiany { color: var(--ds-text-muted, rgba(26,22,18,.42)); }
.ac-card__btns { grid-column: 1 / -1; display: flex; gap: .5rem; margin-top: .25rem; }
.ac-sheet .ac-card .ac-btn {
  display: inline-flex !important; align-items: center; justify-content: center; gap: .25rem;
  flex: 1 1 0; min-height: 40px; margin: 0 !important; padding: .5rem .625rem !important;
  border-radius: var(--ds-radius-md, 12px) !important;
  font-size: .8125rem !important; font-weight: 600; line-height: 1.2 !important;
  text-decoration: none !important; cursor: pointer; white-space: nowrap;
  box-shadow: none !important; width: auto !important;
}
.ac-sheet .ac-card .ac-btn--cta { background: var(--ds-cta, #D2553B) !important; color: #fff !important; border: 0 !important; }
.ac-sheet .ac-card .ac-btn--cta:hover { background: var(--ds-cta-hover, #c04a33) !important; }
.ac-sheet .ac-card .ac-btn--ghost { background: #fff !important; color: var(--ds-text, #1a1612) !important; border: 1px solid var(--ds-border-input, rgba(26,22,18,.28)) !important; }
.ac-sheet .ac-card .ac-btn--done { background: var(--ds-success-light, #e7f6e7) !important; color: var(--ds-success-dark, #2a8f2a) !important; border: 1px solid var(--ds-success-border, #bfe3bf) !important; pointer-events: none; }

/* gyorsválasz-gombok */
.ac-chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: .25rem .875rem .5rem; }
.ac-chips:empty { display: none; }
.ac-chips--inline { padding: .625rem 0 0; }
.ac-chip {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--ds-gold-light, #dbb56c); background: var(--ds-bg-card, #fff);
  color: var(--ds-text, #1a1612); border-radius: var(--ds-radius-full, 9999px);
  padding: .5rem .875rem; min-height: 40px; font-size: .875rem; line-height: 1.2; font-family: inherit;
  cursor: pointer; text-align: left; width: auto;
  transition: background .15s, border-color .15s;
}
.ac-chip:hover, .ac-chip:focus-visible { background: var(--ds-gold-subtle, rgba(196,154,74,.08)); border-color: var(--ds-gold, #c49a4a); outline: none; }

/* visszajelzés */
.ac-fb { display: flex; align-items: center; gap: .375rem; margin: -0.375rem 0 .75rem 2.75rem; }
.ac-fb button {
  appearance: none; border: 1px solid var(--ds-border, rgba(26,22,18,.18)); background: transparent;
  border-radius: var(--ds-radius-full, 9999px); min-width: 34px; height: 28px; padding: 0 .5rem;
  font-size: .8125rem; color: var(--ds-text-muted, rgba(26,22,18,.42)); cursor: pointer; font-family: inherit;
}
.ac-fb button:hover { border-color: var(--ds-gold-light, #dbb56c); color: var(--ds-text, #1a1612); }
.ac-fb button.on { border-color: var(--ds-gold, #c49a4a); color: var(--ds-gold, #c49a4a); }
.ac-fb__thx { font-size: .75rem; color: var(--ds-text-muted, rgba(26,22,18,.42)); }

/* beviteli sor */
.ac-form {
  display: flex; gap: .5rem; align-items: center;
  padding: .625rem .875rem .75rem;
  border-top: 1px solid var(--ds-border, rgba(26,22,18,.18));
  background: var(--ds-bg-card, #fff);
  flex: 0 0 auto;
}
.ac-sheet .ac-input {
  flex: 1 1 auto; min-width: 0; width: 100%; height: 44px; margin: 0;
  border: 1px solid var(--ds-border-input, rgba(26,22,18,.28)); border-radius: var(--ds-radius-md, 12px);
  padding: 0 .75rem; font-size: 1rem; font-family: inherit; color: var(--ds-text, #1a1612); background: #fff;
}
.ac-sheet .ac-input:focus { outline: none; border-color: var(--ds-gold, #c49a4a); box-shadow: 0 0 0 3px var(--ds-gold-glow, rgba(196,154,74,.15)); }
.ac-send {
  flex: 0 0 auto; height: 44px; padding: 0 1rem; border: 0; cursor: pointer; font-family: inherit;
  background: var(--ds-header-accent, #30210d); color: var(--ds-header-nav-color, #f6c788);
  border-radius: var(--ds-radius-md, 12px); font-weight: 600; font-size: .875rem; line-height: normal;
}
.ac-send:disabled { opacity: .5; cursor: default; }

/* visszatérő pill (van beszélgetés, a lap zárva) */
.ac-pill {
  position: fixed; right: 1rem; bottom: calc(4.75rem + env(safe-area-inset-bottom)); z-index: 1500;
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--ds-bg-card, #fff); border: 1px solid var(--ds-gold-light, #dbb56c);
  border-radius: var(--ds-radius-full, 9999px); padding: .25rem .875rem .25rem .25rem;
  box-shadow: 0 2px 10px rgba(26,22,18,.14); cursor: pointer; font: inherit; font-size: .8125rem; color: var(--ds-text, #1a1612);
}
.ac-pill .aura-svg { width: 32px; height: 32px; }

/* termékoldali belépő blokk */
.pd-aura-chat {
  margin: .875rem 0 .25rem; padding: .75rem;
  background: var(--ds-bg-card, #fff); border: 1px solid var(--ds-border, rgba(26,22,18,.18));
  border-radius: var(--ds-radius-lg, 16px);
  box-shadow: 0 1px 4px rgba(0,0,0,.04), 2px 3px 0 rgba(61,46,34,.08);
}
.pd-aura-chat__head { display: flex; gap: .625rem; align-items: center; cursor: pointer; }
.pd-aura-chat__avatar { width: 40px; height: 40px; flex: 0 0 40px; }
.pd-aura-chat__text strong { display: block; font-size: .9375rem; line-height: 1.3; color: var(--ds-text, #1a1612); }
.pd-aura-chat__text span { display: block; font-size: .75rem; color: var(--ds-text-muted, rgba(26,22,18,.42)); margin-top: .125rem; }

/* keresőpanel: „kérdezd Aurát" sor az input alatt */
.ac-ask-link {
  display: inline-flex; align-items: center; gap: .375rem; margin-top: .5rem;
  font-size: .8125rem; color: var(--ds-text-secondary, rgba(26,22,18,.65)); cursor: pointer;
  background: none; border: 0; padding: 0; font-family: inherit; text-decoration: underline; text-underline-offset: 3px;
}

/* desktop: jobb alsó panel, nincs sötétítés */
@media (min-width: 769px) {
  .ac-root { inset: auto 0 0 auto; width: 0; height: 0; }
  .ac-backdrop { display: none; }
  .ac-sheet {
    left: auto; right: 1.5rem; bottom: 1.5rem;
    width: 400px; height: min(680px, 86vh); max-height: 86vh;
    border-radius: 1.25rem;
    box-shadow: 0 1rem 3rem rgba(26,22,18,.22);
    transform: translateY(1.5rem); opacity: 0; transition: transform .25s ease, opacity .2s ease;
  }
  .ac-root.ac-open .ac-sheet { transform: none; opacity: 1; }
  body.ac-open { overflow: auto; }
  .ac-cards { flex-direction: column; overflow: visible; padding-left: 2.75rem; }
  .ac-card { flex: 1 1 auto; }
  .ac-pill { bottom: 1.5rem; }
}

/* ---------- mobil: teljes képernyő + nagyobb betűk (2026-09-25, tulaj kérése) ----------
   Az alap mobil gyökérméret 15px (responsive.css) → 1.0667rem ≈ 16px. Az input min. 16px,
   különben iOS ráközelít fókuszáláskor. */
@media (max-width: 768px) {
  .ac-sheet {
    top: 0; height: 100dvh; max-height: 100dvh;
    border-radius: 0; box-shadow: none;
    padding-top: env(safe-area-inset-top);
  }
  .ac-head { padding: .625rem .875rem; }
  .ac-head__title strong { font-size: 1.2rem; }
  .ac-head__sub { font-size: .875rem; }
  .ac-list { padding: 1rem 1rem .5rem; }
  .ac-bubble { font-size: 1.0667rem; line-height: 1.55; max-width: 90%; }
  .ac-msg--u .ac-bubble { max-width: 86%; }
  .ac-typing { font-size: 1rem; }
  .ac-card { flex-basis: 88%; grid-template-columns: 72px 1fr; }
  .ac-card__img { width: 72px; height: 72px; }
  .ac-card__kod { font-size: .8rem; }
  .ac-card__nev { font-size: 1.0667rem; }
  .ac-card__meta, .ac-stock { font-size: .875rem; }
  .ac-card__ar { font-size: 1.15rem; }
  .ac-sheet .ac-card .ac-btn { font-size: .95rem !important; min-height: 44px; }
  .ac-chip { font-size: 1rem; min-height: 44px; padding: .55rem 1rem; }
  .ac-fb button { font-size: .95rem; height: 32px; min-width: 40px; }
  .ac-fb__thx { font-size: .875rem; }
  .ac-sheet .ac-input { font-size: max(16px, 1.0667rem); height: 48px; }
  .ac-send { font-size: 1rem; height: 48px; }
  .pd-aura-chat__text strong { font-size: 1.0667rem; }
  .pd-aura-chat__text span { font-size: .875rem; }
  .ac-ask-link { font-size: .95rem; }
}

/* kosárba után: a gomb azonnal „kész" állapotú, a .pd-cta :active/:focus/:hover állapota ne írja felül */
.ac-sheet .ac-card .ac-btn--done,
.ac-sheet .ac-card .ac-btn--done:hover,
.ac-sheet .ac-card .ac-btn--done:focus,
.ac-sheet .ac-card .ac-btn--done:active {
  background: var(--ds-success-light, #e7f6e7) !important; color: var(--ds-success-dark, #2a8f2a) !important;
  border: 1px solid var(--ds-success-border, #bfe3bf) !important; transform: none !important; box-shadow: none !important;
  outline: none;
}
