/* Culorile, într-un singur loc: roșul site-ului cu negru și alb (5c.10). */
:root {
  --accent: #d51e25;
  --accent-dark: #a9161c;
  --accent-soft: #fdeced;
  --ink: #141416;
  --muted: #6c6c73;
  --line: #e7e7ea;
  --soft: #f4f4f6;
  --surface: #ffffff;
  --bg-top: #121214;
  --bg-bottom: #2a0b0e;
  --on-dark: #f6f6f7;
  --on-dark-muted: #c9c9ce;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --side: clamp(16px, 5vw, 96px);
  --page-zoom: 1;
  --ease: 0.45s ease;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(160deg, var(--bg-top) 0%, var(--bg-top) 45%, var(--bg-bottom) 100%) fixed; color: var(--on-dark); }
button, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Textul de prezentare ---------- */
.intro h1 { margin: 0 0 14px; font-size: 27px; line-height: 1.2; }
.intro-text { margin: 0 0 22px; font-size: 15px; line-height: 1.55; color: var(--on-dark-muted); max-width: 46ch; }
.intro-stats { display: flex; gap: 28px; margin: 0 0 22px; }
.intro-stats div { display: flex; flex-direction: column-reverse; }
.intro-stats dd { margin: 0; font-size: 18px; font-weight: 700; color: #fff; }
.intro-stats dt { font-size: 12px; color: var(--on-dark-muted); }
.intro-list { margin: 0 0 22px; padding-left: 18px; font-size: 13px; line-height: 1.8; color: var(--on-dark-muted); }
.intro-list li::marker { color: var(--accent); }
.intro-note { margin: 0; padding: 10px 12px; max-width: 46ch; font-size: 12px; line-height: 1.5; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, 0.06); border-radius: 6px; color: var(--on-dark-muted); }
.intro-note strong { color: #fff; }

/* ---------- Chatul ---------- */
.chat { display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; flex: none; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { margin: 0; font-size: 16px; }
.chat-title p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 17px; line-height: 1; flex: none; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn-dark { background: rgba(20, 20, 22, 0.75); color: #fff; border-color: transparent; }

.chat-body { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
.messages { grid-area: main; list-style: none; margin: 0; padding: 16px 14px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.msg p { margin: 0; }
.msg ul { margin: 0; padding-left: 20px; list-style: disc; }
.msg-bot { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.msg-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg-welcome { max-width: 100%; }
.chat:not(.is-wide) .msg:first-child { margin-top: 20px; }
.msg-links, .welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-links a { font-size: 13px; font-weight: 600; color: var(--accent-dark); text-decoration: none; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.msg a[href^="tel:"] { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-dark); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip:hover { background: var(--accent-soft); }
.chip:disabled { opacity: 0.5; cursor: default; }
.typing { display: flex; gap: 5px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); 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; }
.msg-slow { align-self: flex-start; margin-top: -4px; font-size: 13px; color: var(--muted); }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- Butoane ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--soft); }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Rezultatele ---------- */
.panel { grid-area: side; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px; background: var(--surface); }
.results-count { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); display: flex; }
.card-photo { padding: 0; border: 0; background: var(--soft); display: block; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-info { padding: 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.card-title { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price { margin: 0; font-weight: 800; color: var(--accent-dark); }
.card-price s, .detail-price s { color: var(--muted); font-weight: 500; font-size: 0.6em; margin-left: 4px; }
.card-data { margin: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-badge { margin: 0; align-self: flex-start; font-size: 12px; font-weight: 600; color: #1d6b3a; background: #e8f5ed; padding: 2px 8px; border-radius: 999px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.card-actions .btn { flex: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.pager-btn { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-info { font-size: 12px; color: var(--muted); }

.zero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 8px; gap: 6px; }
.zero h3 { margin: 6px 0 0; font-size: 17px; }
.zero p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.zero-art { width: 200px; height: auto; }
.zero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.zero[data-variant="1"] .zero-art:not([data-variant="1"]),
.zero[data-variant="2"] .zero-art:not([data-variant="2"]),
.zero[data-variant="3"] .zero-art:not([data-variant="3"]) { display: none; }
.art-body, .art-roof { fill: var(--soft); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.art-glass { fill: #fff; stroke: var(--ink); stroke-width: 3; }
.art-light { fill: #fff; stroke: var(--ink); stroke-width: 3; }
.art-grille { fill: var(--ink); }
.art-tire { fill: var(--ink); }
.art-badge { fill: var(--accent); }
.art-mark { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; }
.art-ring { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 6; }
.art-handle { stroke: var(--accent); stroke-width: 12; stroke-linecap: round; }
.art-line { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.art-road { fill: var(--soft); stroke: var(--ink); stroke-width: 3; }
.art-dash { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.art-sign { fill: var(--accent); }

/* ---------- Fișa mașinii ---------- */
.detail { grid-area: side; min-height: 0; background: var(--surface); position: relative; z-index: 2; }
.detail-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 14px; }
.detail-top { position: absolute; top: 22px; right: 22px; z-index: 3; }
.gallery { position: relative; border-radius: 14px; overflow: hidden; background: var(--soft); 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: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(20, 20, 22, 0.6); color: #fff; font-size: 22px; line-height: 1; }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.thumbs { list-style: none; display: flex; gap: 6px; margin: 8px 0 0; padding: 0 0 4px; overflow-x: auto; overscroll-behavior: contain; }
.thumbs button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; width: 64px; height: 48px; flex: none; background: var(--soft); }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-title { margin: 14px 0 2px; font-size: 20px; }
.detail-price { margin: 0 0 12px; font-size: 24px; font-weight: 800; color: var(--accent-dark); }
.detail-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.detail-nav button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink); }
.detail-section { padding: 12px 0; border-top: 1px solid var(--line); }
.detail-section h4 { margin: 0 0 8px; font-size: 15px; }
.detail-section dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.detail-section dt { color: var(--muted); }
.detail-section dd { margin: 0; font-weight: 600; }
.detail-section p { margin: 6px 0 0; font-size: 14px; }
.detail-section .btn { margin-top: 10px; }

/* ---------- Câmpul de scris ---------- */
.composer { display: flex; align-items: flex-end; gap: 10px; border-top: 1px solid var(--line); padding: 26px 14px 44px; }
.composer textarea { flex: 1; resize: none; border: 2px solid var(--line); border-radius: 16px; padding: 14px; font-size: 17px; line-height: 1.35; height: auto; color: var(--ink); background: var(--surface); }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.send { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 18px; border-radius: 14px; border: 0; background: var(--accent); color: #fff; font-weight: 700; flex: none; }
.send:hover { background: var(--accent-dark); }
.send:disabled { opacity: 0.55; cursor: default; }
.plane { fill: #fff; }
.plane-fold { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.send-round { width: 52px; padding: 0; border-radius: 50%; }
.send-round .send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.reopen { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; font-weight: 700; box-shadow: var(--shadow); animation: pop 0.3s ease; }
.page-scroll { position: fixed; right: 6px; top: 50%; transform: translateY(-50%); z-index: 20; width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; background: var(--accent); color: #fff; font-size: 17px; line-height: 1; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .typing span, .reopen { animation: none; }
  .typing span { opacity: 0.7; }
  .chat { transition: none !important; }
}

/* ---------- Desktop (≥ 980 px) ---------- */
@media (min-width: 980px) {
  html, body { height: 100%; overflow: hidden; }
  .page { zoom: var(--page-zoom); max-width: 1560px; margin: 0 auto; padding-inline: var(--side); height: calc(100vh / var(--page-zoom)); display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 48px; align-items: center; }
  .intro { transform: translate(calc(-1 * min(3vw, 60px)), calc(-1 * min(2.5vh, 28px))); }
  .chat { width: 460px; height: min(700px, calc(100vh / var(--page-zoom) - 140px)); margin-left: auto; margin-right: max(0px, calc((100% - 460px) / 2)); transition: width var(--ease), height var(--ease), margin var(--ease); }
  .chat.is-wide { --ext: min(60px, max(0px, var(--side) - 16px)); --shift: min(48px, max(0px, var(--side) - 16px - var(--ext))); width: calc(100% + var(--ext)); margin-right: calc(-1 * (var(--ext) + var(--shift))); height: min(780px, calc(100vh / var(--page-zoom) - 140px)); }
  .chat.is-wide .chat-body { grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr); grid-template-areas: "main side"; }
  .chat.is-wide .panel { border-left: 1px solid var(--line); }
  .chat.is-wide .detail { border-left: 1px solid var(--line); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { flex-direction: column; }
  .card-photo { aspect-ratio: 1.15; }
  .card-title { font-size: 18px; }
  .card-price { font-size: 26px; }
  .card-data { font-size: 14px; white-space: normal; }
  .card-info { flex: 1; }
  body:not(.chat-open) .page { grid-template-columns: minmax(0, 1fr); justify-items: center; }
}

/* ---------- Telefon și tabletă (< 980 px) ---------- */
@media (max-width: 979.98px) {
  html { min-height: 100%; }
  html.chat-locked, html.chat-locked body { overflow: hidden; }
  .page { display: flex; flex-direction: column; }
  .chat { order: -1; height: calc(100dvh - 32px); margin: 16px; }
  .intro { padding: 28px 20px 110px; }
  .chat-body { grid-template-areas: "main"; }
  .messages > .msg-results { max-width: 100%; align-self: stretch; padding: 0; background: none; }
  .msg-results .panel { padding: 0; overflow: visible; }
  .detail { position: absolute; inset: 0; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .card { flex-direction: row; }
  .card-photo { width: 36%; flex: none; aspect-ratio: auto; min-height: 100px; }
  .card-info { padding: 8px 10px; gap: 2px; }
  .card-title { font-size: 14px; }
  .card-price { font-size: 17px; }
  .card-data { font-size: 12px; }
  .card-badge { font-size: 11px; padding: 1px 6px; }
  .card-actions .btn { padding: 5px 8px; font-size: 12px; }
  .pager { margin-top: 8px; }
  .composer { padding: 10px 12px 44px; align-items: center; }
  .composer textarea { height: 44px; padding: 9px 12px; font-size: 16px; line-height: 22px; border-radius: 22px; }
  .send { height: 44px; }
  .send-round { width: 44px; }
  .chip { padding: 6px 9px; font-size: 12.5px; }
  .welcome-actions { gap: 6px; }
  .msg { font-size: 14px; }
}

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