/* Asistent Auto AI — every colour is a variable here (7b.8); layout numbers from CLAUDE.md 13.0. */
:root {
  --bg: #0b0b0c;
  --bg-glow: rgba(255, 210, 31, 0.07);
  --surface: #141416;
  --surface-2: #1c1c20;
  --surface-3: #26262b;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #7a7a83;
  --accent: #ffd21f;
  --accent-hover: #ffdd55;
  --on-accent: #111111;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --radius: 20px;
  --page-zoom: 1;
  --gutter: clamp(16px, 5vw, 96px);
  --chat-compact-width: 460px;
  --grow: min(60px, calc(var(--gutter) - 16px));
  --shift: min(48px, max(0px, calc(var(--gutter) - 16px - var(--grow))));
  --ease: 0.35s ease;
  --send-size: 52px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1100px 620px at 85% 10%, var(--bg-glow), transparent 70%),
    radial-gradient(900px 600px at 0% 100%, rgba(255, 255, 255, 0.03), transparent 70%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Page bar (phones, chat closed) ---------- */
.topbar { display: none; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 700; font-size: 17px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---------- Presentation text ---------- */
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.intro h1 { margin: 0 0 14px; font-size: 27px; line-height: 1.15; letter-spacing: -0.01em; }
.lead { margin: 0 0 22px; font-size: 15px; line-height: 1.6; color: var(--muted); }
.stats { display: flex; gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; }
.stats li { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stats strong { display: block; font-size: 18px; color: var(--accent); }
.stats span { font-size: 12px; color: var(--muted); }
.features { margin: 0 0 22px; padding-left: 18px; font-size: 13px; line-height: 1.9; color: var(--muted); }
.features li::marker { color: var(--accent); }
.notice { margin: 0; padding: 12px 14px; border: 1px solid rgba(255, 210, 31, 0.3); border-radius: 12px; background: rgba(255, 210, 31, 0.06); font-size: 12px; line-height: 1.55; color: var(--muted); }
.notice strong { color: var(--accent); }

/* ---------- Chat window ---------- */
.chat {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--on-accent); flex: none; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { margin: 0; font-size: 16px; }
.status { margin: 2px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; }
.icon-button {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; font-size: 16px; line-height: 1;
}
.icon-button:hover { background: var(--surface-3); }

.chat-body { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.messages {
  margin: 0; padding: 16px; list-style: none; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-x: hidden;
}

.message { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.message p { margin: 0; }
.message ul { margin: 4px 0; padding-left: 20px; list-style: disc; }
.message.bot { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 6px; }
.message.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.message.welcome { max-width: 100%; width: 100%; }
.chat:not(.wide) .message.welcome:first-child { margin-top: 20px; }
.message a.phone { color: var(--accent); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip, .link-chip {
  padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(255, 210, 31, 0.55);
  background: transparent; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.chip:hover, .link-chip:hover { background: rgba(255, 210, 31, 0.12); }
.welcome .chips { flex-wrap: nowrap; }
.chat.wide .welcome .chips { flex-wrap: wrap; }
.welcome .chip { flex: 1; padding: 9px 8px; font-size: 13.5px; }

.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.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; } }

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px 16px; overflow-y: auto; overscroll-behavior: contain; }
.results-count { margin: 0; font-size: 14px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.card-photo { display: block; width: 100%; aspect-ratio: 1.15 / 1; object-fit: cover; background: var(--surface-3); border: 0; padding: 0; }
.card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; flex: 1; }
.card-title { margin: 0; font-size: 18px; font-weight: 700; }
.card-meta, .card-line { margin: 0; font-size: 14px; color: var(--muted); }
.card-price { margin: 2px 0; font-size: 26px; font-weight: 800; color: var(--accent); }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }

.accent-button, .ghost-button, .link-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 700; text-decoration: none;
}
.accent-button { border: 0; background: var(--accent); color: var(--on-accent); }
.accent-button:hover { background: var(--accent-hover); }
.ghost-button, .link-button { border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
.ghost-button:hover, .link-button:hover { background: var(--surface-3); }
.card-actions > * { flex: 1; white-space: nowrap; padding-left: 8px; padding-right: 8px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pager-info { font-size: 13px; color: var(--muted); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 8px; }
.empty-art { width: min(240px, 80%); height: auto; }
.empty-title { margin: 6px 0 0; font-size: 18px; font-weight: 700; }
.empty-tip { margin: 0; font-size: 14px; color: var(--muted); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

/* ---------- Details sheet ---------- */
.details { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); z-index: 2; }
.details-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.details-top h3 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-inner { padding: 14px 16px 24px; }
.gallery { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface-3); aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.55); color: var(--white); font-size: 24px; line-height: 1;
}
.gallery-arrow.prev { left: 10px; }
.gallery-arrow.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: none; width: 74px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.thumbs button.active { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.details-name { margin: 14px 0 2px; font-size: 20px; }
.details-price { margin: 0 0 12px; font-size: 26px; font-weight: 800; color: var(--accent); }
.details-cta { display: flex; gap: 8px; flex-wrap: wrap; }
.details-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 6px; }
.details-nav button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; font-size: 13px; }
.details-section { padding-top: 14px; }
.details-section h4 { margin: 0 0 8px; font-size: 15px; color: var(--accent); }
.rows { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; text-align: right; font-weight: 600; }
.details-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* ---------- Composer ---------- */
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 26px 16px 44px; border-top: 1px solid var(--line); }
.composer textarea {
  flex: 1; height: auto; resize: none; padding: 14px; font-size: 17px; line-height: 1.4;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--text);
}
.composer textarea::placeholder { color: var(--faint); }
.send {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  height: var(--send-size); padding: 0 18px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent); font-weight: 700;
}
.send .send-label { color: var(--on-accent); }
.send:hover:not(:disabled) { background: var(--accent-hover); }
/* Round send button: phones and the compact desktop chat (one rule, class set by the page). */
.round-send .send { width: var(--send-size); padding: 0; border-radius: 50%; }
.round-send .send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Reopen button + page scroll button ---------- */
.reopen {
  position: fixed; right: 20px; bottom: 20px; z-index: 20; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-weight: 700; box-shadow: var(--shadow); animation: pop-in 0.3s ease;
}
@keyframes pop-in { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.scroll-toggle {
  display: none; position: fixed; right: 6px; top: 50%; z-index: 20; width: 36px; height: 36px; margin-top: -18px;
  border: 2px solid var(--white); border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-size: 18px; font-weight: 800; line-height: 1; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* ---------- Desktop (≥ 980 px) ---------- */
@media (min-width: 980px) {
  html, body { height: 100%; overflow: hidden; }
  .page { zoom: var(--page-zoom); height: calc(100vh / var(--page-zoom)); max-width: 1560px; margin: 0 auto; padding: 0 var(--gutter); }
  .layout { display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.25fr); gap: 48px; align-items: center; height: 100%; }
  .intro { max-width: 520px; transform: translate(calc(-1 * min(3vw, 60px)), calc(-1 * min(2.5vh, 28px))); }
  .chat {
    justify-self: end; width: var(--chat-compact-width); margin-right: max(0px, calc((100% - var(--chat-compact-width)) / 2));
    height: min(700px, calc((100vh - 140px) / var(--page-zoom)));
    transition: width var(--ease), height var(--ease), margin-right var(--ease);
  }
  .chat.wide {
    width: calc(100% + var(--grow)); margin-right: calc(-1 * (var(--grow) + var(--shift)));
    height: min(780px, calc((100vh - 140px) / var(--page-zoom)));
  }
  .chat.wide .chat-body { grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr); }
  .chat.wide .results, .chat.wide .details { border-left: 1px solid var(--line); }
  .chat.wide .details { position: absolute; inset: 0 0 0 auto; width: 60%; }
  .chat:not(.wide) .details { inset: 0; }
}

