/* COLESO.MD assistant page. Layout and sizes follow CLAUDE.md 13.0; colours are defined once, here. */
:root {
  --accent: #ff3124;
  --accent-dark: #d9241a;
  --accent-soft: #fff0f0;
  --ink: #292626;
  --ink-soft: #5d5858;
  --line: #e6e6e6;
  --paper: #ffffff;
  --mist: #f6f6f6;
  --bg-top: #fbf4f3;
  --bg-bottom: #ececec;
  --gold: #fcaf26;
  --radius: 18px;
  --shadow: 0 18px 48px rgba(41, 38, 38, 0.16);
  --page-zoom: 1;
  --side: clamp(16px, 5vw, 96px);
  --reach: max(0px, min(108px, calc(var(--side) - 16px)));
  --chat-compact-w: 460px;
  --ease: 320ms ease;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
}

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

/* ---------- desktop: text left, chat right, both vertically centred ---------- */
.page {
  zoom: var(--page-zoom);
  max-width: 1560px;
  min-height: calc(100vh / var(--page-zoom));
  margin: 0 auto;
  padding: 0 var(--side);
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) 1.6fr;
  gap: 32px;
  align-items: center;
}

.intro { transform: translate(calc(-1 * min(3vw, 60px)), calc(-1 * min(2.5vh, 28px))); }
.intro__brand { margin: 0 0 6px; font-weight: 800; letter-spacing: 0.08em; color: var(--accent); font-size: 13px; }
.intro__title { margin: 0 0 12px; font-size: 27px; line-height: 1.2; }
.intro__lead { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--ink-soft); }
.intro__stats { list-style: none; display: flex; gap: 22px; margin: 0 0 18px; padding: 0; }
.intro__stats li { display: flex; flex-direction: column; }
.intro__number { font-size: 18px; font-weight: 800; color: var(--ink); }
.intro__label { font-size: 12px; color: var(--ink-soft); }
.intro__list { margin: 0 0 18px; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.intro__note { margin: 0; padding: 10px 12px; font-size: 12px; line-height: 1.5; background: var(--paper); border-left: 3px solid var(--gold); border-radius: 8px; }

/* ---------- chat window: compact "phone" shape, enlarged when the results panel is needed ---------- */
.chat {
  justify-self: end;
  width: var(--chat-compact-w);
  margin-right: max(0px, calc((100% - var(--chat-compact-w)) / 2));
  height: min(700px, calc(100vh / var(--page-zoom) - 140px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: width var(--ease), height var(--ease), margin-right var(--ease);
}
.chat.is-wide {
  width: calc(100% + min(60px, var(--reach)));
  margin-right: calc(-1 * var(--reach));
  height: min(780px, calc(100vh / var(--page-zoom) - 140px));
}
.chat.is-closed { display: none; }

.chat__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--ink); color: var(--paper); }
.chat__who { display: flex; align-items: center; gap: 10px; }
.chat__avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); font-weight: 800; }
.chat__name { margin: 0; font-size: 16px; }
.chat__sub { margin: 0; font-size: 12px; opacity: 0.75; }
.chat__tools { display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: var(--paper); font-size: 16px; }
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(255, 255, 255, 0.24); }

.chat__body { flex: 1; min-height: 0; display: flex; position: relative; }
.messages { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 16px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; }
.chat:not(.is-wide) .messages > .msg:first-child { margin-top: 20px; }
.chat.is-wide .messages { flex: 0 0 38%; border-right: 1px solid var(--line); }

.msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; 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(--mist); border-bottom-left-radius: 4px; }
.msg--user { align-self: flex-end; background: var(--accent); color: var(--paper); border-bottom-right-radius: 4px; }
.msg--welcome { max-width: 100%; }
.msg__buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: nowrap; }
.chip { flex: 1; padding: 8px 6px; border: 1px solid var(--accent); border-radius: 999px; background: var(--paper); color: var(--accent-dark); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip:hover, .chip:focus-visible { background: var(--accent-soft); }

.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--mist); border-radius: 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); 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 panel (desktop: right of the messages; phone: inside the conversation) ---------- */
.results { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 16px 10px; overflow-y: auto; overscroll-behavior: contain; }
.results__count { margin: 0 0 10px; font-weight: 700; font-size: 15px; }
.results__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.results__nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.results__page { font-size: 13px; color: var(--ink-soft); }
.nav-btn { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 14px; font-weight: 600; }
.nav-btn:disabled { opacity: 0.4; cursor: default; }
.nav-btn--accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--paper); }
.card__media { position: relative; aspect-ratio: 1.15 / 1; background: var(--paper); border: 0; padding: 0; }
.card__media img { width: 100%; height: 100%; object-fit: contain; }
.card__badge { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; background: var(--gold); font-size: 12px; font-weight: 700; }
.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card__title {
  margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; background: none; border: 0; padding: 0; text-align: left;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.card__line { margin: 0; font-size: 14px; color: var(--ink-soft); }
.card__prices { display: flex; align-items: baseline; gap: 8px; }
.card__price { font-size: 26px; font-weight: 800; color: var(--accent-dark); }
.card__old { font-size: 14px; color: var(--ink-soft); text-decoration: line-through; }
.card__status { margin: 0; font-size: 14px; }
.card__status--order { color: var(--accent-dark); font-weight: 600; }
.card__actions { display: flex; gap: 8px; margin-top: 6px; }
.link-btn { padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-align: center; }
.link-btn--accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.zero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 24px 12px; }
.zero__art { width: 170px; }
.zero__tyre { fill: var(--ink); }
.zero__rim { fill: var(--mist); }
.zero__hub { fill: var(--ink-soft); }
.zero__spokes { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.zero__badge { fill: var(--accent); }
.zero__mark { fill: none; stroke: var(--paper); stroke-width: 3.5; stroke-linecap: round; }
.zero__title { margin: 0; font-size: 18px; font-weight: 700; }
.zero__tip { margin: 0; font-size: 14px; color: var(--ink-soft); }
.zero__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* ---------- product sheet ---------- */
.detail { position: relative; flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; }
.chat__body.has-detail > .results { display: none; }
.detail__back { margin-bottom: 10px; }
.gallery { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.gallery__main { display: block; width: 100%; height: 280px; object-fit: contain; }
.gallery__arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(41, 38, 38, 0.65); color: var(--paper); font-size: 20px; }
.gallery__arrow--prev { left: 8px; }
.gallery__arrow--next { right: 8px; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; list-style: none; margin: 0; }
.thumbs button { flex: 0 0 64px; height: 52px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--paper); }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.detail__title { margin: 8px 0 4px; font-size: 20px; }
.detail__tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.detail__section { padding: 10px 0; border-top: 1px solid var(--line); }
.detail__section h3 { margin: 0 0 8px; font-size: 16px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
.specs dt { color: var(--ink-soft); }
.specs dd { margin: 0; font-weight: 600; }
/* The sheet's "Vezi oferta" sits on its own line; as a plain inline link its padding covered the stock line above. */
.detail > .link-btn { display: inline-block; margin: 8px 0 2px; }
.live-note { margin: 2px 0 4px; font-size: 13px; color: var(--ink-soft); }
.live-note--live { color: var(--ink); font-weight: 600; }
.stores { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.stores li { padding: 8px 10px; background: var(--mist); border-radius: 10px; }
.detail__text { white-space: pre-line; font-size: 14px; line-height: 1.55; margin: 0; }

/* ---------- composer ---------- */
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 26px 16px 44px; border-top: 1px solid var(--line); background: var(--paper); }
.composer__input { flex: 1; height: auto; resize: none; padding: 14px; font-size: 17px; line-height: 1.45; border: 1px solid var(--line); border-radius: 14px; }
.composer__input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.send { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); display: grid; place-items: center; }
.send:disabled { opacity: 0.5; cursor: default; }
.send__icon { width: 24px; height: 24px; }
.send__plane { fill: var(--paper); }
.send__fold { stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }

/* ---------- reopen and page-scroll buttons ---------- */
.reopen { position: fixed; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--paper); font-weight: 700; box-shadow: var(--shadow); animation: pop 260ms ease; z-index: 20; }
.reopen__icon { width: 20px; height: 20px; fill: var(--paper); }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.scroll-btn { display: none; }

/* ---------- phone and tablet (under 980 px): like a messaging app ---------- */
@media (max-width: 979.98px) {
  html, body { height: auto; }
  html { min-height: 100%; }
  html.chat-open, html.chat-open body { overflow: hidden; }
  .page { display: flex; flex-direction: column; zoom: 1; min-height: 0; padding: 0; max-width: none; }
  .page > .chat { order: -1; }
  .intro { transform: none; padding: 24px 16px 96px; }
  .chat, .chat.is-wide { width: 100%; margin: 0; height: 100vh; height: 100dvh; border-radius: var(--radius); }
  .chat__body { display: block; overflow: hidden; }
  .messages { height: 100%; }
  .chat.is-wide .messages { border-right: 0; }
  .chat:not(.is-wide) .messages > .msg:first-child { margin-top: 0; }
  .detail { position: absolute; inset: 0; background: var(--paper); z-index: 5; }
  .results { padding: 0; overflow: visible; width: 100%; }
  .results__list { grid-template-columns: 1fr; gap: 8px; }
  .card { flex-direction: row; }
  .card__media { flex: 0 0 36%; aspect-ratio: auto; }
  .card__body { min-width: 0; padding: 8px 10px; gap: 2px; }
  .card__title { font-size: 14px; }
  .card__line { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card__price { font-size: 17px; }
  .card__status { font-size: 12.5px; }
  .card__actions { margin-top: 4px; }
  .link-btn { padding: 5px 9px; font-size: 12.5px; }
  .nav-btn { padding: 6px 12px; font-size: 13px; }
  .results__nav { margin-top: 8px; }
  .composer { padding: 10px 12px 44px; }
  .composer__input { height: 44px; padding: 9px 12px; font-size: 16px; }
  .send { flex-basis: 44px; width: 44px; height: 44px; }
  .chip { font-size: 12.5px; padding: 7px 4px; }
  .scroll-btn {
    display: grid; place-items: center; position: fixed; right: 6px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--paper); background: var(--accent);
    color: var(--paper); font-size: 18px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); z-index: 15;
  }
  html:not(.chat-open) .scroll-btn { display: none; }
}

@media (max-width: 559.98px) {
  .chat, .chat.is-wide { border-radius: 0; box-shadow: none; }
}

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