/* Asistent Moto AI — CFMOTO Moldova. Layout decided by the owner (CLAUDE.md 13.0); colours of cfmoto.md (5d.10).
   Every colour is a variable here, once. */
:root {
  --accent: #06a9c2;
  --accent-strong: #04879b;
  --ink: #1b1b1b;
  --muted: #545454;
  --on-accent: #1b1b1b;
  --surface: #ffffff;
  --surface-soft: #f2f6f7;
  --line: #dde4e6;
  --bubble-user: #d9f3f7;
  --warning-bg: rgba(255, 255, 255, 0.08);
  --page-bg: linear-gradient(140deg, #141414 0%, #1b1b1b 45%, #0f3a42 100%);
  --page-text: #f3f6f7;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --side: clamp(16px, 5vw, 96px);
  --page-zoom: 1;
  --screen-h: calc(100vh / var(--page-zoom));
  --chat-compact-w: 460px;
  --chat-extra: min(60px, calc(var(--side) - 16px));
  --chat-shift: max(0px, min(48px, calc(var(--side) - 16px - var(--chat-extra))));
  --speed: 0.35s;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--page-bg); background-attachment: fixed; overflow: hidden; }
button { font: inherit; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { zoom: var(--page-zoom); max-width: 1560px; margin: 0 auto; padding: 0 var(--side); }
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center;
  height: var(--screen-h); column-gap: 32px;
}

/* Presentation text (left on desktop) */
.intro { color: var(--page-text); transform: translate(calc(-1 * min(3vw, 60px)), calc(-1 * min(2.5vh, 28px))); max-width: 560px; }
.intro-title { font-size: 27px; margin: 0 0 12px; }
.intro-text { font-size: 15px; line-height: 1.55; margin: 0 0 18px; }
.intro-stats { display: flex; gap: 28px; list-style: none; padding: 0; margin: 0 0 18px; }
.intro-stats strong { display: block; font-size: 18px; color: var(--accent); }
.intro-stats span { font-size: 12px; opacity: 0.85; }
.intro-list { font-size: 13px; line-height: 1.6; padding-left: 18px; margin: 0 0 18px; }
.intro-warning { font-size: 12px; line-height: 1.5; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--warning-bg); border-radius: 6px; margin: 0; }

/* Chat window: compact (phone-like) until the results panel is needed */
.chat {
  display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  overflow: hidden; justify-self: end;
  width: var(--chat-compact-w); height: min(700px, calc(var(--screen-h) - 140px));
  margin-right: max(0px, calc((100% - var(--chat-compact-w)) / 2));
  transition: width var(--speed), height var(--speed), margin var(--speed), transform var(--speed);
}
.chat.is-expanded {
  width: calc(100% + var(--chat-extra)); height: min(780px, calc(var(--screen-h) - 140px));
  margin-right: calc(-1 * var(--chat-extra)); transform: translateX(var(--chat-shift));
}
.chat[hidden] { display: none; }

.chat-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--ink); color: var(--page-text); }
.chat-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); flex: none; }
.chat-title { font-size: 16px; margin: 0; flex: 1; }
.icon-button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: inherit; font-size: 18px; }
.icon-button:hover, .icon-button:focus-visible { background: rgba(255, 255, 255, 0.12); }

