/* Asistent Moto AI — MOTOLAND. Colours of the dealer's site (5c.11); layout as decided in CLAUDE.md 13.0. */
:root {
  --accent: #ffcd2a;
  --accent-dark: #e6b400;
  --ink: #2b2a29;
  --ink-soft: #616161;
  --page-top: #34322f;
  --page-bottom: #171615;
  --surface: #ffffff;
  --surface-soft: #f5f6f8;
  --line: #e6e6e6;
  --price: #1a96c6;
  --discount: #d93025;
  --on-dark: #f4f1ea;
  --on-dark-soft: #c9c4ba;
  --radius: 22px;
  --radius-small: 12px;
  --gutter: clamp(16px, 5vw, 96px);
  --page-zoom: 1;
  --screen-h: calc(100vh / var(--page-zoom));
  --chat-w: 460px;
  --chat-h: min(700px, calc(var(--screen-h) - 140px));
  --chat-h-wide: min(780px, calc(var(--screen-h) - 140px));
  --extend: min(108px, calc(var(--gutter) - 16px));
  --widen: min(60px, var(--extend));
  --speed: 0.35s;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: radial-gradient(circle at 15% 10%, rgba(255, 205, 42, 0.14), transparent 30rem), linear-gradient(160deg, var(--page-top), var(--page-bottom)); background-attachment: fixed; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- page: intro on the left, chat on the right, both centred vertically ---------- */
.page {
  zoom: var(--page-zoom);
  max-width: 1560px;
  height: var(--screen-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 32px;
}
.intro { color: var(--on-dark); transform: translate(calc(-1 * min(3vw, 60px)), calc(-1 * min(2.5vh, 28px))); max-width: 520px; }
.intro-brand { margin: 0 0 6px; font-weight: 800; letter-spacing: 0.18em; color: var(--accent); font-size: 13px; }
.intro-title { margin: 0 0 12px; font-size: 27px; line-height: 1.15; }
.intro-text { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--on-dark-soft); }
.intro-figures { display: flex; gap: 22px; list-style: none; padding: 0; margin: 0 0 18px; }
.intro-figures strong { display: block; font-size: 18px; color: var(--accent); }
.intro-figures span { font-size: 12px; color: var(--on-dark-soft); }
.intro-list { margin: 0 0 18px; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--on-dark); }
.intro-note { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, 0.06); border-radius: 8px; font-size: 12px; line-height: 1.5; color: var(--on-dark-soft); }

/* ---------- chat window ---------- */
.chat {
  justify-self: end;
  width: var(--chat-w);
  height: var(--chat-h);
  margin-right: max(0px, calc((100% - var(--chat-w)) / 2));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: width var(--speed) ease, height var(--speed) ease, margin-right var(--speed) ease;
}
.chat.is-wide { width: calc(100% + var(--widen)); height: var(--chat-h-wide); margin-right: calc(-1 * var(--extend)); }
.chat-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--ink); color: var(--on-dark); }
.chat-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 205, 42, 0.25); }
.chat-title { flex: 1; margin: 0; font-size: 17px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: var(--on-dark); font-size: 17px; }
.icon-button:hover { background: rgba(255, 255, 255, 0.2); }
.icon-button-light { background: var(--surface-soft); color: var(--ink); }
.icon-button-light:hover { background: var(--line); }
@media (min-width: 980px) { .chat.has-sheet .results { display: none; } }
.chat-body { flex: 1; min-height: 0; display: flex; position: relative; background: var(--surface-soft); }

