/* Asistent Auto AI — page styles. Colours in one place (7b.8); layout numbers from CLAUDE.md 13.0. */

:root {
  --page-bg: #0d0d0f;
  --page-bg-2: #1c1c1f;
  --page-glow: rgba(255, 204, 0, 0.12);
  --ink-light: #f3f3f5;
  --ink-light-muted: #b4b4bb;
  --accent: #ffcc00;
  --accent-hover: #ffd633;
  --accent-ink: #111113;
  --accent-soft: #fff6cc;
  --chat-bg: #ffffff;
  --chat-head: #111113;
  --ink: #18181b;
  --ink-muted: #63636b;
  --line: #e6e6ea;
  --bubble-bot: #f3f3f5;
  --bubble-user: #1d1d20;
  --bubble-user-ink: #ffffff;
  --card-bg: #ffffff;
  --danger-soft: #fff4d6;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --radius-small: 12px;
  --page-zoom: 1;
  --gutter: clamp(16px, 5vw, 96px);
  --compact-width: 460px;
  --reach: max(0px, calc(var(--gutter) - 16px));
  --speed: 0.35s;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink-light);
  background:
    radial-gradient(1200px 600px at 85% 15%, var(--page-glow), transparent 60%),
    linear-gradient(160deg, var(--page-bg-2) 0%, var(--page-bg) 55%, #050506 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* readable by screen readers, invisible on screen */
.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

/* ---------- presentation (left on desktop, under the chat on phones) ---------- */

.intro-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-title {
  margin: 0 0 14px;
  font-size: 27px;
  line-height: 1.15;
}

.intro-text {
  margin: 0 0 22px;
  color: var(--ink-light-muted);
  font-size: 15px;
  line-height: 1.6;
}

.intro-figures {
  display: flex;
  gap: 26px;
  margin: 0 0 22px;
}

.intro-figures div {
  display: flex;
  flex-direction: column-reverse;
}

.intro-figures dd {
  margin: 0;
  color: var(--ink-light);
  font-size: 18px;
  font-weight: 800;
}

.intro-figures dt {
  color: var(--ink-light-muted);
  font-size: 12px;
}

.intro-list {
  margin: 0 0 22px;
  padding-left: 18px;
  color: var(--ink-light);
  font-size: 13px;
  line-height: 1.8;
}

.intro-list li::marker {
  color: var(--accent);
}

.intro-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-light-muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- chat shell ---------- */

.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--chat-bg);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  background: var(--chat-head);
  color: var(--ink-light);
}

.chat-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}

.chat-name {
  flex: 1;
  min-width: 0;
}

.chat-name h2 {
  margin: 0;
  font-size: 16px;
}

.chat-name p {
  margin: 2px 0 0;
  color: var(--ink-light-muted);
  font-size: 12px;
}

.head-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-light);
  font-size: 17px;
}

.head-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.chat-body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}

.conversation {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.messages {
  flex: 1;
  margin: 0;
  padding: 16px 16px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

/* ---------- messages ---------- */

.message {
  display: flex;
  margin: 0 0 12px;
}

.message.from-user {
  justify-content: flex-end;
}

.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bubble-bot);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.from-user .bubble {
  border-bottom-right-radius: 6px;
  background: var(--bubble-user);
  color: var(--bubble-user-ink);
}

.from-bot .bubble {
  border-bottom-left-radius: 6px;
}

.bubble p {
  margin: 0;
}

.bubble ul {
  margin: 2px 0;
  padding-left: 20px;
  list-style: disc;
}

.bubble a {
  color: inherit;
  font-weight: 700;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.message.welcome .bubble {
  max-width: 100%;
  width: 100%;
}

.chat:not(.is-expanded) .message.welcome:first-child {
  margin-top: 20px;
}

.welcome-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chat-bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.chip:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.typing .bubble {
  display: inline-flex;
  gap: 5px;
  padding: 14px 16px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-muted);
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- composer ---------- */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 26px 16px 44px;
  border-top: 1px solid var(--line);
  background: var(--chat-bg);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  height: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafafb;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.4;
  resize: none;
}

.composer textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.35);
}