.chat-body { flex: 1; display: flex; min-height: 0; position: relative; }
.messages { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat:not(.is-expanded) .messages > li:first-child { margin-top: 20px; }
.message { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.45; background: var(--surface-soft); align-self: flex-start; }
.message p { margin: 0; }
.message ul { margin: 2px 0; padding-left: 20px; list-style: disc; }
.message-user { align-self: flex-end; background: var(--bubble-user); }
.message-welcome { max-width: 100%; }
.message a { color: var(--accent-strong); }
.welcome-buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: nowrap; }
.welcome-buttons button {
  flex: 1; white-space: nowrap; border: 1px solid var(--accent); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 8px 10px; font-size: 13px;
}
.welcome-buttons button:hover, .welcome-buttons button:focus-visible { background: var(--accent); }
.chat.is-expanded .welcome-buttons { flex-wrap: wrap; }
.messages { overflow-x: hidden; }
.typing { display: inline-flex; gap: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite alternate; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { from { opacity: 0.25; } to { opacity: 1; } }

/* Results panel (right of the messages on desktop, inside the conversation on phones) */
.results { width: 60%; flex: none; border-left: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; padding: 14px; }
.results[hidden] { display: none; }
.results-count { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); }
.card-image { width: 100%; aspect-ratio: 1.15; object-fit: contain; background: var(--surface-soft); display: block; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-size: 18px; margin: 0; line-height: 1.25; }
.card-price { font-size: 26px; font-weight: 700; margin: 0; }
.card-old { font-size: 14px; color: var(--muted); text-decoration: line-through; margin-right: 6px; font-weight: 400; }
.card-discount { font-size: 13px; background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.card-line { font-size: 14px; color: var(--muted); margin: 0; }
.card-note { font-size: 13px; margin: 0; color: var(--accent-strong); }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.card-actions button, .offer-link {
  flex: 1; border-radius: 10px; padding: 8px 10px; font-size: 14px; text-align: center; text-decoration: none;
  border: 1px solid var(--accent); background: var(--surface); color: var(--ink);
}
.offer-link { background: var(--accent); color: var(--on-accent); display: inline-block; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pager-button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 14px; }
.pager-button:disabled { opacity: 0.4; cursor: default; }
.pager-info { font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 18px 10px; }
.empty[hidden] { display: none; }
.empty-art { margin: 0; }
.empty-art svg { width: 190px; height: auto; }
.empty-title { font-size: 18px; margin: 10px 0 6px; }
.empty-advice { color: var(--muted); margin: 0 0 16px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 0; }
.action-button { border: 0; border-radius: 10px; padding: 9px 16px; background: var(--accent); color: var(--on-accent); }
.action-button-secondary { background: var(--surface); border: 1px solid var(--accent); }
.action-button:disabled { opacity: 0.5; cursor: default; }

/* Product sheet */
.sheet[hidden] { display: none; }
.sheet-back { border: 0; background: none; color: var(--accent-strong); padding: 0 0 8px; }
.gallery { position: relative; background: var(--surface-soft); border-radius: 12px; }
.gallery-image { width: 100%; aspect-ratio: 1.3; object-fit: contain; display: block; }
.gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(27, 27, 27, 0.6); color: #fff; font-size: 22px; }
.gallery-prev { left: 8px; }
.gallery-next { right: 8px; }
.gallery-arrow[hidden] { display: none; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; list-style: none; padding: 6px 0; margin: 0; overscroll-behavior: contain; }
.thumbs button { border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; flex: none; }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 64px; height: 52px; object-fit: contain; display: block; }
.sheet-title { font-size: 20px; margin: 8px 0 4px; }
.sheet-price { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.sheet-note { margin: 0 0 10px; color: var(--accent-strong); font-size: 14px; }
.sheet-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.sheet-nav button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.sheet-section { padding-top: 6px; }
.sheet-section h4 { font-size: 15px; margin: 10px 0 6px; }
.spec-group { font-size: 13px; color: var(--muted); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.spec-list { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 3px 10px; margin: 0; font-size: 14px; }
.spec-list dt { color: var(--muted); }
.spec-list dd { margin: 0; }
#sheet-labels-body { padding-left: 18px; margin: 0; font-size: 14px; }
#sheet-description-body { white-space: pre-line; font-size: 14px; line-height: 1.5; margin: 0; }
#sheet-contact-body p { margin: 0; font-size: 14px; }
#sheet-contact-body ul { margin: 2px 0; padding-left: 20px; font-size: 14px; }

/* Message box */
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 26px 14px 44px; border-top: 1px solid var(--line); }
.composer textarea {
  flex: 1; resize: none; height: auto; padding: 14px; font-size: 17px; line-height: 1.4; border: 1px solid var(--line);
  border-radius: 14px; font-family: inherit; color: var(--ink);
}
.composer textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.send {
  width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--on-accent);
}
.send:disabled { opacity: 0.55; cursor: default; }
.send-icon { width: 24px; height: 24px; }
.send-plane { fill: #ffffff; }
.send-fold { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.send-label { display: none; font-weight: 600; }
.chat.is-expanded .send { width: auto; border-radius: 999px; padding: 0 20px; }
.chat.is-expanded .send-label { display: inline; }

.launcher {
  position: fixed; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 999px;
  padding: 12px 18px; background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: var(--shadow);
  animation: pop var(--speed) ease-out;
}
.launcher[hidden] { display: none; }
.launcher-bubble { width: 22px; height: 18px; border-radius: 9px 9px 9px 2px; background: var(--surface); }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
.scroll-toggle { display: none; }

/* Phones and tablets: a messaging app — the chat fills the screen, only the chat scrolls */
@media (max-width: 979px) {
  html, body { height: auto; }
  html { min-height: 100%; }
  body { overflow: auto; }
  html.chat-open, html.chat-open body { overflow: hidden; }
  .page { zoom: 1; padding: 0; }
  .layout { display: flex; flex-direction: column; height: auto; }
  .chat {
    order: -1; width: 100%; height: 100vh; height: 100dvh; margin: 0; justify-self: stretch;
    border-radius: 0; transform: none;
  }
  .chat.is-expanded { width: 100%; height: 100vh; height: 100dvh; margin: 0; transform: none; }
  .intro { transform: none; padding: 28px 16px 96px; max-width: none; }
  .chat-body { display: block; overflow: hidden; }
  .messages { height: 100%; }
  .results { width: auto; border: 0; padding: 0; overflow: visible; }
  .messages > li.results-item { max-width: 100%; align-self: stretch; }
  .cards { grid-template-columns: 1fr; gap: 8px; }
  .card { flex-direction: row; }
  .card-image { width: 36%; aspect-ratio: auto; height: auto; flex: none; }
  .card-body { padding: 8px 10px; gap: 2px; min-width: 0; }
  .card-title { font-size: 14px; }
  .card-price { font-size: 17px; }
  .card-old { font-size: 12px; }
  .card-line { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-note { font-size: 12px; }
  .card-actions { padding-top: 4px; }
  .card-actions button, .card-actions .offer-link { padding: 4px 6px; font-size: 12px; }
  .pager { margin-top: 8px; }
  .pager-button { padding: 5px 10px; font-size: 13px; }
  .sheet:not([hidden]) { position: absolute; inset: 0; background: var(--surface); overflow-y: auto; overscroll-behavior: contain; padding: 12px; z-index: 2; }
  .composer { padding: 10px 10px 44px; align-items: center; }
  .composer textarea { height: 44px; padding: 9px 12px; font-size: 16px; }
  .send { width: 44px; height: 44px; }
  .chat.is-expanded .send { width: 44px; padding: 0; border-radius: 50%; }
  .chat.is-expanded .send-label { display: none; }
  .welcome-buttons { flex-wrap: wrap; }
  .welcome-buttons button { font-size: 12px; padding: 6px 8px; }
  .launcher { right: 16px; bottom: 16px; }
  html.chat-open .scroll-toggle {
    display: flex; align-items: center; justify-content: center; position: fixed; right: 6px; top: 50%;
    transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 2px solid #ffffff;
    background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); z-index: 5; font-size: 18px;
  }
}

/* Tablets: the chat keeps a small margin and rounded corners; under 560 px it goes edge to edge (13.0). */
@media (min-width: 561px) and (max-width: 979px) {
  .chat, .chat.is-expanded {
    width: calc(100% - 24px); height: calc(100vh - 24px); height: calc(100dvh - 24px); margin: 12px auto;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat, .launcher { transition: none; animation: none; }
  .typing span { animation: none; }
}
