/**
 * ==============================================
 * СТИЛИ СТРАНИЦЫ ТОВАРА - PREMIUM VERSION
 * Интернет-магазин тюнинга квадроциклов
 * ==============================================
 *
 * Цели файла:
 * 1. Сделать product page самой сильной страницей сайта
 * 2. Усилить визуальное ощущение “дорогого товара”
 * 3. Улучшить галерею, цену, CTA, табы и похожие товары
 * 4. Сохранить совместимость с текущим HTML
 *
 * ==============================================
 */


/* ============================================== */
/* ОСНОВНОЙ ЛЭЙАУТ СТРАНИЦЫ ТОВАРА */
/* ============================================== */
.product-section {
    padding: 46px 0 80px;
}

.product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 56px;
    margin-bottom: 70px;
}


/* ============================================== */
/* ГАЛЕРЕЯ */
/* ============================================== */
/**
 * Галерея должна ощущаться как showcase area:
 * - большая площадка изображения
 * - глубокая поверхность
 * - аккуратные миниатюры
 */
.product-gallery {
    position: relative;
}

.main-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    background:
        radial-gradient(circle at center, rgba(255,255,255,0.05), rgba(255,255,255,0.015)),
        #111;
    box-shadow: 0 22px 60px rgba(0,0,0,0.38);
    cursor: zoom-in;
}

.main-image::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 35%;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.16));
    pointer-events: none;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: auto;
    transition: transform 0.4s ease;
}

.image-zoom-lens {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(2px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.03);
}

.main-image:hover .image-zoom-lens {
    opacity: 1;
}

.image-zoom-result {
    position: absolute;
    top: 0;
    left: calc(100% + 18px);
    width: 420px;
    height: 420px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    z-index: 20;
    pointer-events: none;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.06);
    background:
        radial-gradient(circle at center, rgba(255,255,255,0.05), rgba(255,255,255,0.015)),
        #141414;
    box-shadow: 0 22px 60px rgba(0,0,0,0.42);
    transition: opacity 0.2s ease;
}

.image-zoom-result img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-image:hover .image-zoom-result {
    opacity: 1;
    visibility: visible;
}

.thumbnail-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.thumbnail-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    transition: all 0.28s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}

.thumbnail-item:hover {
    border-color: var(--border-accent);
    transform: translateY(-3px);
}

.thumbnail-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,90,31,0.16), 0 14px 30px rgba(255,90,31,0.12);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}


/* ============================================== */
/* ПРАВАЯ ИНФОРМАЦИОННАЯ КОЛОНКА */
/* ============================================== */
.product-info {
    padding-top: 8px;
}

.product-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.badge-hit {
    background: var(--badge-hit);
}
.badge-new {
    background: var(--badge-new);
}
.badge-sale {
    background: var(--badge-sale);
}

.product-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--text-tertiary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.product-brand-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.product-brand-link:hover {
    color: var(--accent);
}

.product-model-text {
    color: var(--text-tertiary);
}

.product-title {
    font-size: clamp(2rem, 2.8vw, 3rem);
    line-height: 1.12;
    margin-bottom: 14px;
    font-weight: 800;
}

.product-sku {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-bottom: 24px;
}

.sku-value {
    color: #fff;
    font-weight: 700;
}


/* ============================================== */
/* БЛОК ЦЕНЫ */
/* ============================================== */
/**
 * Цену выделяем как один из ключевых акцентов страницы.
 */
.product-price-wrapper {
    margin-bottom: 26px;
}

.price-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)),
        rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 14px 36px rgba(0,0,0,0.20);
}

.current-price {
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--accent);
    text-shadow: 0 0 18px rgba(255,90,31,0.12);
}

.old-price {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.price-saving {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(0, 200, 83, 0.10);
    border: 1px solid rgba(0, 200, 83, 0.24);
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
}


/* ============================================== */
/* КРАТКОЕ ОПИСАНИЕ */
/* ============================================== */
.product-short-desc {
    color: var(--text-secondary);
    line-height: 1.9;
    margin-bottom: 28px;
    font-size: 15px;
}


/* ============================================== */
/* БЛОК ПОКУПКИ */
/* ============================================== */
.product-purchase {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 28px;
}

.quantity-selector {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}

.quantity-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover:not(:disabled) {
    background: var(--accent);
}

.quantity-input {
    width: 62px;
    height: 42px;
    border: none;
    background: transparent;
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
}

.quantity-input:focus {
    outline: none;
}

.product-purchase .btn {
    min-height: 54px;
    padding-left: 24px;
    padding-right: 24px;
}


/* ============================================== */
/* TRUST / ГАРАНТИИ */
/* ============================================== */
.product-guarantees {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 18px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)),
        rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
}

