/* Карточка товара: UX-правки. Подключается только на страницах товара (inc/product-ux.php). */

/* ---------- Описание: ширина строки, оглавление, вопросы ---------- */
.eb-desc { max-width: 820px; }
.eb-desc h2 { scroll-margin-top: 96px; margin-top: 36px; }
.eb-desc p, .eb-desc li { line-height: 1.7; }

.eb-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.eb-toc a {
    display: inline-block; padding: 6px 14px; border: 1px solid #d9d9d9; border-radius: 999px;
    background: #fff; color: #222; font-size: 14px; line-height: 1.4; text-decoration: none; white-space: nowrap;
}
.eb-toc a:hover { border-color: #111; }

.eb-faq-list { margin-top: 12px; border-top: 1px solid #e3e3e3; }
.eb-faq { border-bottom: 1px solid #e3e3e3; }
.eb-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; cursor: pointer; list-style: none; }
.eb-faq summary::-webkit-details-marker { display: none; }
.eb-faq summary h3 { margin: 0; font-size: 18px; line-height: 1.35; }
.eb-faq summary::after { content: "+"; flex: none; font-size: 24px; line-height: 1; color: #666; }
.eb-faq[open] summary::after { content: "−"; }
.eb-faq-body { padding: 0 0 14px; }
.eb-faq-body p:last-child { margin-bottom: 0; }

/* ---------- Доставка под кнопкой ---------- */
.eb-delivery { margin-top: 14px !important; font-size: 14px; }
.eb-delivery-list { list-style: none; margin: 0 0 6px; padding: 0; }
.eb-delivery-list li { position: relative; padding-left: 20px; line-height: 1.6; color: #333; }
.eb-delivery-list li::before { content: "✓"; position: absolute; left: 0; color: #3a9d3a; }
.eb-delivery-more { font-size: 13px; text-decoration: underline; color: #555; }

/* ---------- Закреплённая панель покупки (мобильный) ---------- */
.eb-sticky {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 990; display: flex; align-items: center; gap: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -4px 18px rgba(0, 0, 0, .14);
}
.eb-sticky[hidden] { display: none; }
.eb-sticky-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.eb-sticky-name { font-size: 12px; line-height: 1.3; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* цена одной строкой: «від 625 ₴». Старую цену не показываем, а у сумм сбрасываем фиксированную ширину и отступы из стилей сайта. */
.eb-sticky-price { display: flex; align-items: baseline; gap: 4px; font-size: 18px; font-weight: 700; line-height: 1.2; white-space: nowrap; color: #141414; }
.eb-sticky-price .baseprise, .eb-sticky-price del, .eb-sticky-price > span:not([class]) { display: none !important; }
.eb-sticky-price ins { text-decoration: none; background: none !important; color: inherit !important; padding: 0 !important; }
.eb-sticky-price .woocommerce-Price-amount.amount {
    display: inline !important; width: auto !important; margin: 0 !important; padding: 0 !important; overflow: visible !important;
    font-size: 18px !important; line-height: 1.2 !important; text-align: left !important; color: inherit;
}
.eb-sticky-price .woocommerce-Price-currencySymbol { padding: 0 !important; }
.eb-sticky-price .eb-from { font-size: 12px; margin: 0; }
.eb-sticky-cart { position: relative; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid #ddd; border-radius: 10px; background: #fff; color: #111; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.eb-sticky-cart[hidden] { display: none; }
.eb-sticky-count { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #111; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.eb-sticky-count[hidden] { display: none; }
.eb-sticky-btn {
    flex: none; height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: #ffd633; color: #111;
    font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; cursor: pointer;
}
@media (max-width: 359px) {
    .eb-sticky { gap: 8px; padding-left: 10px; padding-right: 10px; }
    .eb-sticky-btn { padding: 0 10px; font-size: 13px; }
}
@media (min-width: 960px) { .eb-sticky { display: none !important; } }

@media (max-width: 959px) {
    /* место под панель и плавающие кнопки выше неё */
    body.eb-sticky-on { padding-bottom: 76px; }
    /* плавающую корзину заменяет значок в панели; у чата остаётся только круглая кнопка, без подписи */
    body.eb-sticky-on .xoo-wsc-basket { display: none !important; }
    body.eb-sticky-on .chaty .on-hover-text,
    body.eb-sticky-on .chaty .chaty-tooltip:before,
    body.eb-sticky-on .chaty .chaty-tooltip:after { display: none !important; }
    body.eb-sticky-on .chaty .chaty-widget, body.eb-sticky-on .chaty-widget { bottom: 88px !important; }

    /* чёрный баннер с названием: компактнее, фото товара выше */
    .single-product .uk-section:has(.tm-element-woo-title) { padding-top: 14px !important; padding-bottom: 14px !important; }
    .single-product .uk-section:has(.tm-element-woo-title) .uk-margin,
    .single-product .uk-section:has(.tm-element-woo-title) .uk-margin-small { margin-top: 4px !important; margin-bottom: 0 !important; }

    /* логотип производителя: небольшая плашка вместо блока на весь экран */
    /* колонку сетки не трогаем (у неё отступ сетки), сжимаем вложенные карточки */
    .eb-brand > .uk-card { padding: 0 !important; background: transparent !important; box-shadow: none !important; }
    .eb-brand .uk-card-default { margin: 0 !important; padding: 8px 0 !important; background: transparent !important; box-shadow: none !important; border-top: 1px solid #e3e3e3; border-bottom: 1px solid #e3e3e3; }
    .eb-brand .el-content { margin-top: 0 !important; }
    .eb-brand .category-image-link { display: inline-block; }
    .eb-brand .category-image-link img { display: block; width: 96px; max-width: 96px; height: auto; border-radius: 6px; }

    /* миниатюры галереи: одна прокручиваемая лента */
    .woocommerce-product-gallery .flex-control-thumbs {
        display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 0 !important; gap: 8px; scrollbar-width: none;
    }
    .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar { display: none; }
    .woocommerce-product-gallery .flex-control-thumbs li { flex: 0 0 64px; width: 64px !important; padding: 0 !important; float: none; clear: none !important; }

    /* якоря описания: на телефоне переносятся на несколько строк, чтобы все были видны */
    .eb-toc { flex-wrap: wrap; gap: 6px; }
    .eb-toc a { padding: 6px 12px; font-size: 14px; }
    .eb-faq summary h3 { font-size: 16px; }
}

/* ---------- Галерея до запуска слайдера ---------- */
/* Шаблон показывает галерею сразу (opacity: 1), и пока слайдер не запустился, фото 2+ стояли плиткой
   по 25% ширины, а потом сжимались в ленту миниатюр. Прячем их и резервируем место под ленту. */
.woocommerce-product-gallery > .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:nth-child(n+2) { display: none; }
.woocommerce-product-gallery:not(:has(.flex-viewport)):has(.woocommerce-product-gallery__image:nth-child(2)) { padding-bottom: calc(100% / 6 + 10px); }
@media (max-width: 959px) {
    .woocommerce-product-gallery:not(:has(.flex-viewport)):has(.woocommerce-product-gallery__image:nth-child(2)) { padding-bottom: 72px; }
}

/* ---------- Подсказка «оберіть фасування» вместо системного окна ---------- */
.eb-choose-note { display: none; margin: 12px 0; padding: 11px 14px 11px 40px; border: 1px solid #f2d36b; border-radius: 12px; background: #fff7d9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a07800' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16.5v.01'/%3E%3C/svg%3E") 13px 12px no-repeat; color: #3d3000; font-size: 15px; line-height: 1.4; }
.eb-choose-note.is-on { display: block; animation: eb-note-in .25s ease; }
.eb-shake { animation: eb-shake .45s ease; }
@keyframes eb-note-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes eb-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

.eb-delivery-more + .eb-delivery-more { margin-left: 14px; }

/* ---------- Отзывы ---------- */
.eb-reviews { max-width: 820px; }
.eb-reviews #review_form textarea { height: 140px; }
.eb-reviews #review_form .form-submit input[type="submit"] { width: auto; padding: 0 32px; }
.eb-reviews .commentlist { padding: 0; list-style: none; }

/* ---------- Фасовки: те же «таблетки», что в карточке каталога ---------- */
.single-product .vi-wpvs-variation-wrap.vi-wpvs-variation-wrap-button { gap: 8px; }
.single-product .vi-wpvs-variation-wrap-button .vi-wpvs-option-wrap {
    display: inline-flex !important; align-items: center; justify-content: center; height: 44px !important; min-width: 0 !important; margin: 0 !important; padding: 0 20px !important;
    border: 1px solid #d5d9cf !important; border-radius: 999px !important; background: #fff !important; box-shadow: none !important; color: #141414 !important;
    cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.single-product .vi-wpvs-variation-wrap-button .vi-wpvs-option-wrap .vi-wpvs-option {
    padding: 0 !important; color: inherit !important; font-family: Roboto, Arial, sans-serif; font-size: 16px !important; font-weight: 500; line-height: 1; white-space: nowrap;
}
.single-product .vi-wpvs-variation-wrap-button .vi-wpvs-option-wrap.vi-wpvs-option-wrap-selected { background: #141414 !important; border-color: #141414 !important; color: #fff !important; }
@media (hover: hover) { .single-product .vi-wpvs-variation-wrap-button .vi-wpvs-option-wrap:not(.vi-wpvs-option-wrap-selected):hover { border-color: #141414 !important; } }
.single-product .vi-wpvs-variation-wrap-button .vi-wpvs-option-tooltip { display: none !important; }