.send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.send:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send .plane {
  fill: #ffffff;
  stroke: var(--accent-ink);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.send .fold {
  stroke: var(--accent);
}

.send-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- results panel and cards ---------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.results-head strong {
  color: var(--ink);
  font-size: 15px;
}

.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: var(--radius-small);
  background: var(--card-bg);
}

.card-photo {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.15 / 1;
  padding: 0;
  border: 0;
  background: #ececef;
  overflow: hidden;
}

.card-photo img,
.gallery-main img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
}

.card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.card-data {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
}

.card-price {
  margin: 2px 0 0;
  font-size: 26px;
  font-weight: 800;
}

.card-price.on-request {
  font-size: 18px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--accent-ink);
  border-radius: 10px;
  background: var(--chat-bg);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary,
.link-button.primary {
  border-color: var(--accent);
  background: var(--accent);
}

.button:hover:not(:disabled),
.link-button:hover {
  background: var(--accent-soft);
}

.button.primary:hover:not(:disabled),
.link-button.primary:hover {
  background: var(--accent-hover);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pager-info {
  color: var(--ink-muted);
  font-size: 13px;
}

/* zero results (13.8) */
.zero {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  text-align: center;
}

.zero svg {
  width: min(220px, 70%);
  height: auto;
}

.zero h3 {
  margin: 4px 0 0;
  font-size: 19px;
}

.zero p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
}

.zero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

/* ---------- car sheet ---------- */

.sheet {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--chat-bg);
}

.sheet-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 4px;
}

.sheet-top h3 {
  flex: 1;
  margin: 0;
  font-size: 19px;
}

.sheet-price {
  margin: 0 16px 10px;
  font-size: 26px;
  font-weight: 800;
}

.gallery {
  padding: 0 16px;
}

.gallery-main {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: 280px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: #ececef;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 17, 19, 0.65);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.gallery-arrow.prev {
  left: 10px;
}

.gallery-arrow.next {
  right: 10px;
}

.gallery-arrow:hover {
  background: rgba(17, 17, 19, 0.85);
}

.thumbs {
  display: flex;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0 0 6px;
  overflow-x: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.thumbs button {
  flex: 0 0 auto;
  width: 72px;
  height: 54px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #ececef;
}

.thumbs button[aria-current="true"] {
  border-color: var(--accent);
}

.thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px 0;
}

.sheet-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
}

.sheet-nav button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chat-bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.sheet-nav button:hover {
  border-color: var(--accent);
}

.sheet-section {
  padding: 14px 16px 6px;
}

.sheet-section:last-child {
  padding-bottom: 24px;
}

.sheet-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 14px;
}

.specs dt {
  color: var(--ink-muted);
}

.specs dd {
  margin: 0;
  font-weight: 600;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
}

.sheet-text {
  font-size: 14px;
  line-height: 1.6;
}

.sheet-text p {
  margin: 0;
}

.sheet-text ul {
  margin: 2px 0;
  padding-left: 20px;
}

.sheet-label {
  margin: 12px 0 4px;
  color: var(--ink-muted);
  font-size: 12px;
}

.muted {
  color: var(--ink-muted);
  font-size: 14px;
}

/* ---------- reopen and page-scroll buttons ---------- */

