/*
 * №68 «Вам может понадобиться» (front/templates/pp-related*.blade.php, js/related.js) — подключается на странице товара после
 * product-page.css.
 * Кнопка под оценкой и кодом (компьютер и телефон) → окно: на компьютере — по центру, на телефоне (до 1000 px, как у страницы
 * товара) — во весь экран с жёлтой шапкой, как окно фильтра. Раздел после «Аналогов» (компьютер и телефон): кнопки групп
 * (на телефоне — одна строка, листается пальцем) и лента карточек, как «Аналоги».
 * Пока грузится другая группа, прежние карточки остаются на месте под белой полупрозрачной плёнкой с жёлтым кружком —
 * окно и раздел не сжимаются; в самый первый раз вместо карточек — серые заготовки.
 * Кнопки групп — как значения пикера вариантов (белые с рамкой, выбранная — жёлтая рамка), шапка окна — как у окон сайта.
 */

/* ── кнопка ── */
.vr-open { display: flex; align-items: center; gap: 12px; width: 100%; margin: 4px 0 0; padding: 10px 16px 10px 10px; border: 0;
    border-radius: 10px; background: #F5F6F8; color: #303030; text-align: left; cursor: pointer; transition: background-color .15s; }
.vr-open-imgs { display: flex; flex: 0 0 auto; padding-left: 12px; }
.vr-open-imgs:empty { display: none; }
.vr-open-imgs img { display: block; width: 44px; height: 44px; margin-left: -12px; padding: 3px; border: 2px solid #F5F6F8; border-radius: 10px;
    background: #fff; object-fit: contain; transition: border-color .15s; }
.vr-open-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.vr-open-text b { font-size: 15px; line-height: 20px; font-weight: 700; }
.vr-open-text small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; line-height: 18px; color: #787878; }
.vr-open .pp-chev { width: 7px; height: 12px; color: #787878; }
@media (hover: hover) {
    .vr-open:hover { background: #ECEEF1; }
    .vr-open:hover .vr-open-imgs img { border-color: #ECEEF1; }
    .vr-open:hover .pp-chev { transform: translateX(2px); color: #303030; }
}
.vr-open:focus { outline: none; }
.vr-open:focus-visible { box-shadow: 0 0 0 2px #303030; }

/* ── кнопки групп ── */
.vr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vr-chip { display: inline-flex; align-items: center; flex: 0 0 auto; height: 38px; padding: 0 14px; border: 1px solid #DCDCDC; border-radius: 8px;
    background: #fff; color: #303030; font-size: 14px; line-height: 18px; white-space: nowrap; cursor: pointer;
    transition: border-color .15s, box-shadow .15s; }
/* выбранная — жёлтой рамкой (вторая линия — тенью, чтобы кнопка не «прыгала»), как в пикере вариантов */
.vr-chip.is-on { border-color: #FEDC29; box-shadow: 0 0 0 1px #FEDC29; cursor: default; }
@media (hover: hover) {
    .vr-chip:not(.is-on):hover { border-color: #9E9E9E; }
}
.vr-chip:focus { outline: none; }
.vr-chip:focus-visible { outline: 2px solid #303030; outline-offset: 2px; }
/* первые группы видны, остальные — под «Ещё N групп» (компьютер — .is-extra и .vr-more-d, телефон — .is-extra-m и .vr-more-m) */
.vr-chips .vr-chip.is-extra { display: none; }
.vr-chips.is-open .vr-chip.is-extra { display: inline-flex; }
.vr-more { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px; border: 0; background: none; color: #1C3697;
    font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.vr-more-m { display: none; }
.vr-more svg { width: 12px; height: 8px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .15s; }
.vr-chips.is-open .vr-more svg { transform: rotate(180deg); }
@media (hover: hover) {
    .vr-more:hover { color: #142A78; }
}
.vr-more:focus { outline: none; }
.vr-more:focus-visible { box-shadow: 0 0 0 2px #303030; border-radius: 6px; }

/* ── карточки группы ── */
.vr-pane { position: relative; min-height: 120px; }
.vr-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.vr-grid > .item { width: auto !important; min-width: 0; margin: 0 !important; }
/* «Показать все» — жёлтая кнопка по центру под списком (как кнопки сайта: жёлтая, скругление 6 px), ведёт в раздел */
.vr-all-wrap { display: flex; justify-content: center; margin-top: 20px; }
.vr-pane[data-view="row"] .vr-all-wrap { margin-top: 6px; }
.vr-all-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 240px; height: 44px; padding: 0 28px;
    border-radius: 6px; background: #FEDC29; color: #303030 !important; font-size: 15px; font-weight: 700; line-height: 1;
    text-decoration: none !important; white-space: nowrap; transition: background-color .15s; }
.vr-all-btn .pp-chev { width: 7px; height: 12px; }
@media (hover: hover) {
    .vr-all-btn:hover { background: #FFD600; }
    .vr-all-btn:hover .pp-chev { transform: translateX(2px); }
}
.vr-all-btn:focus { outline: none; }
.vr-all-btn:focus-visible { box-shadow: 0 0 0 3px rgba(254, 220, 41, .45), 0 0 0 1px #303030; }
.vr-empty { margin: 18px 0 0; font-size: 15px; color: #787878; }

/* загрузка: прежние карточки под белой плёнкой, по центру — жёлтый кружок (как заставка сайта); окно не сжимается */
.vr-pane.is-loading > * { pointer-events: none; }
.vr-pane.is-loading::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 5; background: rgba(255, 255, 255, .72); }
.vr-pane.is-loading::before { content: ''; position: absolute; left: 50%; top: 50%; z-index: 6; width: 46px; height: 46px; margin: -23px 0 0 -23px;
    border: 4px solid rgba(254, 220, 41, .35); border-top-color: #FEDC29; border-radius: 50%; animation: vr-spin .8s linear infinite; }
/* в окне список может быть выше экрана — кружок ближе к верху, где его видно */
.vr-pane[data-view="grid"].is-loading::before { top: min(50%, 190px); }
@keyframes vr-spin {
    to { transform: rotate(360deg); }
}
/* серые заготовки карточек — в самый первый раз, пока товаров ещё нет (без плёнки — только кружок поверх);
   видна одна строка заготовок: первая строка — по высоте, лишние уходят в строки нулевой высоты */
.vr-pane.is-first::after { background: none; }
.vr-skel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: 0; gap: 0 12px;
    margin-top: 16px; overflow: hidden; }
.vr-pane[data-view="row"] .vr-skel { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 14px 0 20px; }
.vr-skel i { display: block; height: 420px; border-radius: 12px; background: #EEF0F3; animation: vr-pulse 1.4s ease-in-out infinite; }
@keyframes vr-pulse {
    50% { background: #F6F7F9; }
}
/* ошибка */
.vr-state { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 160px; color: #787878; font-size: 14px; }
.vr-retry { height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: #F0F2F4; color: #303030; font-size: 14px; font-weight: 700;
    cursor: pointer; }
@media (hover: hover) {
    .vr-retry:hover { background: #E4E7EA; }
}

/* ── раздел страницы ── */
.vr-sec .vr-chips { margin-top: 2px; }

/* ── окно ── */
.vr-pop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
    padding: 24px; }
.vr-pop[hidden] { display: none; }
.vr-pop-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(20, 24, 32, .45); }
.vr-pop-dialog { position: relative; display: flex; flex-direction: column; width: 1140px; max-width: 100%; max-height: calc(100vh - 48px);
    border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(20, 24, 32, .25); overflow: hidden; }
.vr-pop-dialog:focus { outline: none; }
.vr-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 auto; padding: 16px 16px 14px 24px;
    background: #FEDC29; }
.vr-pop-head h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 800; color: #303030; }
.vr-pop-x { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0;
    border: 0; border-radius: 8px; background: transparent; cursor: pointer; transition: background-color .15s; }
.vr-pop-x svg { width: 14px; height: 14px; fill: none; stroke: #303030; stroke-width: 2; stroke-linecap: round; }
@media (hover: hover) {
    .vr-pop-x:hover { background: rgba(255, 255, 255, .45); }
}
.vr-pop-x:focus { outline: none; }
.vr-pop-x:focus-visible { box-shadow: 0 0 0 2px #303030; }
.vr-pop-body { flex: 1 1 auto; min-height: 0; padding: 18px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
html.vr-lock, html.vr-lock body { overflow: hidden; }

/* ── экраны ── */
@media (max-width: 1259px) {
    .vr-pane[data-view="row"] .vr-skel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1199px) {
    .vr-grid, .vr-skel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
    .vr-open { margin-top: 2px; }
    /* на телефоне видно меньше групп; раздел страницы — одна строка, листается пальцем, видны все */
    .vr-chips .vr-chip.is-extra { display: inline-flex; }
    .vr-chips .vr-chip.is-extra-m { display: none; }
    .vr-chips.is-open .vr-chip.is-extra-m { display: inline-flex; }
    .vr-more-d { display: none; }
    .vr-more-m { display: inline-flex; }
    .vr-sec .vr-chips { flex-wrap: nowrap; margin: 2px -15px 0; padding: 2px 15px 4px; overflow-x: auto; scrollbar-width: none;
        -webkit-overflow-scrolling: touch; }
    .vr-sec .vr-chips::-webkit-scrollbar { display: none; }
    .vr-sec .vr-chips .vr-chip.is-extra-m { display: inline-flex; }
    .vr-sec .vr-chips .vr-more { display: none; }
    .vr-grid { gap: 10px; }
    .vr-skel { gap: 0 10px; }
    .vr-grid, .vr-skel, .vr-pane[data-view="row"] .vr-skel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vr-skel i { height: 380px; }
    .vr-pane[data-view="row"] .vr-skel { margin-top: 10px; }
    /* окно — во весь экран, как окно фильтра: жёлтая шапка, выезжает снизу */
    .vr-pop { padding: 0; align-items: stretch; }
    .vr-pop-dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; animation: vr-up .25s ease-out; }
    /* шапка окна — пропорционально телефону (правки владельца 2, 22.11: было 18 px, самое жирное) */
    .vr-pop-head { padding: 10px 8px 10px 15px; }
    .vr-pop-head h2 { font-size: 16px; line-height: 22px; font-weight: 700; }
    .vr-all-btn { min-width: 220px; }
    .vr-pop-body { padding: 14px 15px calc(24px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes vr-up {
    from { transform: translateY(48px); opacity: .4; }
    to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .vr-pop-dialog { animation: none; }
    .vr-pane.is-loading::before { animation-duration: 2s; }
    .vr-skel i { animation: none; }
}
