/* Scan & Cook by AMart – podle AMart Brand Identity Guidelines (03.2026) */
:root {
  --red: #FF1B15;
  --orange: #FF9900;
  --beige: #FFFBF1;
  --brown: #581716;
  --line: #F2E3CF;
  --soft: #F6EAD8;
  --tint: #FFF4E0;
  --alert-bg: #FFE9E4;
  --alert: #7E002C;
  --ok: #006841;
  --white: #FFFFFF;
  --radius: 6px;
  --maxw: 860px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--beige);
  color: var(--brown);
  font-family: 'Parkinsans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
a { color: var(--brown); }
a:hover { color: var(--red); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.app { min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--beige); border-bottom: 1px solid var(--line); }
.topbar__inner { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__logo { height: 40px; width: auto; display: block; }
.brand__name { font-size: 17px; font-weight: 600; padding-left: 12px; border-left: 2px solid var(--line); white-space: nowrap; }
.btn-soft { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 14px; border: 0; border-radius: var(--radius); background: var(--soft); font-weight: 600; font-size: 15px; cursor: pointer; }
.btn-soft svg { width: 18px; height: 18px; stroke-width: 2.4; }
.btn-soft:hover { background: #F0DEC5; }

/* ---------- Chat ---------- */
.chat { flex: 1 1 auto; }
.chat__inner { max-width: var(--maxw); margin: 0 auto; padding: 24px 14px 24px; display: flex; flex-direction: column; gap: 20px; }

.msg { display: flex; gap: 10px; align-items: flex-start; }
.avatar { width: 32px; height: auto; flex: 0 0 auto; }
.msg--user { justify-content: flex-end; }
.msg--user .ubox { max-width: min(82%, 460px); display: flex; flex-direction: column; align-items: flex-end; }
.ububble { background: var(--orange); border-radius: var(--radius); padding: 11px 14px; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.ububble img { display: block; max-width: 220px; max-height: 220px; border-radius: 4px; margin-bottom: 8px; }
.tail { display: block; width: 20px; height: 9px; margin-right: 14px; }
.tail--left { margin-left: 14px; margin-right: 0; }

.bot-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-wrap: anywhere; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.status svg { width: 14px; height: 14px; stroke: var(--ok); stroke-width: 3; }
.card--refusal { font-size: 15px; }
.card--error { background: var(--alert-bg); border-color: #F3B9AC; color: var(--alert); font-weight: 500; }

/* Markdown v odpovědi */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h2 { font-size: 22px; line-height: 1.15; font-weight: 700; margin: 0 -16px 12px; padding: 14px 16px; background: var(--orange); }
.md > h2:first-child { margin-top: -14px; border-radius: var(--radius) var(--radius) 0 0; }
.md h3 { font-size: 16px; font-weight: 700; margin: 18px 0 6px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md strong { font-weight: 700; }
.md em { font-style: italic; }
.md .ai-note { display: inline-block; font-style: normal; font-size: 13px; font-weight: 600; color: var(--alert); }
.md .cite { font-size: 11px; font-weight: 600; text-decoration: none; background: var(--soft); border-radius: 3px; padding: 1px 5px; margin-left: 2px; vertical-align: 1px; }
.md h3.shop-h { display: flex; align-items: center; gap: 8px; }
.md h3.shop-h::before { content: ""; width: 18px; height: 18px; flex: 0 0 auto; background: url("mark.png") center / contain no-repeat; }
.md ul.shop-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.md ul.shop-list li { margin: 0; background: var(--tint); border-radius: var(--radius); padding: 10px 12px; font-size: 15px; }
.md ul.shop-list a { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--orange); }
.md ul.shop-list a:hover { color: var(--red); border-bottom-color: var(--red); }
.md ul.shop-list a::after { content: " ↗"; font-weight: 500; }
.sources { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sources summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: 6px; list-style: none; }
.sources summary::-webkit-details-marker { display: none; }
.sources summary::before { content: "▸"; transition: transform .15s; }
.sources[open] summary::before { transform: rotate(90deg); }
.sources[open] { gap: 6px; }
.sources a { text-decoration: none; overflow-wrap: anywhere; }
.sources a b { font-weight: 600; }

/* Typing */
.typing { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } }

/* Welcome */
.welcome .avatar { width: 40px; }
.welcome__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.bubble-hero { align-self: flex-start; position: relative; background: var(--orange); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 8px; }
.bubble-hero::after { content: ""; position: absolute; left: 18px; bottom: -10px; border: 11px solid transparent; border-bottom: 0; border-top-color: var(--orange); }
.bubble-hero h1 { margin: 0; font-size: clamp(26px, 6vw, 44px); line-height: 1.08; font-weight: 700; letter-spacing: -.3px; }
.welcome__text { margin: 0; font-size: 17px; max-width: 600px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; text-align: left; background: var(--white); border: 2px solid var(--orange); border-radius: var(--radius); padding: 9px 14px; font-size: 15px; font-weight: 500; cursor: pointer; }
.chip:hover { background: var(--tint); }
.chip:disabled { opacity: .5; cursor: default; }

/* ---------- Composer ---------- */
.composer { position: sticky; bottom: 0; z-index: 5; background: var(--beige); padding-bottom: env(safe-area-inset-bottom); }
.composer__inner { max-width: var(--maxw); margin: 0 auto; padding: 10px 12px 8px; }
.composer__form { display: flex; gap: 6px; align-items: center; background: var(--white); border: 2px solid var(--brown); border-radius: 8px; padding: 6px; }
.composer__form input[type=text] { flex: 1 1 auto; min-width: 0; height: 44px; border: 0; background: transparent; padding: 0 8px; font-size: 16px; }
.composer__form input[type=text]:focus { outline: none; }
.composer__form:focus-within { box-shadow: 0 0 0 3px rgba(255,153,0,.45); }
.composer__form input::placeholder { color: #8a5a55; }
.composer__note { margin: 6px 2px 0; font-size: 12px; line-height: 1.4; text-align: center; }
#quota { font-weight: 600; }
.icon-btn { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn--red { background: var(--red); color: var(--white); }
.icon-btn--orange { background: var(--orange); color: var(--brown); }
.icon-btn--dark { background: var(--brown); color: var(--beige); }
.icon-btn--ghost { background: rgba(255,251,241,.15); color: var(--beige); }
.icon-btn:disabled { opacity: .45; cursor: default; }

.preview { position: relative; display: inline-block; margin: 0 0 8px; }
.preview[hidden] { display: none; }
.preview img { display: block; height: 72px; width: auto; border-radius: var(--radius); border: 2px solid var(--orange); }
.preview__x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--brown); color: var(--beige); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.preview__x svg { width: 14px; height: 14px; stroke-width: 3; }

.stripes { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.stripes i { display: block; height: 8px; background: var(--red); }
.stripes i + i { background: var(--orange); }

/* ---------- Scanner ---------- */
.scanner { width: 100%; max-width: 520px; padding: 0; border: 0; border-radius: 8px; background: #2B0B0A; color: var(--beige); }
.scanner::backdrop { background: rgba(43, 11, 10, .75); }
.scanner__top { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 16px; font-weight: 600; }
.scanner__view { position: relative; aspect-ratio: 4 / 3; background: #000; }
.scanner__view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner__frame { position: absolute; inset: 22% 12%; border: 4px solid var(--orange); border-radius: var(--radius); }
.scanner__frame i { position: absolute; left: 8%; right: 8%; top: 50%; height: 3px; background: var(--red); }
.scanner__hint { margin: 0; padding: 12px 16px 16px; font-size: 14px; text-align: center; }

/* ---------- Větší obrazovky ---------- */
@media (min-width: 720px) {
  .chat__inner { padding: 40px 24px 28px; gap: 26px; }
  .avatar { width: 40px; }
  .welcome .avatar { width: 52px; }
  .card { padding: 18px 20px; }
  .md h2 { font-size: 28px; margin: 0 -20px 14px; padding: 18px 20px; }
  .md > h2:first-child { margin-top: -18px; }
  .composer__inner { padding: 12px 24px 10px; }
  .composer__note { font-size: 13px; }
  .brand__logo { height: 44px; }
  .brand__name { font-size: 20px; padding-left: 16px; }
}
@media (max-width: 420px) {
  .hide-sm { display: none; }
  .brand__name { font-size: 15px; }
}
