/* =========================================================
   Nicecar — WooCommerce (woocommerce.css)
   Подключается только на страницах магазина / товара / корзины / оформления / аккаунта.
   ========================================================= */

/* --------- 17. Product single ---------- */
.product-single { padding-top: var(--px25); padding-bottom: var(--px40); }
@media (min-width: 1024px) {
    .product-single { padding-top: var(--px40); padding-bottom: var(--px50); }
}

/* Хлебные крошки на карточке: 15px до шапки и 15px до товара. */
.single-product .site-main.shop { padding-top: 15px; }
.single-product .breadcrumbs { margin-bottom: 15px; }
.single-product .product-single { padding-top: 0; }
.product-single__layout {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    align-items: flex-start;
}
.product-single__gallery,
.product-single__summary {
    width: 100%;
    min-width: 0;
}
/* На мобильных/планшетах ограничиваем галерею, чтобы не растягивалась на весь экран. */
.product-single__gallery { max-width: 560px; margin-left: auto; margin-right: auto; }
@media (min-width: 1024px) {
    .product-single__layout { flex-direction: row; flex-wrap: nowrap; }
    .product-single__gallery,
    .product-single__summary { flex: 0 0 calc(50% - var(--gap) / 2); max-width: calc(50% - var(--gap) / 2); }
    .product-single__gallery { margin-left: 0; margin-right: 0; }
}

.product-gallery {
    display: flex; flex-direction: column; gap: var(--px10);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Обёртка главного изображения — даёт высоту через padding-bottom. */
.product-gallery__main-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}
.product-gallery__main {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.product-gallery--single .product-gallery__main {
    display: flex; align-items: center; justify-content: center;
}
.product-gallery--single .product-gallery__main img {
    width: 100%; height: 100%; object-fit: contain;
}
.product-gallery__main .swiper-wrapper {
    width: 100%;
    height: 100%;
}
.product-gallery__main .swiper-slide {
    width: 100%;
    height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--white);
    flex-shrink: 0;
}
.product-gallery__main .swiper-slide img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.product-gallery__main .swiper-button-prev,
.product-gallery__main .swiper-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    margin: 0;
}
.product-gallery__main .swiper-button-prev { left: 10px; }
.product-gallery__main .swiper-button-next { right: 10px; }

/* Миниатюры. */
.product-gallery__thumbs {
    width: 100%;
    height: 80px;
    padding: 0;
    overflow: hidden;
    position: relative;
}
@media (min-width: 768px) { .product-gallery__thumbs { height: 96px; } }
@media (min-width: 1024px) { .product-gallery__thumbs { height: 110px; } }

.product-gallery__thumbs .swiper-wrapper {
    height: 100% !important;
    display: flex;
}
.product-gallery__thumbs .swiper-slide {
    height: 100% !important;
    width: auto !important;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    opacity: .55;
    transition: opacity var(--tr), border-color var(--tr);
    background: var(--white);
    aspect-ratio: 1 / 1;
}
.product-gallery__thumbs .swiper-slide img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.product-gallery__thumbs .swiper-slide-thumb-active,
.product-gallery__thumbs .swiper-slide.is-active {
    opacity: 1;
    border-color: var(--red);
}

/* Подстраховка без JS / до инициализации Swiper. */
.product-gallery__main:not(.swiper-initialized) .swiper-slide ~ .swiper-slide {
    display: none;
}
.product-gallery__thumbs:not(.swiper-initialized) {
    display: flex;
    gap: 8px;
}
.product-gallery__thumbs:not(.swiper-initialized) .swiper-wrapper {
    display: flex; gap: 8px;
}

.summary__title { margin: 0 0 var(--px10); }
.summary__price { font-size: 26px; font-weight: 800; color: var(--red); margin-bottom: var(--px15); }

