/* ===== PRODUCT PAGE (LIGHT, WB/Y.MARKET STYLE) ===== */

.product-page {
    max-width: 1350px;
    margin: 30px auto;
    padding: 0 20px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #222;
}

.product-title {
    color: #661;
}

/* Белая карточка товара */
.product-card-wrapper {
    background: #ffffff;
    border-radius: 18px;
    padding: 30px 30px 40px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

/* Основная сетка */
.product-container {
    display: grid;
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
    gap: 40px;
}

/* ===== ГАЛЕРЕЯ ===== */

.product-gallery {
    position: relative;
}

.main-image {
    width: 100%;
    height: 480px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #ececec;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.main-image:hover {
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Миниатюры (hover-переключение) */
.thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.thumbnail {
    width: 72px;
    height: 72px;
    background: #ffffff;
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 4px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail:hover,
.thumbnail.active {
    border-color: #ffd700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

/* ===== ПРАВАЯ ЧАСТЬ: ИНФО ===== */

.product-info {
    color: #222;
}

.product-sku {
    font-size: 13px;
    color: #888;
    margin-bottom: 20px;
}

/* Блок цены */
.price-section {
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #eee;
    padding: 18px 20px;
}

.old-price {
    font-size: 16px;
    color: #9a9a9a;
    text-decoration: line-through;
    margin-bottom: 4px;
}

.current-price {
    font-size: 30px;
    font-weight: 800;
    color: #d4a300;
}

/* Кнопка купить */
.buy-btn {
    margin-top: 22px;
    width: 100%;
    padding: 15px 18px;
    font-size: 18px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #ffd700 0%, #ffea6b 100%);
    color: #1a1a1a;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.buy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(0,0,0,0.18);
    filter: brightness(1.02);
}

.buy-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Доставка / условия */
.delivery-info {
    margin-top: 22px;
    background: #f3f6ff;
    border-radius: 12px;
    border: 1px solid #dde5ff;
    padding: 14px 16px;
    font-size: 14px;
    color: #222;
}

.delivery-info p {
    margin: 3px 0;
}

/* ===== ТАБЫ ===== */

.tabs {
    margin-top: 40px;
}

.tab-headers {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 18px;
}

.tab-header {
    padding: 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #777;
    cursor: pointer;
    position: relative;
}

.tab-header.active {
    color: #d4a300;
}

.tab-header.active::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(90deg, #ffd700, #ffed7d);
}

.tab-content {
    display: none;
    font-size: 14px;
    color: #222;
}

.tab-content.active {
    display: block;
}

/* Описание/характеристики немного читаемее */
#description p,
#description li {
    line-height: 1.7;
    font-size: 14px;
}

#specs ul {
    list-style: none;
    padding-left: 0;
}

#specs li {
    padding: 4px 0;
}

/* ===== РЕКОМЕНДОВАННЫЕ ТОВАРЫ (оставляем опенкартовские карточки) ===== */

.related-products {
    margin-top: 50px;
}

/* ===== POPUP КУПИТЬ (мессенджеры) ===== */

.popup-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.popup {
    background: #ffffff;
    padding: 26px 24px 20px;
    border-radius: 16px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.popup h2 {
    font-size: 20px;
    margin-bottom: 18px;
    text-align: center;
    color: #111;
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popup button {
    padding: 12px 14px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* цвета кнопок мессенджеров */
.popup .vk { background:#4680C2; color:#fff; }
.popup .tg { background:#0088cc; color:#fff; }
.popup .wa { background:#25D366; color:#fff; }
.popup .cancel { background:#f2f2f2; color:#333; margin-top: 4px; }

/* FULLSCREEN GALLERY */

.fullscreen-gallery {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 99998;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.fullscreen-gallery img {
    max-width: 96%;
    max-height: 96%;
    object-fit: contain;
}

.gallery-close {
    position: absolute;
    top: 22px;
    right: 30px;
    font-size: 34px;
    color: #fff;
    cursor: pointer;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 46px;
    color: #fff;
    cursor: pointer;
    user-select: none;
}

.gallery-arrow.left { left: 35px; }
.gallery-arrow.right { right: 35px; }

/* ===== АДАПТИВ ===== */

@media (max-width: 991px) {
    .product-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .main-image {
        height: 360px;
    }
}

@media (max-width: 575px) {
    .product-card-wrapper {
        padding: 22px 16px 30px;
    }
    .main-image {
        height: 320px;
    }
    .thumbnails {
        overflow-x: auto;
    }
}

/* ===============================
   ФИКС ВЫЛЕЗАНИЯ КАРТОЧКИ ТОВАРА
================================ */

/* Глобально запрещаем выход за экран */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Основной контейнер страницы товара */
#product-product,
#product-product .container,
#product-product .row,
#product-product #content {
    max-width: 100%;
    overflow-x: hidden;
}

/* Карточка товара */
.product-page,
.product-card-wrapper,
.product-container {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* ===============================
   ИЗОБРАЖЕНИЯ
================================ */
.product-gallery img,
.product-image img,
.thumbnails img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Миниатюры */
.product-gallery,
.thumbnails {
    max-width: 100%;
    overflow: hidden;
}

/* ===============================
   ЗАГОЛОВОК ТОВАРА
================================ */
.product-page h1,
.product-name {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
}

/* ===============================
   ЦЕНА
================================ */
.product-price,
.price,
.price-new {
    max-width: 100%;
    word-break: break-word;
}

/* ===============================
   КНОПКА КУПИТЬ
================================ */
.product-buy,
.product-buy button,
.product-buy .btn,
#button-cart {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* ===============================
   FLEX / GRID ФИКС
================================ */
.product-container,
.product-info,
.product-card-wrapper {
    min-width: 0;
}

/* ===============================
   МОБИЛЬНЫЙ ФИКС
================================ */
@media (max-width: 768px) {
    .product-container,
    .product-gallery,
    .product-info {
        width: 100%;
        max-width: 100%;
    }
}