.reopen {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: rise 0.3s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-scroll {
  position: fixed;
  top: 50%;
  right: 6px;
  z-index: 30;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* ---------- desktop (980 px and wider) ---------- */

@media (min-width: 980px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .page {
    height: calc(100vh / var(--page-zoom));
    zoom: var(--page-zoom);
  }

  .layout {
    display: flex;
    align-items: center;
    gap: 48px;
    max-width: 1560px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--gutter);
  }

  .intro {
    flex: 0 0 min(400px, 30%);
    transform: translate(calc(-1 * min(3vw, 60px)), calc(-1 * min(2.5vh, 28px)));
  }

  .chat-column {
    display: flex;
    flex: 1;
    align-items: center;
    min-width: 0;
    height: 100%;
  }

  .chat {
    width: var(--compact-width);
    height: min(700px, calc((100vh - 140px) / var(--page-zoom)));
    margin-right: max(0px, calc((100% - var(--compact-width)) / 2));
    margin-left: auto;
    transition: width var(--speed) ease, height var(--speed) ease, margin var(--speed) ease, transform var(--speed) ease;
  }

  .chat.is-expanded {
    width: calc(100% + min(60px, var(--reach)));
    height: min(780px, calc((100vh - 140px) / var(--page-zoom)));
    margin-right: calc(-1 * min(60px, var(--reach)));
    transform: translateX(clamp(0px, calc(var(--reach) - 60px), 48px));
  }

  .chat.is-expanded .conversation {
    flex: 0 0 min(390px, 38%);
    border-right: 1px solid var(--line);
  }

  .side,
  .sheet {
    flex: 1 1 auto;
    min-width: 0;
  }

  .side {
    padding: 14px 16px 10px;
    overflow-y: auto;
  }

  /* on short screens the photos shrink so the cards + paging, and the sheet's buttons, stay visible */
  .card-photo {
    max-height: calc((100vh - 140px) / var(--page-zoom) - 510px);
  }

  .gallery-main {
    max-height: clamp(160px, calc((100vh - 140px) / var(--page-zoom) - 500px), 280px);
  }

  .chat.is-expanded .send {
    width: auto;
    padding: 0 20px;
    border-radius: 999px;
  }

  .chat.is-expanded .send-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }
}

/* ---------- phones and tablets (under 980 px): an app-like chat ---------- */

@media (max-width: 979.98px) {
  html.chat-open,
  html.chat-open body {
    overflow: hidden;
  }

  .layout {
    display: flex;
    flex-direction: column;
    padding: 16px;
  }

  /* the chat comes first on phones; the presentation follows under it */
  .chat-column {
    order: -1;
  }

  .chat {
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
  }

  .intro {
    padding: 28px 8px 24px;
  }

  html:not(.chat-open) .intro {
    padding-bottom: 96px;
  }

  .messages {
    padding: 12px 12px 6px;
  }

  .composer {
    padding: 10px 12px 44px;
    gap: 8px;
  }

  .composer textarea {
    height: 44px;
    padding: 9px 14px;
    font-size: 16px;
  }

  .send {
    width: 44px;
    height: 44px;
  }

  .chip {
    padding: 6px 10px;
    font-size: 13px;
  }

  .message.welcome:first-child {
    margin-top: 0;
  }

  .results-holder {
    margin: 0 0 12px;
  }

  .results {
    gap: 8px;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .card {
    flex-direction: row;
  }

  .card-photo {
    flex: 0 0 36%;
    width: 36%;
    aspect-ratio: auto;
  }

  .card-body {
    gap: 2px;
    min-width: 0;
    padding: 8px 10px;
  }

  .card-title {
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .card-data {
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .card-price {
    font-size: 17px;
  }

  .card-price.on-request {
    font-size: 14px;
  }

  .card-actions {
    gap: 6px;
    padding-top: 4px;
  }

  .card-actions .button,
  .card-actions .link-button,
  .pager .button {
    padding: 5px 10px;
    font-size: 12px;
  }

  .sheet {
    position: absolute;
    inset: 0;
    z-index: 5;
  }

  .zero {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
  }

  .zero svg {
    width: 150px;
  }
}

@media (max-width: 559.98px) {
  .layout {
    padding: 0;
  }

  .chat {
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  .intro {
    padding: 28px 20px 24px;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }
}

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