/* Product Detail Page Styles */

body:has(.product-detail-page) {
    padding-top: 0;
    overflow: auto;
}

.product-detail-page {
    display: flex;
    flex-flow: row nowrap;
    width: 100%;
    position: relative;
    margin-top: 0;
    min-height: 100vh;
}

/* Левый блок с фотографиями (primary) */
.product-images-section {
    width: 50%;
    overflow: hidden;
    z-index: 1;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.product-images-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.product-images-list {
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-image-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 100%;
    position: relative;
    background-color: #f8f8f8;
    /* Используем aspect-ratio 3:4 для резервирования места при lazy loading */
    aspect-ratio: 3 / 4;
}

.product-detail-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
}

.product-detail-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.product-image-main {
    opacity: 0;
    transition: opacity 0.3s ease;
    width: 100%;
    height: auto;
    /* object-fit: contain; - убрано для унификации */
}

.product-image-main.loaded {
    opacity: 1;
}

.product-image-placeholder {
    width: 100%;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    min-height: 400px;
}

.product-image-placeholder svg {
    width: 50%;
    height: 50%;
    opacity: 0.3;
}

/* Правый блок с информацией (secondary) */
.product-info-section {
    display: flex;
    padding: 0;
    flex-direction: column;
    justify-content: flex-end;
    width: 50%;
    box-sizing: border-box;
    position: relative;
}

.product-info-wrapper {
    bottom: var(--scroll-catch, 0);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-height: 100vh;
    position: sticky;
    position: -webkit-sticky;
    top: auto;
    width: 100%;
    align-self: flex-start;
}

.product-info-content {
    padding: 80px 60px 60px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    max-width: 600px;
    margin: auto;
}

/* Название товара */
.product-title {
    font-family: 'AGOpt Cyrillic', 'Sansation', sans-serif;
    font-size: 1.5rem;
    text-transform: uppercase;
    color: #000;
    letter-spacing: 0.05em;
    line-height: 1.3;
    text-align: center;
}

/* Категория товара */
.product-category {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 300;
    text-transform: capitalize;
}

/* Цена */
.product-price {
    font-size: 1rem;
    color: #000;
    margin-bottom: 40px;
    font-weight: 400;
    text-align: center;
}

/* Размеры */
.product-sizes-section {
    /* margin-bottom: 20px; */
}

.product-sizes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 15px;
}

.size-link {
    padding: 0;
    background: none;
    color: #000000;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 10px 2px;
    border-radius: 3px;
    font-family: inherit;
    width: 35px;
    height: 35px;
}

.size-link:hover:not(.unavailable):not(:disabled) {
    color: #000000;
    /* border-color: #000; */
    background-color: #f5f5f5;
}

.size-link.unavailable,
.size-link:disabled {
    color: #AAAAAA;
    pointer-events: none;
    cursor: default;
}

.size-link.selected {
    border-color: transparent!important;
    background-color: #f5f5f5;
    font-weight: 600;
}

/* Кнопки "с лого" / "без лого" */
.product-logo-options-section {
    margin-bottom: 20px;
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: -10px;
}

/* Цвета */
.product-colors-section {
    margin-bottom: 40px;
}

.product-group-colors {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-link {
    width: 15px;
    height: 15px;
    border-radius: 50px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: block;
    flex-shrink: 0;
    box-shadow: 1px 1px 0px rgba(0,0,0,0.2);
    text-decoration: none;
}

.color-link.active {
    width: 24px;
    height: 24px;
    border: 1px solid #fff;
}

.color-link:hover {
    transform: scale(1.1);
}

/* Кнопка "В корзину" */
.product-add-to-cart-section {
    margin-bottom: 60px;
}

/* Кнопки используют стили из common.css */
.btn-add-to-cart {
    /* Расширяет .btn .btn-primary из common.css */
    width: 100%;
    padding: 16px 24px;
    background-color: #000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 3px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Ссылка "добавить в желания" */
.add-to-wishlist-link {
    display: flex;
    align-items: end;
    text-align: center;
    margin: auto;
    margin-top: 12px;
    color: var(--mm-color-text-muted);
    font-size: 0.75rem;
    font-weight: 300;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    gap: 5px;
}

.add-to-wishlist-link:hover {
    color: #000;
    /* text-decoration: underline; */
}

.add-to-wishlist-icon.active {
    filter: brightness(0) saturate(100%) invert(27%) sepia(100%) saturate(7500%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.btn-add-to-cart:hover:not(.disabled):not(:disabled) {
    background-color: #333;
}

.btn-add-to-cart.disabled,
.btn-add-to-cart:disabled {
    background-color: #f5f5f5;
    color: var(--mm-color-text-light);
    border-color: #e0e0e0;
    cursor: not-allowed;
}

/* Разворачивающиеся закладки */
.product-tabs {
    border-top: 1px solid #e0e0e0;
}

.product-tab {
    border-bottom: 1px solid #e0e0e0;
}

.product-tab-header {
    width: 100%;
    padding: 15px 0;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    text-align: left;
    color: #000;
    transition: color 0.2s;
}

.product-tab-header:hover {
    color: #666;
}

.tab-arrow {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: #666;
}

.product-tab.active .tab-arrow {
    transform: rotate(90deg);
}

.product-tab-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.product-tab.active .product-tab-content {
    max-height: 2000px;
}

.tab-content-inner {
    padding: 0 0 20px 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #666;
}

.tab-content-inner p {
    margin-bottom: 10px;
}

.tab-content-inner ul {
    margin: 10px 0;
    padding-left: 20px;
}

.product-carousel-section {
    position: relative;
}

.product-carousel-section .product-sizes {
    gap: 12px;
}

.product-carousel-section .product-info {
    padding: 12px 0;
}

.product-carousel-title {
    text-align: center;
    text-transform: uppercase;
    pointer-events: none;
    position: absolute;
    margin-top: -60px;
    right: 0;
    left: 0;
}

/* Header всегда зафиксирован вверху, прозрачный без фона и тени (только на десктопе) */
body:has(.product-detail-page) .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: none;
    box-shadow: none;
}

/* Убираем класс scrolled на странице товара (только на десктопе) */
body:has(.product-detail-page) .site-header.scrolled {
    background: none;
    box-shadow: none;
}

/* На мобильных устройствах header работает как обычно */
@media (max-width: 767px) {
    body:has(.product-detail-page) .site-header {
        background-color: #ffffff;
    }
    
    body:has(.product-detail-page) .site-header.scrolled {
        background-color: #ffffff;
        box-shadow: rgba(0, 0, 0, 0.08) 0 2px 5px;
    }
    
    /* Отступ для .site-main на высоту header (70px) */
    body:has(.product-detail-page) .site-main {
        padding-top: 70px;
    }
}

/* Поведение скроллинга - CSS-only решение */
/* Блоки автоматически скроллятся вместе благодаря sticky positioning */

/* Responsive */
@media (max-width: 1024px) {

    
    /* .product-info-content {
        padding: 40px 30px;
    } */
}


@media (max-width: 768px) {
    .product-detail-page {
        flex-direction: column;
    }
    
    .product-images-section {
        width: 100%;
        height: auto;
        /* max-height: 70vh; */
        position: relative;
    }
    
    .product-info-section {
        width: 100%;
        height: auto;
    }

    .product-info-wrapper {
        min-height: initial;
        padding-top: 50px;
    }

    .product-info-content {
        padding: 30px 20px;
    }
}


