:root {
  --dash-w: 35px;
  --dash-h: 3px;
  --dots-side: 18px;
  --dots-bottom: 10px;
  --sold-h: 20px;
  --sold-accent: #D69E0C;
  --dot-size: 2px;
  --dot-step: 3px;
  --dot-x: 0px;
}

.cars-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.car-row {
  position: relative;
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  gap: 58px;
  align-items: center;
  padding: 13px 15px 15px 54px;
  background: #2E364F;
  border-radius: 20px;
  color: #F5F5F5;
  overflow: hidden;
  cursor: pointer;
  transition: background-color .18s ease-in-out, box-shadow .18s ease-in-out;
  z-index: 0;
}

.cars-list .car-row:hover { background-color: #5B6379; box-shadow: 0 0 14px rgba(0,0,0,.35); }

.car-row.car-row--sold { background-color: #31343E; color: #A6A6A6; }
.cars-list .car-row.car-row--sold:hover { background-color: #4A4A4C; }
.car-row.car-row--sold .car-title { color: #756436; }
.car-row.car-row--sold .config-tag { background: rgba(178,34,52,.2); color: #A6A6A6; }
.car-row.car-row--sold .sold-flag { height: 20px; }

.car-row.car-row--sold .thumb::after {
  content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.35);
  border-radius: inherit; z-index: 2; transition: opacity .18s ease-in-out; pointer-events: none;
}
.cars-list .car-row.car-row--sold:hover .thumb::after { opacity: 0; }

.car-row:focus { outline: 2px solid #FFB900; outline-offset: 2px; }

.car-row::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; box-sizing: border-box;
  pointer-events: none; z-index: 1;
  -webkit-mask: linear-gradient(to bottom, transparent 0, #000 0, #000 100%, transparent 100%);
  mask: linear-gradient(to bottom, transparent 0, #000 0, #000 100%, transparent 100%);
}

/* убрали оранжевые боковые линии у проданных */
.car-row.car-row--sold::before,
.car-row:has(.thumb--sold)::before { border: none !important; }

.car-row > * { position: relative; z-index: 10; }

.col-media { box-sizing: border-box; width: max-content; position: relative; }
.col-media .thumb {
  display: block; position: relative; width: 238px; height: 178px;
  border-radius: 16px; overflow: hidden; background: #1f2333;
  box-shadow: 0 18px 12px -16px rgba(0,0,0,.45);
}
.col-media img { display: block; width: 100%; height: 100%; object-fit: cover; }

.car-title { margin: 2px 0 8px; font-size: 20px; line-height: 1.1; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: #FFB900; }
.car-title a { color: inherit; text-decoration: none; }
.car-title a:hover { text-decoration: none; }

.specs { list-style: none; margin: 6px 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; font-weight: 300; color: #F5F5F5; }
.specs li { margin-bottom: 2px; }

.config-label { font-size: 14px; font-weight: 300; }

.config-tag { margin-left: -1px; background: #392237; color: #EEDFE7; padding: 0 3px 1px; border-radius: 4px; font-size: 12px; }

.col-aside { justify-self: end; align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; gap: 0; margin-top: 7px; }
.price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.loc { font-size: 10px; }

.q-badge { background: #74AF52; color: #fff; padding: 3px 14px; border-radius: 6px; font-size: 10px; }

.btn-cta { margin-top: auto; height: 32px; width: 148px; background: #F5F5F5; color: #111; border-radius: 10px; font-weight: 700; font-size: 12px; visibility: hidden; }
.btn-cta:hover { filter: brightness(1.03); }

@keyframes spin { to { transform: rotate(360deg); } }

/* === Exclusive layout switches === */
@media (min-width: 861px) {
  .desktop-layout { display: contents !important; }
  .mobile-layout  { display: none !important; }
  .row-divider-advanced { display: block !important; }
}
@media (max-width: 860px) {
  .desktop-layout { display: none !important; }
  .mobile-layout  { display: block !important; }
  .mobile-layout .row-divider-advanced { display: flex !important; }
}

/* ---------- Dots & zones (поверх изображения) ---------- */
.thumb-dots {
  position: absolute; left: var(--dots-side); right: var(--dots-side); bottom: var(--dots-bottom);
  display: flex; justify-content: space-between; z-index: 6;
}
.thumb-dots span {
  width: var(--dash-w); height: var(--dash-h); border-radius: calc(var(--dash-h)/2);
  background: #D9D9D9; opacity: .7;         /* обычные — на 30% прозрачнее */
}
/* «ожидающие» кадры — жёлтые, всегда видимые */
.thumb-dots span.pending { background: #FFB900; opacity: 1; }
/* при наведении соответствующая черта полностью видима */
.thumb-dots span.hovered { opacity: 1 !important; }

.thumb--sold .thumb-dots span { opacity: .5; } /* проданные — на 50% прозрачнее */

/* выравниваем высоту точек у проданных (раньше смещались из-за флага) */
@media (min-width: 861px) {
  .desktop-layout .thumb--sold .thumb-dots { bottom: var(--dots-bottom); }
}

.col-media .thumb .thumb-zones {
  position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5,1fr);
  border-radius: inherit; z-index: 5; pointer-events: auto;
}
.col-media .thumb .thumb-zones > span { cursor: pointer; }

/* ---------- Стикер сверху (другой элемент) ---------- */
.sticker-top { position: absolute; top: 8px; left: -7px; padding: 6px 11px; background: #3D3D3D; color: #F5F5F5; font-weight: 600; font-size: 13px; border-radius: 6px; z-index: 50; pointer-events: none; }

/* ---------- Плашка ПРОДАН (низ изображения) ---------- */
.sold-flag {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: #D69E0C; color: #111; font-weight: 800; font-size: 14px;
  border-radius: 0 0 16px 16px; z-index: 9999; pointer-events: none;
}

/* Маленький прелоадер на превью — ОТКЛЮЧЕН */
/*
.thumb .thumb-preloader {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFB900;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 30;
}
*/
.thumb .thumb-preloader { display: none !important; } /* временно выключен */
.thumb.loaded-all .thumb-preloader { display: none; }

/* ---------- Маски/обрезание карточки и превью ---------- */
.car-row { position: relative; background: #2E364F; border-radius: 20px; -webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(white, black); overflow: hidden; }
.col-media .thumb { position: relative; border-radius: 16px; -webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(white, black); overflow: hidden; }

/* Дата публикации */
.pub-date { margin-top: auto; font-size: 10px; font-weight: 300; color: #C5C9D6; padding-bottom: 4px; padding-left: 5px; }

/* ---------- Адаптивность колонок ---------- */
@media (max-width: 1100px) { .car-row { grid-template-columns: 346px 1fr 220px; } }
@media (max-width: 860px) {
  .car-row { grid-template-columns: 1fr; padding: 14px; }
  .col-media .thumb { width: 100%; height: auto; }
  .col-media img { width: 100%; height: auto; }
  .col-aside { align-items: flex-start; }
  .btn-cta { width: 100%; }
}

.col-main { position: relative; display: flex; flex-direction: column; min-height: 100%; }
@media (max-width: 860px) { .car-row { grid-template-columns: 1fr; } .col-media { padding: 0; width: auto; } }
.col-main { align-self: start; margin-top: 7px; }

.col-aside .loc, .col-aside .quality { align-self: flex-start; text-align: left; padding: 3px 0 0 19px; }
.col-aside .quality { padding: 3px 0 0 16px; }

/* =========================================================
   BADGE (row-divider-advanced) — позиционирование и стили
   ========================================================= */
.row-divider-advanced {
  position: absolute; top: 10px; left: 30px; z-index: 200; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.row-divider-advanced .divider-text {
  font-size: 13px; font-weight: 500; line-height: 1; margin: 0; white-space: nowrap; letter-spacing: .3px;
}
.row-divider-advanced .divider-center { height: 25px; padding: 0 8px; border-radius: 5px; display: flex; align-items: center; justify-content: center; }

@media (min-width: 861px) {
  .car-row .col-media { position: relative; z-index: 100; }
  .car-row .col-media .thumb { position: relative; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .car-row .col-media .thumb > img {
    position: relative; z-index: 1;
    -webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(white, black);
    border-radius: 16px; display: block;
  }

  .car-row .col-media > .row-divider-advanced,
  .car-row .col-media .thumb > .row-divider-advanced { position: absolute; top: 8px; left: -8px; z-index: 300; pointer-events: none; display: flex; align-items: center; justify-content: center; }

  .car-row .col-media > .row-divider-advanced.badge--new .divider-center,
  .car-row .col-media .thumb > .row-divider-advanced.badge--new .divider-center { background: #FFFFFF; color: #000000; }
  .car-row .col-media > .row-divider-advanced.badge--used .divider-center,
  .car-row .col-media .thumb > .row-divider-advanced.badge--used .divider-center { background: #1A2238; color: #F5F5F5; }
}

@media (max-width: 860px) {
  .mobile-layout .thumb { position: relative; overflow: hidden; }
  .mobile-layout .thumb > .row-divider-advanced { position: absolute; top: 10px; left: 10px; z-index: 12; display: flex; align-items: center; justify-content: center; }
  .mobile-layout .thumb > .row-divider-advanced.badge--new .divider-center { background: #FFFFFF; color: #000000; }
  .mobile-layout .thumb > .row-divider-advanced.badge--used .divider-center { background: #1A2238; color: #F5F5F5; }
}

/* ===========================
   DESKTOP-ONLY гарант
   =========================== */
@media (min-width: 861px) {
  .desktop-layout { display: contents !important; }
  .mobile-layout  { display: none !important; }
  .row-divider-advanced { display: block !important; }
  .car-row .col-media { position: relative; z-index: 100; }
  .car-row .col-media .thumb { position: relative; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .car-row .col-media .thumb > img { position: relative; z-index: 1; -webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(white, black); border-radius: 16px; }
  .car-row .col-media > .row-divider-advanced,
  .car-row .col-media .thumb > .row-divider-advanced { position: absolute; top: 8px; left: -8px; z-index: 300; }
  .row-divider-advanced .divider-text { font-size: 13px; font-weight: 500; letter-spacing: .3px; }
  .row-divider-advanced .divider-center { height: 25px; padding: 0 8px; border-radius: 5px; }
  .car-row .col-media > .row-divider-advanced.badge--new .divider-center,
  .car-row .col-media .thumb > .row-divider-advanced.badge--new .divider-center { background: #FFFFFF; color: #000000; }
  .car-row .col-media > .row-divider-advanced.badge--used .divider-center,
  .car-row .col-media .thumb > .row-divider-advanced.badge--used .divider-center { background: #1A2238; color: #F5F5F5; }
}

/* =====================================================
   ВЕРХНИЙ СТАТУС-БАР (ТОЛЬКО ДЕСКТОП) — как на макете
   ===================================================== */
@media (min-width: 861px) {
  .car-row { position: relative; }

  /* позволяем плашкам выходить наружу и быть видимыми на 50% */
  .car-row {
    overflow: visible !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  .desk-statusbar {
    position: absolute; top: 0;                /* на верхней грани */
    right: 60px; left: 0;
    transform: translateY(-50%);               /* вылет на 50% своей высоты */
    display: flex; justify-content: flex-end; align-items: flex-start;
    gap: 8px; z-index: 60; pointer-events: none;
  }

  .desk-badge {
    pointer-events: auto; display: inline-flex; align-items: center;
    padding: 2px 8px;           /* сверху/снизу 2px по ТЗ */
    border-radius: 9999px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
  }
  .desk-badge--sold { background: #B22234; color: #FFFFFF; }
  .desk-badge--new  { background: #FFB900; color: #000000; } /* 500 уже задано */
  .desk-badge--used { background: #000000; color: #FFFFFF; }

  /* прячем старые бейджи и нижний флаг «Продан» на десктопе */
  .desktop-layout .row-divider-advanced { display: none !important; }
  .desktop-layout .thumb .sold-flag { display: none !important; }
}

/* =====================================================
   FUEL ICON (иконка топлива слева от заголовка, только desktop)
   ===================================================== */
@media (min-width: 861px){
  .car-title{ position:relative; }
  .car-title .fuel-icon-desktop{
    position:absolute;
    left:-26px;                /* в «паз» между фото и заголовком */
    top:50%;
    transform:translateY(-50%);
    display:block;
    pointer-events:none;       /* клики проходят по ссылке заголовка */
    z-index:11;                /* поверх фона карточки */
  }
    .car-row.car-row--sold .car-title .fuel-icon-desktop {
    opacity: .5;}
    
}