/* ---------- Phones and tablets (< 980 px): a messaging app ---------- */
@media (max-width: 979.98px) {
  :root { --send-size: 44px; }
  html { min-height: 100%; }
  html.chat-open, html.chat-open body { overflow: hidden; }
  html:not(.chat-open) .topbar { display: flex; }
  html.chat-open .scroll-toggle { display: grid; place-items: center; }
  .layout { display: flex; flex-direction: column; }
  .chat { order: 0; height: calc(100dvh - 24px); margin: 12px; }
  .intro { order: 1; padding: 28px 16px 110px; }
  .results { padding: 0; overflow: visible; }
  .result-block { list-style: none; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .card { flex-direction: row; }
  .card-photo { width: 36%; aspect-ratio: auto; flex: none; }
  .card-body { padding: 10px 12px; gap: 2px; min-width: 0; }
  .card-title { font-size: 14px; }
  .card-meta, .card-line { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-price { font-size: 17px; margin: 2px 0; }
  .card-actions { padding-top: 6px; gap: 6px; }
  .card-actions .accent-button, .card-actions .link-button { padding: 6px 8px; font-size: 12.5px; border-radius: 10px; }
  .pager .ghost-button { padding: 7px 12px; font-size: 13px; }
  .composer { padding: 10px 12px 44px; align-items: center; }
  .composer textarea { height: 44px; padding: 9px 14px; font-size: 16px; line-height: 1.5; }
  .welcome .chip { font-size: 12.5px; padding: 8px 6px; }
  .chat-head { padding: 10px 12px; }
  .details { inset: 0; }
  .rows { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 559.98px) {
  .chat { height: 100dvh; margin: 0; border-radius: 0; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
