/* Featured cars, car detail page and the admin page. Shares tokens with styles.css. */

:root {
  --car-bg:
    radial-gradient(120% 120% at 100% 0%, rgb(249 115 22 / 30%), transparent 55%),
    linear-gradient(135deg, #0b1220, #1e293b);
  --car-accent: #f97316;
  --car-accent-grad: linear-gradient(135deg, #f97316, #ef4444);
  --car-price: #fdba74;
}

/* ---------- Featured row ---------- */
.featured { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.featured-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 4px 0; }
.featured-kicker {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--car-accent);
}
.featured-head h2 { font-size: 1.3rem; font-weight: 800; }
.featured-arrows { display: flex; gap: 6px; }
.featured-arrow {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.featured-arrow:hover { color: var(--car-accent); }

.featured-track {
  position: relative;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 6px;
}
.featured-track::-webkit-scrollbar { display: none; }

.car-card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  overflow: hidden;
  border-radius: 24px;
  color: #fff;
  background: var(--car-bg);
  box-shadow: 0 18px 36px -20px rgb(15 23 42 / 70%);
}
@media (min-width: 600px) {
  .car-card { grid-template-columns: 1.6fr .75fr; } /* info column 25% narrower than 1fr */
}

.car-media { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; background: #0b1220; }
@media (min-width: 600px) { .car-media { aspect-ratio: auto; min-height: 340px; } }
/* The strip is taken out of the flow so tall (portrait) photos can never stretch the card. */
.car-strip { position: absolute; inset: 0; display: flex; transition: transform .7s cubic-bezier(.22, .61, .36, 1); }
.car-strip img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.car-count, .gallery-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(6px);
}
.car-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  background: var(--car-accent-grad);
  box-shadow: 0 6px 14px -6px rgb(239 68 68 / 70%);
}

.car-info { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; min-width: 0; }
.car-meta { font-size: .72rem; color: rgb(255 255 255 / 65%); }
.car-name { margin: 0; font-size: 1.15rem; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.car-trim { margin-top: -2px; font-size: .8rem; color: rgb(255 255 255 / 70%); }
.car-price { display: flex; flex-direction: column; margin-top: 2px; }
.car-price span { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: rgb(255 255 255 / 60%); }
.car-price strong { font-size: .975rem; font-weight: 800; line-height: 1.2; color: var(--car-price); font-variant-numeric: tabular-nums; }
.car-loan {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgb(255 255 255 / 7%);
  border: 1px solid rgb(255 255 255 / 10%);
}
.car-loan-title { font-size: .7rem; color: rgb(255 255 255 / 65%); }
.car-loan-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .84rem; }
.car-loan-row strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.car-loan-row small { font-weight: 500; opacity: .7; }
.car-more { margin-top: 4px; min-height: 42px; font-size: .9rem; }
.car-info .btn.primary, .price-card .btn.primary { background: var(--car-accent-grad); box-shadow: 0 12px 24px -14px rgb(239 68 68 / 80%); }
@media (min-width: 600px) { .car-more { margin-top: auto; } }

.featured-dots { display: flex; justify-content: center; gap: 6px; }
.featured-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  cursor: pointer;
  transition: width .3s, background .3s;
}
.featured-dot[aria-current="true"] { width: 22px; background: var(--car-accent); }

/* ---------- Detail page ---------- */
.gallery { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gallery-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  background: #0b1220;
  box-shadow: var(--shadow);
}
.gallery-main { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.gallery-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #0f172a;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 4px 14px rgb(0 0 0 / 25%);
  transform: translateY(-50%);
  cursor: pointer;
}
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }
.gallery-thumbs { position: relative; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.gallery-thumbs::-webkit-scrollbar { display: none; }
.gallery-thumb {
  flex: 0 0 76px;
  height: 57px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  opacity: .6;
  cursor: pointer;
  transition: opacity .2s, border-color .2s;
}
.gallery-thumb[aria-current="true"] { opacity: 1; border-color: var(--car-accent); }
.gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.car-head h1 { margin-top: 8px; font-size: 1.6rem; }
.car-head p { margin: 2px 0 0; }
.car-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 0; }
.car-facts div { padding: 8px 10px; border-radius: 12px; background: var(--primary-soft); min-width: 0; }
.car-facts dt { color: var(--muted); font-size: .72rem; }
.car-facts dd { margin: 2px 0 0; font-weight: 700; font-size: .92rem; overflow-wrap: anywhere; }
@media (max-width: 480px) { .car-facts { grid-template-columns: repeat(2, 1fr); } }

