/* Базовые стили для страницы товара */
.product-page .container {
    display: block;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.breadcrumbs a {
    color: #2196F3;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Product Detail */
.product-detail {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* Важно для предотвращения расширения */
    box-sizing: border-box;
}

/* Images Section */
.product-detail-image {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Галерея изображений */
.image-gallery {
    display: flex;
    gap: 15px;
    height: 600px;
    width: 100%;
}

/* Вертикальные миниатюры слева */
.thumbnails-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100px;
    padding: 5px;
}

.thumbnails-vertical::-webkit-scrollbar {
    width: 6px;
}

.thumbnails-vertical::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.thumbnails-vertical::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.thumbnails-vertical::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.thumbnail-wrapper {
    width: 90px;
    height: 90px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-wrapper:hover {
    border-color: #2196F3;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.thumbnail-wrapper.active {
    border-color: #2196F3;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Поддержка picture для WebP в миниатюрах */
.thumbnail-wrapper picture {
    display: block;
    width: 100%;
    height: 100%;
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

/* Контейнер главного изображения */
.main-image-container {
    flex: 1;
    position: relative;
    background: #fafafa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

/* Поддержка picture для WebP в главном изображении */
#mainImagePicture {
    display: contents;
}

#mainImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 30px;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

#mainImage.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
}

/* Стрелки навигации */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-arrow:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nav-arrow.prev {
    left: 20px;
}

.nav-arrow.next {
    right: 20px;
}

/* Счетчик фото */
.image-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Одиночное изображение */
.single-image {
    background: #fafafa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* padding: 40px; */
    border: 1px solid #e0e0e0;
    min-height: 500px;
    width: 100%;
}

/* Поддержка picture для WebP в одиночном изображении */
.single-image picture {
    display: block;
    width: 100%;
    max-width: 100%;
}

.single-image img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

/* Product Info */
.product-detail-info h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #222;
    word-break: break-all;
}

/* Рейтинг товара */
.product-rating {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-rating .stars {
    color: #FF9800;
    font-size: 20px;
}

.product-rating .rating-value {
    font-weight: 600;
}

.reviews-count {
    color: #666;
    font-size: 14px;
}

.product-price-large {
    font-size: 36px;
    font-weight: 700;
    color: #2196F3;
    margin-bottom: 20px;
}

.product-availability {
    font-size: 16px;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 30px;
    display: inline-block;
}

.product-availability.in-stock {
    color: #2e7d32;
    background: #e8f5e9;
}

.product-availability.out-of-stock {
    color: #c62828;
    background: #ffebee;
}

/* Табы */
.product-tabs {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* Важно для flex-контейнеров */
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f8f9fa;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* Важно для flex-контейнеров */
}

.tabs-header::-webkit-scrollbar {
    height: 4px;
}

.tabs-header::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tabs-header::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.tab-btn {
    padding: 16px 24px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    position: relative;
    flex-shrink: 0; /* Предотвращает сжатие кнопок */
    min-width: 0; /* Разрешает сжатие текста если нужно */
}

.tab-btn:hover {
    color: #2196F3;
    background: rgba(33, 150, 243, 0.05);
}

.tab-btn.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
    background: white;
    font-weight: 600;
}

.tabs-content {
    padding: 30px;
    min-height: 200px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

.tab-content-inner h3 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #222;
}

.tab-content-inner ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.tab-content-inner li {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.6;
}

.tab-content-inner li:last-child {
    border-bottom: none;
}

.tab-content-inner li strong {
    color: #2196F3;
    display: block;
    margin-bottom: 4px;
}

.tab-content-inner p {
    margin: 15px 0 0 0;
    line-height: 1.6;
    color: #666;
}

.brand-description {
    line-height: 1.8;
    color: #444;
    font-size: 15px;
}

.product-characteristics {
    margin-bottom: 0;
}

.product-characteristics h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #222;
}

.product-characteristics table {
    width: 100%;
    border-collapse: collapse;
}

.product-characteristics td {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.product-characteristics td:first-child {
    color: #666;
    width: 40%;
}

.product-characteristics td:last-child {
    font-weight: 500;
}

.product-actions {
    display: flex;
    gap: 15px;
}

.btn-buy,
.btn-back {
    padding: 14px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-buy {
    background: #4CAF50;
    color: white;
    flex: 1;
}

.btn-buy:hover {
    background: #45a049;
}

.btn-back {
    background: #f5f5f5;
    color: #666;
}

.btn-back:hover {
    background: #e0e0e0;
}

.no-image-large {
    color: #999;
    font-size: 18px;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .product-detail {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .product-detail {
        padding: 20px;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .image-gallery {
        flex-direction: column-reverse;
        height: auto;
    }
    
    .thumbnails-vertical {
        flex-direction: row;
        width: 100%;
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .thumbnail-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .main-image-container {
        height: 400px;
    }
    
    .nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .nav-arrow.prev {
        left: 10px;
    }
    
    .nav-arrow.next {
        right: 10px;
    }
    
    /* Адаптивные стили для табов */
    .tabs-header {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        /* Скрываем скроллбар на мобильных для более чистого вида */
        scrollbar-width: thin;
    }
    
    .tab-btn {
        padding: 12px 16px;
        font-size: 14px;
        flex-shrink: 0;
        min-width: fit-content;
    }
    
    /* Ограничиваем ширину контейнера табов на мобильных */
    .product-tabs {
        max-width: calc(100vw - 80px);
        overflow: hidden;
    }
    
    .tabs-content {
        padding: 20px 15px;
    }
    
    .tab-content-inner h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .tab-content-inner li {
        padding: 10px 0;
        font-size: 14px;
    }
    
    .brand-description {
        font-size: 14px;
    }
}