/* ==========================================================================================
   Новый вид «Карточек» каталога (FEATURE_LISTING_CARD_V2) — классы .cc2-*.
   Разметка: model/inc/card_v2.php (сервер) и cardV2Html() в js/catalog.js; поведение: js/card-v2.js,
   листание фото — js/gen-cards.js (атрибуты data-gc-photos / data-gc-img / .gc-dots).
   Цвета берём из переменных «Премиума» (--premium-*), в тёмной теме они переопределены в styles.css.
   Элементы поверх фото (страна, сердечко, «Сравнить») — всегда светлые «таблетки», как .premium-icon-btn.
   ========================================================================================== */

.car-card.cc2 {
    container-type: inline-size;
    position: relative; display: flex; flex-direction: column; height: 100%;
    border-radius: 20px; overflow: hidden; cursor: pointer;
    background: var(--bg-white); color: var(--premium-ink, #0B1220);
    border: 1px solid var(--premium-line, #E4E8EF);
    box-shadow: 0 1px 0 rgba(16, 24, 40, .03), 0 14px 32px -24px rgba(16, 24, 40, .35);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease, border-color .25s ease;
}
.car-card.cc2:hover {
    transform: scale(1.03); border-color: var(--premium-line, #E4E8EF);
    box-shadow: 0 1px 0 rgba(16, 24, 40, .03), 0 28px 50px -26px rgba(30, 79, 224, .38);
}
.car-card.cc2.cc2-in { animation: cc2In .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cc2In { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- фото ---------- */
.cc2-photo {
    position: relative; aspect-ratio: 4 / 3; overflow: hidden;
    background: linear-gradient(110deg, var(--premium-chip-bg, #F4F6FA) 8%, rgba(255, 255, 255, .55) 18%, var(--premium-chip-bg, #F4F6FA) 33%) 0 0 / 200% 100%;
    animation: cc2Shimmer 1.3s linear infinite;
}
html[data-theme="dark"] .cc2-photo { background: linear-gradient(110deg, #1b212d 8%, #262d3b 18%, #1b212d 33%) 0 0 / 200% 100%; }
.cc2-photo.is-loaded, .cc2-photo.is-broken { animation: none; background: var(--premium-chip-bg, #F4F6FA); }
html[data-theme="dark"] .cc2-photo.is-loaded, html[data-theme="dark"] .cc2-photo.is-broken { background: #1b212d; }
@keyframes cc2Shimmer { to { background-position: -200% 0; } }
.cc2-photolink { position: absolute; inset: 0; display: block; }
.cc2-img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
    opacity: 0; transform: scale(1.01);
    transition: opacity .4s ease, transform .7s cubic-bezier(.2, .8, .2, 1);
}
.cc2-photo.is-loaded .cc2-img { opacity: 1; }
.car-card.cc2:hover .cc2-img { transform: scale(1.04); }
.cc2-photo.is-broken .cc2-img { display: none; }
.cc2-photo.is-broken::before {
    content: "\f1b9"; font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif; font-weight: 900;
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; color: var(--premium-ink-soft, #5B6472); opacity: .45;
}
/* затемнение сверху и снизу — чтобы «таблетки» и бейджи читались на любом снимке */
.cc2-photo::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background: linear-gradient(rgba(10, 14, 22, .26), transparent 34%, transparent 58%, rgba(10, 14, 22, .5));
    opacity: 0; transition: opacity .3s ease;
}
.cc2-photo.is-loaded::after { opacity: 1; }
.cc2-nophoto {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    color: var(--premium-ink-soft, #5B6472); text-align: center; padding: 16px;
}
.cc2-nophoto i { font-size: 38px; opacity: .45; }
.cc2-nophoto b { font-size: 14px; font-weight: 700; }
.cc2-nophoto-btn {
    margin-top: 4px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--premium-line, #E4E8EF); background: var(--bg-white);
    color: var(--premium-accent-a, #1E4FE0); font: 700 12.5px 'Manrope', sans-serif; cursor: pointer;
}
.cc2-nophoto-btn:hover { border-color: var(--premium-accent-a, #1E4FE0); }

/* верхний ряд: страна — слева, сердечко — справа */
.cc2-top { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; pointer-events: none; }
.cc2-top > * { pointer-events: auto; }
.cc2-country {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px;
    background: rgba(255, 255, 255, .94); color: #0B1220; font: 700 12px/1 'Manrope', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}
.cc2-country img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.cc2-fav {
    width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
    background: rgba(255, 255, 255, .94); color: #0B1220; display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.cc2-fav i { font-size: 15px; color: #0B1220; }
.cc2-fav:hover { transform: scale(1.12); }
.cc2-fav.active i { color: #ff3b5c; }
html[data-theme="dark"] .cc2-fav i { color: #0B1220; }
html[data-theme="dark"] .cc2-fav.active i { color: #ff3b5c; }

/* нижний ряд: бейджи — слева, «Сравнить» — справа */
.cc2-low { position: absolute; left: 10px; right: 10px; bottom: 17px; z-index: 3; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; pointer-events: none; }
.cc2-low > * { pointer-events: auto; }
.cc2-badges { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; pointer-events: none; }
.cc2-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 8px;
    background: rgba(11, 18, 32, .8); color: #fff; font: 700 11.5px/1.1 'Manrope', sans-serif; white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.cc2-badge i { font-size: 10px; }
.cc2-badge:nth-child(n + 3) { display: none; }
.cc2-b-deal { background: #16a34a; }
.cc2-b-auction { background: #f59e0b; color: #1c1300; }
.cc2-b-new { background: #1E4FE0; }
.cc2-b-price { background: #7c3aed; }
.cc2-b-rate { background: rgba(255, 255, 255, .94); color: #0B1220; }
.cc2-cmp {
    flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 0; cursor: pointer;
    background: rgba(255, 255, 255, .94); color: #0B1220; font: 700 12px/1 'Manrope', sans-serif; white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2); transition: transform .2s ease, background .2s ease, color .2s ease;
}
.cc2-cmp i { font-size: 12px; }
.cc2-cmp:hover { transform: scale(1.01); }
.cc2-cmp.active { background: var(--premium-accent-a, #1E4FE0); color: #fff; }
html[data-theme="dark"] .cc2-cmp { color: #0B1220; }
html[data-theme="dark"] .cc2-cmp.active { color: #fff; }

/* полоски кадров (их показывает/переключает js/gen-cards.js) */
.cc2 .gc-dots { left: 10px; right: 10px; bottom: 7px; z-index: 3; }
.car-card.cc2:hover .gc-dots, .cc2-photo.is-touch .gc-dots { opacity: 1; }

/* «Быстрый просмотр» — по центру фото при наведении (на сенсорных экранах скрыт: есть пункт в меню «⋯») */
.cc2-qv {
    position: absolute; left: 50%; top: 46%; z-index: 3; transform: translate(-50%, -40%) scale(.92); opacity: 0; pointer-events: none;
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px; border: 0; cursor: pointer;
    background: rgba(255, 255, 255, .96); color: #0B1220; font: 700 13px/1 'Manrope', sans-serif; white-space: nowrap;
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .5); transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.car-card.cc2:hover .cc2-qv, .cc2-qv:focus-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
html[data-theme="dark"] .cc2-qv { color: #0B1220; }
@media (hover: none) { .cc2-qv { display: none; } }

/* ---------- содержимое ---------- */
.cc2-body { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 14px 16px 16px; }
.cc2-title, html[data-theme="dark"] .car-card.cc2 .cc2-title { display: block; text-decoration: none; color: var(--premium-ink, #0B1220); }
.cc2-name { display: block; font: 800 17px/1.25 'Manrope', sans-serif; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc2-title:hover .cc2-name { color: var(--premium-accent-a, #1E4FE0); }
.cc2-grade { display: block; margin-top: 2px; font: 600 12.5px/1.35 'Manrope', sans-serif; color: var(--premium-ink-soft, #5B6472); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc2-meta { margin-top: 9px; font: 600 13px/1.5 'Manrope', sans-serif; color: var(--premium-ink-soft, #5B6472); }
.cc2-meta .sep { margin: 0 6px; opacity: .45; }
.cc2-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cc2-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 8px;
    background: var(--premium-chip-bg, #F4F6FA); color: var(--premium-ink, #0B1220); font: 700 12px/1.1 'Manrope', sans-serif; white-space: nowrap;
}
.cc2-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22); flex: none; }

.cc2-bottom { margin-top: auto; padding-top: 14px; }
.cc2-price { padding-top: 12px; border-top: 1px solid var(--premium-line, #E4E8EF); }
.cc2-price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cc2-p { font: 700 21px/1.1 'Unbounded', 'Manrope', sans-serif; letter-spacing: -.02em; color: var(--premium-price, #E23B4F); white-space: nowrap; }
.cc2-p-ask { font-size: 16px; color: var(--premium-ink-soft, #5B6472); }
.cc2-p-ur, .cc2-cap-ur { display: none; }
html[data-price-mode="ur"] .cc2-p-fiz, html[data-price-mode="ur"] .cc2-cap-fiz { display: none; }
html[data-price-mode="ur"] .cc2-p-ur { display: inline; }
html[data-price-mode="ur"] .cc2-cap-ur { display: inline; }
.cc2-price-cap { margin-bottom: 4px; font: 600 12px/1.2 'Manrope', sans-serif; color: var(--premium-ink-soft, #5B6472); }
.cc2-info {
    margin-left: auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
    color: var(--premium-ink-soft, #5B6472); display: inline-flex; align-items: center; justify-content: center; align-self: center;
    transition: color .2s, background .2s;
}
.cc2-info i { font-size: 15px; }
.cc2-info:hover, .cc2-info:focus-visible { color: var(--premium-accent-a, #1E4FE0); background: var(--premium-chip-bg, #F4F6FA); }
.cc2-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; margin-top: 5px; font: 600 12px/1.4 'Manrope', sans-serif; color: var(--premium-ink-soft, #5B6472); }
.cc2-eta { display: inline-flex; align-items: center; gap: 5px; }
.cc2-eta i { font-size: 11px; color: var(--premium-accent-a, #1E4FE0); }
.cc2-sub .ctlg-delta { margin: 0; }

/* ---------- действия ---------- */
.cc2-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.cc2-cta, .cc2-cta:hover, html[data-theme="dark"] .car-card.cc2 .cc2-cta {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 11px 14px; border-radius: 12px;
    background: linear-gradient(135deg, var(--premium-accent-a, #1E4FE0), var(--premium-accent-b, #3E7BFF)); color: #fff; text-decoration: none;
    font: 700 14px/1.2 'Manrope', sans-serif; box-shadow: 0 10px 22px -10px rgba(30, 79, 224, .65);
}
.cc2-cta { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s ease; }
.cc2-cta:hover { transform: scale(1.01); box-shadow: 0 14px 26px -10px rgba(30, 79, 224, .75); }
.cc2-cta i { font-size: 12px; transition: transform .25s ease; }
.cc2-cta:hover i { transform: translateX(3px); }
.cc2-ask {
    flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--premium-line, #E4E8EF); background: transparent; color: var(--premium-ink, #0B1220); font: 700 13px/1.2 'Manrope', sans-serif;
    transition: border-color .2s, color .2s;
}
.cc2-ask i { color: var(--premium-accent-a, #1E4FE0); font-size: 13px; }
.cc2-ask:hover { border-color: var(--premium-accent-a, #1E4FE0); color: var(--premium-accent-a, #1E4FE0); }
.cc2-more { position: relative; flex: none; }
.cc2-moreBtn {
    width: 40px; height: 40px; padding: 0; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--premium-line, #E4E8EF); background: transparent; color: var(--premium-ink-soft, #5B6472); transition: border-color .2s, color .2s, background .2s;
}
.cc2-moreBtn:hover, .cc2-more.is-open .cc2-moreBtn { border-color: var(--premium-accent-a, #1E4FE0); color: var(--premium-accent-a, #1E4FE0); }
.cc2-menu {
    position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 8; min-width: 206px; padding: 6px; display: none;
    background: var(--bg-white); border: 1px solid var(--premium-line, #E4E8EF); border-radius: 14px; box-shadow: 0 18px 40px -14px rgba(16, 24, 40, .38);
}
.cc2-more.is-open .cc2-menu { display: block; animation: cc2Menu .16s ease; }
@keyframes cc2Menu { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.cc2-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; cursor: pointer; text-align: left;
    color: var(--premium-ink, #0B1220); font: 600 13px/1.2 'Manrope', sans-serif;
}
.cc2-menu button i { width: 16px; text-align: center; color: var(--premium-accent-a, #1E4FE0); }
.cc2-menu button:hover { background: var(--premium-chip-bg, #F4F6FA); }

.car-card.cc2 :focus-visible { outline: 2px solid var(--premium-accent-a, #1E4FE0); outline-offset: 2px; }
.cc2 .fav-tools { margin-top: 10px; }

/* узкие карточки (избранное и просмотренные — 4 в ряд): подписи прячем, остаются значки */
@container (max-width: 275px) {
    .cc2-cmp span, .cc2-ask span, .cc2-country { font-size: 11px; }
    .cc2-cmp span, .cc2-ask span { display: none; }
    .cc2-cmp, .cc2-ask { padding: 8px 10px; }
    .cc2-p { font-size: 18px; }
    .cc2-body { padding: 12px 12px 14px; }
}

/* ---------- переключатель «Физлицо / Юрлицо» в панели каталога ---------- */
.cc2-pricemode { display: inline-flex; padding: 3px; border-radius: 12px; border: 1px solid var(--premium-line, #E4E8EF); background: var(--bg-white); }
.cc2-pricemode[hidden] { display: none; }
.cc2-pricemode button {
    border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap;
    font: 700 13px/1.2 'Manrope', sans-serif; color: var(--premium-ink-soft, #5B6472); transition: background .18s, color .18s;
}
.cc2-pricemode button:hover { color: var(--premium-ink, #0B1220); }
.cc2-pricemode button.is-on { background: var(--premium-accent-a, #1E4FE0); color: #fff; }
html[data-theme="dark"] .cc2-pricemode button.is-on { color: #fff; }

/* ---------- разбивка цены при наведении на ⓘ ---------- */
.cc2-pop {
    position: fixed; z-index: 1060; width: 320px; padding: 14px 14px 12px; border-radius: 16px; opacity: 0; visibility: hidden; transform: translateY(4px);
    background: var(--bg-white); color: var(--premium-ink, #0B1220); border: 1px solid var(--premium-line, #E4E8EF);
    box-shadow: 0 24px 50px -16px rgba(16, 24, 40, .45); transition: opacity .16s ease, transform .16s ease, visibility .16s;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
}
.cc2-pop.is-open { opacity: 1; visibility: visible; transform: none; }
.cc2-pop-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cc2-pop-h b { font-size: 14px; font-weight: 800; }
.cc2-pop-h span { padding: 3px 9px; border-radius: 999px; background: var(--premium-chip-bg, #F4F6FA); color: var(--premium-accent-a, #1E4FE0); font-size: 11.5px; font-weight: 800; }
.cc2-pop .pd-row, .cc2-pop .pd-row:nth-child(even) { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 12.5px; line-height: 1.35; background: transparent; border-bottom: 1px dashed var(--premium-line, #E4E8EF); }
.cc2-pop .pd-row .k { color: var(--premium-ink-soft, #5B6472); font-weight: 500; }
.cc2-pop .pd-row .v { color: var(--premium-ink, #0B1220); font-weight: 700; white-space: nowrap; }
.cc2-pop .pd-row.pd-total, html[data-theme="dark"] .cc2-pop .pd-row.pd-total { margin-top: 8px; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--premium-chip-bg, #F4F6FA) !important; }
.cc2-pop .pd-row.pd-total .k { color: var(--premium-ink, #0B1220); font: 800 13px 'Manrope', sans-serif; }
.cc2-pop .pd-row.pd-total .v { color: var(--premium-price, #E23B4F); font: 700 16px 'Unbounded', 'Manrope', sans-serif; }
.cc2-pop-more {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; padding: 9px 12px; border-radius: 11px; cursor: pointer;
    border: 1px solid var(--premium-line, #E4E8EF); background: transparent; color: var(--premium-accent-a, #1E4FE0); font: 700 13px/1.2 'Manrope', sans-serif;
}
.cc2-pop-more:hover { border-color: var(--premium-accent-a, #1E4FE0); }
.cc2-pop-more i { font-size: 11px; }

@media (prefers-reduced-motion: reduce) {
    .car-card.cc2, .car-card.cc2 *, .cc2-pop { transition: none !important; animation: none !important; }
}