.price-label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.price-card { padding: 14px; }
.price-main { display: block; font-size: 1.2rem; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price-sub { color: var(--muted); font-size: .8rem; }
.loan-box {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: .9rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--car-accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--car-accent) 28%, transparent);
}
.loan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.loan-head span { color: var(--muted); font-size: .85rem; }
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  margin: 8px 0 10px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
}
.seg-btn {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.seg-btn[aria-pressed="true"] { color: #fff; background: var(--car-accent-grad); }
.loan-label { color: var(--muted); font-size: .85rem; }
.loan-monthly { display: block; font-size: 1.4rem; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.loan-monthly small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.loan-facts { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 6px 0 0; font-size: .82rem; }
.loan-facts dt { color: var(--muted); }
.loan-facts dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.loan-note { margin: 8px 0 0; color: var(--muted); font-size: .72rem; }

.contact-card p { margin: 6px 0 0; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.contact-actions .btn { flex: 1 1 140px; white-space: nowrap; }
.contact-main {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: 12px;
  font-size: 1.05rem;
  box-shadow: 0 14px 28px -14px rgb(24 119 242 / 85%);
}
.contact-main svg { width: 22px; height: 22px; }
.contact-main, .contact-bar-fb { color: #fff; border-color: transparent; }
.contact-actions .showcase-btn { color: #fff; border-color: transparent; min-height: 50px; }
.code { padding: 1px 8px; border-radius: 6px; color: var(--text); background: var(--primary-soft); }

/* Detail page: Facebook stays one tap away while scrolling. */
.contact-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  display: flex;
  gap: 8px;
  width: min(780px, 100%);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.contact-bar-call {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  height: 50px;
  border-radius: 12px;
  font-size: 1.3rem;
  text-decoration: none;
  background: var(--primary-soft);
}
.contact-bar-fb { flex: 1; justify-content: center; min-height: 50px; font-size: .98rem; }
.container:has(> .contact-bar) { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

.other-cars { display: flex; flex-direction: column; gap: 12px; }
.mini-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.mini-car {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .18s;
}
.mini-car:hover { transform: translateY(-2px); }
.mini-car img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.mini-body { display: flex; flex-direction: column; padding: 8px 10px 10px; font-size: .85rem; }
.mini-body span { color: var(--muted); }
.mini-body b { color: #ea580c; }

/* ---------- Admin ---------- */
.admin-status { padding: 10px 12px; border-radius: 12px; font-size: .88rem; background: var(--info-bg); }
.admin-status:empty { display: none; }
.admin-status.ok { color: var(--ok); background: var(--ok-bg); }
.admin-status.error { color: var(--bad); background: var(--bad-bg); }
.admin-status.warn { background: var(--warn-bg); }

.admin-login { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 480px; align-self: center; }
.admin-login p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.form-errors { margin: 0; color: var(--bad); font-size: .88rem; }
.form-errors:empty { display: none; }
.form-errors p { margin: 2px 0; }
.form-hint { margin: -4px 0 0; color: var(--muted); font-size: .82rem; }

.car-form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.photo-head .btn { cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; margin: 0; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 12px; background: #0b1220; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-cover {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  background: var(--car-accent);
}
.photo-tools {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  padding: 4px;
  background: linear-gradient(transparent, rgb(0 0 0 / 60%));
}
.photo-tools button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  color: #0f172a;
  background: rgb(255 255 255 / 90%);
  cursor: pointer;
}
.photo-tools button.del { color: #e11d48; }
.photo-tools button:disabled { opacity: .35; cursor: default; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.admin-cars { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.admin-car {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 10px 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.admin-car img { width: 88px; height: 66px; object-fit: cover; border-radius: 10px; background: #0b1220; }
.admin-car-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: .88rem; }
.admin-car-body > span { color: var(--muted); }
.admin-car-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.admin-car-tools .btn { flex: 1 1 90px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-solid);
  cursor: pointer;
}
.icon-btn:disabled { opacity: .4; cursor: default; }
.hidden-car { opacity: .75; }
.hidden-car img { filter: grayscale(1); }