.guarantee-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: 18px;
    background: rgba(255,255,255,0.02);
    transition: var(--transition);
}

.guarantee-item:hover {
    background: var(--accent-light);
    color: #fff;
}

.guarantee-item svg {
    color: var(--accent);
}


/* ============================================== */
/* ТАБЫ */
/* ============================================== */
/**
 * Табы должны смотреться как premium-nav внутри страницы.
 */
.product-tabs {
    margin-top: 70px;
    margin-bottom: 70px;
}

.tabs-header {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tab-btn {
    padding: 12px 20px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 999px;
    background: rgba(255,255,255,0.02);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: #fff;
    border-color: var(--border-hover);
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #ff8554);
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(255,90,31,0.18);
}

.tab-pane {
    display: none;
    padding: 10px 0;
}

.tab-pane.active {
    display: block;
    animation: fadeInProductTab 0.35s ease;
}

@keyframes fadeInProductTab {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-description {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.95;
}

.product-description p {
    margin-bottom: 16px;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
        rgba(255,255,255,0.01);
    border: 1px solid rgba(255,255,255,0.06);
}

.specs-table tr {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.specs-table tr:last-child {
    border-bottom: none;
}

.specs-table tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

.specs-table td {
    padding: 16px 18px;
}

.spec-key {
    width: 240px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.spec-value {
    color: #fff;
}

.no-specs {
    text-align: center;
    color: var(--text-secondary);
    padding: 36px;
}

.compatibility-info {
    padding: 22px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
        rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-secondary);
    line-height: 1.85;
}

.compatibility-info p {
    margin-bottom: 10px;
}

.compatibility-info strong {
    color: #fff;
}

.compatibility-note {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--accent-light);
    border: 1px solid var(--border-accent);
    color: #fff;
}

.instruction-info {
    padding: 34px;
    text-align: center;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
        rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.06);
}

.instruction-info p {
    color: var(--text-secondary);
    margin-bottom: 18px;
}


/* ============================================== */
/* ПОХОЖИЕ ТОВАРЫ */
/* ============================================== */
.similar-products {
    margin-top: 70px;
}

.similar-products .section-title {
    margin-bottom: 18px;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}


/* ============================================== */
/* LIGHTBOX */
/* ============================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(4,4,4,0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    pointer-events: none;
    border-radius: 18px;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10001;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: var(--accent);
    transform: scale(1.04);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-caption {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 13px;
    backdrop-filter: blur(8px);
}


/* ============================================== */
/* АДАПТАЦИЯ ДЛЯ ПЛАНШЕТОВ */
/* ============================================== */
@media (max-width: 992px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .product-gallery {
        max-width: 620px;
        margin: 0 auto;
    }

    .image-zoom-result {
        display: none;
    }

    .similar-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ============================================== */
/* АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ */
/* ============================================== */
@media (max-width: 768px) {
    .product-section {
        padding: 30px 0 60px;
    }

    .product-title {
        font-size: 1.75rem;
    }

    .price-block {
        padding: 16px;
    }

    .current-price {
        font-size: 2rem;
    }

    .old-price {
        font-size: 15px;
    }

    .product-purchase {
        flex-direction: column;
        align-items: stretch;
    }

    .product-purchase .btn {
        width: 100%;
    }

    .quantity-selector {
        width: 100%;
        justify-content: center;
    }

    .product-guarantees {
        grid-template-columns: 1fr;
    }

    .guarantee-item {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }

    .similar-grid {
        grid-template-columns: 1fr;
    }

    .tabs-header {
        overflow-x: auto;
        flex-wrap: nowrap;
        white-space: nowrap;
        padding-bottom: 4px;
    }

    .specs-table td {
        display: block;
        width: 100%;
        padding: 12px 14px;
    }

    .spec-key {
        width: 100%;
        padding-bottom: 0;
    }

    .spec-value {
        padding-top: 6px;
    }

    .lightbox-close,
    .lightbox-nav {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 480px) {
    .main-image {
        border-radius: 22px;
    }

    .thumbnail-list {
        grid-template-columns: repeat(4, 1fr);
    }

    .lightbox-nav {
        display: none;
    }
}

/* ============================================== */
/* FIX: ПОЛНОЕ НАЗВАНИЕ ТОВАРА НА СТРАНИЦЕ ТОВАРА */
/* ============================================== */
/**
 * Основной заголовок товара не должен обрезаться.
 * Убираем ограничения, которые пришли из карточек каталога.
 */
.product-layout .product-info > .product-title {
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    overflow: visible !important;
    min-height: 0 !important;
    height: auto !important;
    white-space: normal !important;
    text-overflow: unset !important;
    word-break: break-word;
}

/* ============================================== */
/* FIX: ПОЛНОЕ НАЗВАНИЕ В БЛОКЕ "ВАМ ТАКЖЕ МОЖЕТ ПОНРАВИТЬСЯ" */
/* ============================================== */
/**
 * Для похожих товаров даём больше свободы заголовку:
 * - убираем жёсткую фиксированную высоту
 * - оставляем нормальный перенос строк
 */
.similar-products .product-title {
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    overflow: visible !important;
    min-height: 0 !important;
    height: auto !important;
    white-space: normal !important;
    text-overflow: unset !important;
    word-break: break-word;
    font-size: 14px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    margin-bottom: 10px;
}

.similar-products .product-title a {
    font-size: inherit;
    line-height: inherit;
}

/* Немного увеличим отступ снизу, чтобы длинные названия выглядели аккуратно */
.similar-products .product-info {
    align-items: stretch;
}

.similar-products .product-price-wrapper {
    margin-top: 10px;
}

/* ============================================== */
/* ПЛАТНЫЕ ХАРАКТЕРИСТИКИ / PAID OPTIONS */
/* ============================================== */
/**
 * Этот блок отвечает за платные опции на странице товара.
 *
 * Цели:
 * - сделать визуально понятным, что это дополнительные опции
 * - не перегрузить страницу
 * - сохранить premium-визуал
 * - сделать хороший mobile UX
 */

.product-paid-options {
    margin-top: 18px;
    margin-bottom: 26px;
    padding: 20px 18px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
        rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}

.product-paid-options-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.paid-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.paid-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: var(--transition);
}

.paid-option-item:hover {
    border-color: rgba(255,90,31,0.16);
    background: var(--accent-light);
    transform: translateY(-2px);
}

.paid-option-item input {
    display: none;
}

.paid-option-custom {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.18);
    background: transparent;
    position: relative;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.paid-option-item input:checked + .paid-option-custom {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(255,90,31,0.08);
}

.paid-option-item input:checked + .paid-option-custom::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.paid-option-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.paid-option-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    word-break: break-word;
}

.paid-option-price {
    flex-shrink: 0;
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

/* Состояние активной выбранной опции */
.paid-option-item input:checked + .paid-option-custom + .paid-option-info .paid-option-name {
    color: #fff;
    font-weight: 600;
}

.paid-option-item input:checked + .paid-option-custom + .paid-option-info .paid-option-price {
    color: #ff8a60;
}

/* ============================================== */
/* АДАПТАЦИЯ ДЛЯ ПЛАТНЫХ ОПЦИЙ */
/* ============================================== */
@media (max-width: 768px) {
    .product-paid-options {
        padding: 16px 14px;
        border-radius: 20px;
        margin-top: 14px;
        margin-bottom: 22px;
    }

    .product-paid-options-title {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .paid-option-item {
        padding: 12px 12px;
        border-radius: 16px;
    }

    .paid-option-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .paid-option-name {
        font-size: 13px;
    }

    .paid-option-price {
        font-size: 13px;
    }
}

/* ==============================================
   SIMILAR PRODUCTS - CARD ALIGNMENT OVERRIDE
   Версия: 1.0.0
   Назначение:
   1. Приведение блока похожих товаров к общей карточной системе
   ============================================== */

.similar-products .similar-grid {
    align-items: stretch;
}

.similar-products .product-card {
    min-height: 100%;
}

.similar-products .product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.similar-products .product-meta {
    min-height: 18px;
    margin-bottom: 8px;
}

.similar-products .product-title {
    min-height: 40px !important;
    margin-bottom: 10px;
}

.similar-products .product-price-wrapper {
    margin-top: auto;
    margin-bottom: 14px;
}

.similar-products .product-actions {
    margin-top: auto;
}

.similar-products .product-actions .btn {
    min-height: 40px;
    font-size: 10px;
}
/* ==============================================
   LIGHTBOX IMAGE SWITCH ANIMATION
   Версия: 1.0.0
   Назначение:
   1. Плавная смена изображения в lightbox
   2. Поддержка swipe-переходов
   ============================================== */

#lightboxImage {
    transition: opacity 0.22s ease, transform 0.22s ease;
    opacity: 1;
    transform: scale(1);
}

#lightboxImage.is-switching {
    opacity: 0.18;
    transform: scale(0.985);
}