/* ---------- messages ---------- */
.messages { flex: 1 1 auto; min-width: 0; margin: 0; padding: 16px; list-style: none; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; }
.message { max-width: 85%; padding: 11px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.message p { margin: 0; }
.message ul { margin: 0; padding-left: 20px; list-style: disc; }
.message-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.message-user { align-self: flex-end; background: var(--ink); color: var(--on-dark); border-bottom-right-radius: 6px; }
.message-welcome { max-width: 100%; }
.chat:not(.is-wide) .messages > .message:first-child { margin-top: 20px; }
.message a { color: var(--price); font-weight: 600; text-decoration: none; }
.notice { align-self: center; font-size: 12px; color: var(--ink-soft); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.welcome-actions .button { flex: 1 1 auto; padding: 9px 8px; font-size: 13px; white-space: nowrap; }
.typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
.button:hover { border-color: var(--ink); }
.button-primary { background: var(--accent); border-color: var(--accent); }
.button-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ---------- results panel (desktop: right of the messages) ---------- */
.results { flex: 0 0 58%; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); }
.cards { flex: 1; min-height: 0; margin: 0; padding: 16px; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start; overflow-y: auto; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.card-photo { position: relative; aspect-ratio: 1.15; background: var(--surface-soft); }
.card-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.badge { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--ink); color: var(--accent); }
.badge-discount { left: auto; right: 10px; background: var(--discount); color: #fff; }
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.card-title { margin: 0; font-size: 18px; line-height: 1.25; }
.card-price { margin: 0; font-size: 26px; font-weight: 800; color: var(--price); }
.card-price small { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.card-price s { color: var(--ink-soft); font-weight: 400; margin-left: 6px; font-size: 14px; white-space: nowrap; }
.card-meta { margin: 0; font-size: 14px; color: var(--ink-soft); }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.card-actions .button { flex: 1 1 auto; padding: 8px 10px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager-info { font-size: 13px; color: var(--ink-soft); }

/* ---------- zero results (13.8) ---------- */
.zero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.zero-art svg { width: 190px; height: auto; }
.zero-title { margin: 0; font-size: 19px; }
.zero-advice { margin: 0; font-size: 14px; color: var(--ink-soft); }
.zero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

/* ---------- product sheet (13.4) ---------- */
.sheet { position: relative; flex: 0 0 58%; min-width: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-left: 1px solid var(--line); padding: 16px; }
.sheet-top { display: flex; align-items: flex-start; gap: 10px; }
.sheet-title { flex: 1; margin: 0; font-size: 20px; }
.gallery { position: relative; margin-top: 12px; border-radius: 14px; overflow: hidden; background: var(--surface-soft); aspect-ratio: 1.5; }
.gallery img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(43, 42, 41, 0.75); color: #fff; font-size: 22px; line-height: 1; }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.thumbs { display: flex; gap: 8px; margin: 10px 0 0; padding: 0 0 4px; list-style: none; overflow-x: auto; overscroll-behavior: contain; }
.thumbs button { flex: 0 0 64px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--surface-soft); }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-price { margin: 14px 0 4px; }
.sheet-jumps { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sheet-jumps .button { padding: 7px 12px; font-size: 13px; }
.sheet-section { margin-top: 18px; }
.sheet-section h4 { margin: 0 0 8px; font-size: 16px; }
.specs { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.specs div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; break-inside: avoid; }
.specs dt { color: var(--ink-soft); }
.specs dd { margin: 0; text-align: right; font-weight: 600; }
.sheet-text p { margin: 0 0 6px; font-size: 14px; line-height: 1.55; }

/* ---------- composer ---------- */
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 26px 16px 44px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { flex: 1; height: auto; resize: none; padding: 14px; font: inherit; font-size: 17px; line-height: 1.4; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); color: var(--ink); }
.composer textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.send-button { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; min-width: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: #fff; }
.send-icon { width: 24px; height: 24px; }
.send-plane { fill: #fff; }
.send-fold { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.send-text { display: none; }
.chat.is-wide .send-button { border-radius: 999px; padding: 0 20px; }
.chat.is-wide .send-text { display: inline; font-weight: 700; }

/* ---------- reopen button and page scroll button ---------- */
.reopen { position: fixed; right: 20px; bottom: 20px; display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--ink); font-weight: 800; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); animation: pop var(--speed) ease; z-index: 20; }
.reopen svg { width: 22px; height: 22px; fill: var(--ink); }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.page-scroll { position: fixed; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 2px solid #fff; border-radius: 50%; background: var(--accent); color: var(--ink); font-weight: 800; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); z-index: 15; }
.chat.is-closed { display: none; }

/* ---------- phone and tablet: like a messaging app (13.0) ---------- */
@media (max-width: 979.98px) {
  html { height: auto; min-height: 100%; }
  body { height: auto; }
  html.chat-open, html.chat-open body { overflow: hidden; }
  .page { zoom: 1; height: auto; display: flex; flex-direction: column; padding: 16px; gap: 24px; }
  .intro { order: 2; transform: none; max-width: none; padding-bottom: 90px; }
  .chat, .chat.is-wide { order: 1; width: 100%; margin: 0; height: calc(100dvh - 32px); justify-self: auto; transition: none; }
  .chat-body { display: block; overflow: hidden; }
  .messages { height: 100%; }
  .results { flex: none; border: 0; background: transparent; }
  .messages .results { align-self: stretch; }
  .cards { padding: 0; grid-template-columns: 1fr; gap: 10px; overflow: visible; }
  .card { flex-direction: row; }
  .card-photo { flex: 0 0 36%; aspect-ratio: auto; }
  .card-body { padding: 8px 10px; gap: 3px; min-width: 0; }
  .card-title { font-size: 14px; }
  .card-price { font-size: 17px; }
  .card-price small { font-size: 11px; }
  .card-meta { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-actions .button { padding: 6px 8px; font-size: 12px; }
  .badge { top: 6px; left: 6px; font-size: 10px; padding: 2px 7px; }
  .pager { padding: 8px 0 0; border: 0; }
  .pager .button { padding: 6px 12px; font-size: 13px; }
  .zero { padding: 12px 0; }
  .zero-art svg { width: 140px; }
  .sheet { position: absolute; inset: 0; border: 0; z-index: 5; }
  .specs { grid-template-columns: 1fr; }
  .composer { padding: 10px 12px 44px; align-items: center; }
  .composer textarea { height: 44px; padding: 9px 12px; font-size: 16px; }
  .send-button, .chat.is-wide .send-button { width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 50%; }
  .chat.is-wide .send-text { display: none; }
  .welcome-actions .button { padding: 7px 6px; font-size: 12px; }
}
@media (max-width: 559.98px) {
  .page { padding: 0; gap: 16px; }
  .intro { padding: 0 16px 90px; }
  .chat, .chat.is-wide { height: 100dvh; border-radius: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chat, .reopen { transition: none; animation: none; }
  .typing span { animation: none; opacity: 0.6; }
}