/* Множитель количества рядом с ценой: «×3». В гамме бейджа «В наличии». */
.summary__price .price-qty-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #e8f5ea;
    border: 1px solid #bbe1c2;
    color: #176c2a;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    vertical-align: middle;
    white-space: nowrap;
    animation: nc-price-badge-pop .18s ease;
}
@keyframes nc-price-badge-pop {
    from { transform: scale(.75); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .summary__price .price-qty-badge { animation: none; }
}
.summary__excerpt { color: var(--text-muted); margin-bottom: var(--px15); }
.summary__actions { display: flex; gap: var(--gap); flex-wrap: wrap; margin: var(--px15) 0; align-items: flex-end; }
.summary__meta { color: var(--text-muted); font-size: 14px; }

/* Блок мессенджеров и соцсетей в single-product. */
.summary__messengers {
    margin-top: var(--px15);
    padding: var(--px15);
    background: var(--grey);
    border-radius: var(--radius);
    text-align: center;
    font-size: 24px;
    line-height: 1.3;
    color: var(--text-muted);
}
.summary__messengers-label {
    display: block;
    margin-bottom: 12px;
}
.summary__messengers-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
.summary__msg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
}
.summary__msg svg { width: 24px; height: 24px; }
.summary__msg--viber { background: #7360f2; }
.summary__msg--wa    { background: #25d366; }
.summary__msg--tg    { background: #229ed9; }
.summary__msg--vk    { background: #4a76a8; }
.summary__msg--ig    { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

/* Сквозной блок «Проложить маршрут» (QR-код + кнопка) — общий для всех товаров,
   настройки во вкладке «Карточка товара». По умолчанию виден только на мобильных и планшетах. */
.summary__route {
    margin-top: var(--px15);
    padding: var(--px15);
    background: var(--grey);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: var(--px15);
}
.summary__route-qr {
    flex: 0 0 auto;
    width: 108px;
    height: 108px;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.summary__route-qr svg { width: 100%; height: 100%; display: block; }
.summary__route-body { min-width: 0; flex: 1 1 auto; text-align: left; }
.summary__route-title { margin: 0 0 6px; font-weight: 800; }
.summary__route-text { margin: 0 0 12px; color: var(--text-muted); font-size: 14px; line-height: 1.45; }
.summary__route-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; }

/* С десктопа блок скрыт, пока не включён чекбокс «Показывать и на десктопе». */
@media (min-width: 1024px) {
    .summary__route { display: none; }
    .summary__route--desktop { display: flex; }
}

@media (max-width: 400px) {
    /* На самых узких экранах QR уходит наверх, текст и кнопка — под ним. */
    .summary__route { flex-direction: column; align-items: stretch; text-align: center; }
    .summary__route-qr { align-self: center; }
    .summary__route-body { text-align: center; }
}


/* Характеристики. */
.summary__specs.specs { margin: var(--px15) 0 var(--px20); padding: 16px 18px; background: var(--grey); border-radius: var(--radius); }
.specs__title { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.specs__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.specs__item { display: flex; align-items: baseline; gap: 6px; font-size: 14px; line-height: 1.4; }
.specs__name { color: var(--text-muted); flex: 0 0 auto; }
.specs__dots { flex: 1 1 auto; border-bottom: 1px dotted var(--border); transform: translateY(-3px); min-width: 12px; }
.specs__value { color: var(--black); font-weight: 600; flex: 0 0 auto; text-align: right; }

/* Quantity ± */
.qty-control { display: flex; flex-direction: column; gap: 6px; }
.qty-control__label { font-size: 13px; color: var(--text-muted); }
.qty-control__row { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: max-content; background: var(--white); }
.qty-control__btn { width: 40px; height: 44px; background: transparent; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--black); transition: background .15s ease; padding: 0; }
.qty-control__btn:hover { background: var(--grey); }
.qty-control__input { width: 56px; height: 44px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font-size: 16px; font-weight: 600; -moz-appearance: textfield; background: var(--white); color: var(--black); padding: 0; }
.qty-control__input::-webkit-outer-spin-button,
.qty-control__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Блокировка после добавления в корзину. */
.qty-control.is-locked { opacity: .55; pointer-events: none; }
.qty-control.is-locked .qty-control__btn { cursor: not-allowed; color: var(--text-muted); }
.qty-control.is-locked .qty-control__input { background: var(--grey); color: var(--text-muted); }
/* Скрытие выбора количества (предзаказ/нет в наличии). */
.qty-control.is-hidden { display: none; }

/* Variations */
.variations__row { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--px15); }
.variations__label { font-weight: 600; }
.variations__list { display: flex; flex-wrap: wrap; gap: 8px; }
.variation-pill {
    border: 1px solid var(--border); border-radius: 999px;
    padding: 6px 14px; background: var(--white); color: var(--black);
    transition: all var(--tr); font-size: 14px;
}
.variation-pill:hover { border-color: var(--red); }
.variation-pill.is-active { background: var(--black); color: var(--white); border-color: var(--black); }

/* Variation custom dropdown с миниатюрами */
.variation-select {
    position: relative;
    width: 100%;
    max-width: 320px;
}
.variation-select__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 8px 14px;
    min-height: 56px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--black);
    font: inherit;
    cursor: pointer;
    transition: border-color var(--tr), box-shadow var(--tr);
    text-align: left;
}
.variation-select__toggle:hover { border-color: var(--red); }
.variation-select.is-open .variation-select__toggle {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(229, 57, 53, .15);
}
.variation-select__current {
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 0;
}
.variation-select__current-img {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background: var(--grey);
}
.variation-select__current-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.variation-select__caret {
    width: 10px; height: 10px;
    border-right: 2px solid var(--black);
    border-bottom: 2px solid var(--black);
    transform: rotate(45deg);
    margin-bottom: 4px;
    transition: transform var(--tr);
    flex-shrink: 0;
}
.variation-select.is-open .variation-select__caret {
    transform: rotate(-135deg);
    margin-bottom: -4px;
}

.variation-select__list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    z-index: 20;
    max-height: 320px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--tr), transform var(--tr), visibility var(--tr);
}
.variation-select.is-open .variation-select__list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.variation-select__item { padding: 0; }
.variation-select__option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    color: var(--black);
    font: inherit;
    transition: background var(--tr), border-color var(--tr);
}
.variation-select__option:hover { background: var(--grey); }
.variation-select__option.is-active {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}
.variation-select__option-img {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background: var(--grey);
}
.variation-select__option-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------- 25. Product FAQ (для GEO / AI) ---------- */
.product-faq {
    margin-top: var(--px40);
    padding-top: var(--px25);
    border-top: 1px solid var(--border);
}
.product-faq__title {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 700;
}
@media (min-width: 1024px) {
    .product-faq__title { font-size: 26px; }
}
.product-faq__list {
    display: flex; flex-direction: column;
    gap: 8px;
}
.product-faq__item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}
.product-faq__item[open] {
    border-color: var(--red);
    box-shadow: 0 2px 12px rgba(225, 6, 0, .06);
}
.product-faq__q {
    list-style: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    font-weight: 700; font-size: 15px;
    color: var(--black);
    transition: color var(--tr), background var(--tr);
}
.product-faq__q::-webkit-details-marker { display: none; }
.product-faq__q:hover { color: var(--red); background: #fafafa; }
.product-faq__q-text { flex: 1; }
.product-faq__q-icon {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--grey);
    position: relative;
    transition: background var(--tr), transform var(--tr);
}
.product-faq__q-icon::before,
.product-faq__q-icon::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    background: var(--black);
    transition: opacity var(--tr), background var(--tr);
}
.product-faq__q-icon::before { width: 10px; height: 2px; transform: translate(-50%, -50%); }
.product-faq__q-icon::after  { width: 2px; height: 10px; transform: translate(-50%, -50%); }
.product-faq__item[open] .product-faq__q-icon { background: var(--red); }
.product-faq__item[open] .product-faq__q-icon::before,
.product-faq__item[open] .product-faq__q-icon::after { background: #fff; }
.product-faq__item[open] .product-faq__q-icon::after { opacity: 0; }
.product-faq__a {
    padding: 0 18px 16px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    border-top: 1px solid var(--border);
}
.product-faq__a-text p { margin: 12px 0 0; }
.product-faq__a-text p:first-child { margin-top: 12px; }

/* --------- 27. Shop layout + Categories sidebar ---------- */
.shop-layout {
    display: flex; gap: var(--gap); align-items: flex-start;
    margin-top: var(--px20);
}
.shop-layout__sidebar {
    display: none; /* мобильные */
    width: 260px; flex-shrink: 0;
}
.shop-layout__main { flex: 1; min-width: 0; }
@media (min-width: 1024px) {
    .shop-layout__sidebar { display: block; }
}

/* Кнопка «Все категории» на мобильном. */
.cat-sidebar-mobile-btn-wrap { margin: var(--px15) 0; }
.cat-sidebar-mobile-btn { font-size: 14px; }
@media (min-width: 1024px) {
    .cat-sidebar-mobile-btn-wrap { display: none; }
}

/* Cat sidebar */
.cat-sidebar__title {
    font-size: 16px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .5px;
    margin: 0 0 12px; padding-bottom: 10px;
    border-bottom: 2px solid var(--red);
}
.cat-sidebar__list { display: flex; flex-direction: column; gap: 0; }
.cat-sidebar__item { border-bottom: 1px solid var(--border); }
.cat-sidebar__row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.cat-sidebar__link {
    display: block; flex: 1;
    padding: 10px 0;
    color: var(--black); font-weight: 600; font-size: 16px;
    text-decoration: none;
    transition: color var(--tr);
}
.cat-sidebar__link:hover { color: var(--red); }
.cat-sidebar__link--active { color: var(--red); font-weight: 800; }
.cat-sidebar__link--child { padding: 8px 0 8px 16px; font-weight: 500; font-size: 15px; }
.cat-sidebar__count { color: var(--text-muted); font-weight: 400; font-size: 12px; margin-left: 4px; }

.cat-sidebar__toggle {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; background: var(--grey); border-radius: 50%;
    color: var(--black); cursor: pointer;
    transition: background var(--tr), transform var(--tr);
    flex-shrink: 0;
}
.cat-sidebar__toggle:hover { background: var(--red); color: #fff; }
.cat-sidebar__item.is-open > .cat-sidebar__row > .cat-sidebar__toggle { transform: rotate(180deg); }

.cat-sidebar__sub {
    padding: 0 0 8px; margin: 0;
    display: flex; flex-direction: column;
}
.cat-sidebar__sub[hidden] { display: none; }
.cat-sidebar__subitem { border: 0; }

/* Cat drawer (мобильный — слева). */
.cat-drawer {
    position: fixed; inset: 0; z-index: 200;
    pointer-events: none;
}
.cat-drawer[hidden] { display: none; }
.cat-drawer.is-open { pointer-events: auto; }
.cat-drawer__overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .3s ease;
}
.cat-drawer.is-open .cat-drawer__overlay { opacity: 1; }
.cat-drawer__panel {
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 300px; max-width: 85vw;
    background: var(--white);
    box-shadow: 10px 0 40px rgba(0,0,0,.15);
    transform: translateX(-100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.cat-drawer.is-open .cat-drawer__panel { transform: translateX(0); }
.cat-drawer__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--px15) var(--px20);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cat-drawer__title { font-size: 18px; font-weight: 700; }
.cat-drawer__close {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--black); border: 0;
    font-size: 28px; line-height: 1; cursor: pointer; border-radius: 50%;
    transition: background var(--tr);
}
.cat-drawer__close:hover { background: var(--grey); }
.cat-drawer__body { flex: 1; overflow-y: auto; padding: var(--px20); }
@media (min-width: 1024px) {
    .cat-drawer { display: none !important; }
}

/* Длинные заголовки и названия в блоковой корзине не расширяют страницу. */
.wp-block-woocommerce-cart .wp-block-heading,
.wp-block-woocommerce-cart .wc-block-components-product-name {
    overflow-wrap: anywhere;
}
