/* ============================================
   product.css - СТИЛИ СТРАНИЦЫ ТОВАРА
   ============================================ */

/* ============================================
   ОБЩИЕ СТИЛИ
   ============================================ */

* { box-sizing: border-box; }

.product-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.product-container {
    background: transparent;
    padding: 0;
}

.product-back {
    margin-bottom: 24px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: #999;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.3s;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.back-btn:hover {
    color: #000;
}

.product-layout {
    display: flex;
    gap: 50px;
}

/* ============================================
   ГАЛЕРЕЯ
   ============================================ */

.product-gallery {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.gallery-main {
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/5;
    cursor: zoom-in;
    position: relative;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    will-change: transform;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.gallery-main img.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
}

.gallery-main img.fade-transition {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0.3; transform: scale(1.02); }
    to { opacity: 1; transform: scale(1); }
}

.gallery-arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 12px;
    pointer-events: none;
    z-index: 5;
}

.gallery-arrow {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.gallery-arrow:hover {
    background: rgba(255,255,255,1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: scale(1.05);
}

.gallery-arrow:active {
    transform: scale(0.95);
}

.gallery-arrow.hidden {
    opacity: 0;
    pointer-events: none;
}

.gallery-counter-badge {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 3;
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.gallery-thumbs::-webkit-scrollbar {
    height: 3px;
}

.gallery-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.gallery-thumb {
    width: 80px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: #f0f0f0;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.gallery-thumb:hover {
    border-color: #ccc;
}

.gallery-thumb.active {
    border-color: #000;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none !important;
    outline: none !important;
}

/* ============================================
   ИНФОРМАЦИЯ О ТОВАРЕ
   ============================================ */

.product-info {
    flex: 1;
    min-width: 280px;
}

.product-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.product-prices {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding-bottom: 0;
}

.price-current {
    font-size: 1.5rem;
    font-weight: 700;
}

.price-old {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
}

.price-discount {
    background: #f0f0f0;
    color: #000;
    padding: 2px 12px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
}

.product-sizes-section {
    margin-bottom: 20px;
    padding-bottom: 0;
}

.sizes-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 12px;
}

.sizes-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.size-btn {
    padding: 10px 24px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.size-btn:hover:not(.out-of-stock):not(:disabled) {
    border-color: #000;
    background: #f8f8f8;
}

.size-btn.active {
    background: #000;
    color: white;
    border-color: #000;
}

.size-btn.out-of-stock {
    opacity: 0.3;
    cursor: not-allowed;
}

.size-stock-info {
    font-size: 0.8rem;
    color: #999;
    margin-top: 6px;
    font-weight: 400;
}

.product-quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 0;
}

.qty-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

/* ============================================
   КНОПКИ КОЛИЧЕСТВА
   ============================================ */

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    width: fit-content;
    background: #ffffff;
}

.qty-btn {
    background: #ffffff;
    border: none;
    padding: 8px 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a1a1a;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.qty-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.qty-value {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a1a;
    padding: 8px 0;
    background: #ffffff;
}

/* ============================================
   КНОПКА ДОБАВЛЕНИЯ В КОРЗИНУ
   ============================================ */

.add-to-cart-btn {
    width: 100% !important;
    padding: 16px;
    background: #000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: block;
    text-align: center;
    box-sizing: border-box;
}

.add-to-cart-btn:hover:not(:disabled) {
    background: #222;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.add-to-cart-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   ОПИСАНИЕ / ХАРАКТЕРИСТИКИ
   ============================================ */

.product-description {
    padding-top: 4px;
}

.product-description h3 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 12px;
}

.product-description ul {
    list-style: none;
}

.product-description li {
    padding: 6px 0;
    font-size: 0.9rem;
    color: #444;
    border-bottom: 1px solid #f5f5f5;
}

.product-description li:last-child {
    border-bottom: none;
}

.product-description li::before {
    content: "— ";
    color: #ccc;
}

.product-stock-info {
    margin-bottom: 20px;
    padding-bottom: 0;
}

.in-stock {
    font-weight: 500;
    color: #000;
}

.out-of-stock-text {
    color: #999;
    font-weight: 500;
}

.no-sizes {
    color: #999;
    font-size: 0.9rem;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО - ВСЁ ТЁМНОЕ
   ============================================ */

.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.96) !important;
    z-index: 9999999 !important;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.gallery-modal.show {
    display: flex !important;
    opacity: 1 !important;
}

/* БЛОКИРУЕМ ПРОКРУТКУ */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* ХЕДЕР НИЖЕ МОДАЛКИ */
.header {
    z-index: 9999998 !important;
    position: relative;
}

.header-actions {
    z-index: 9999998 !important;
    position: relative;
}

/* ВСЁ ЧТО СНАРУЖИ МОДАЛКИ - НЕ КЛИКАБЕЛЬНО */
.gallery-modal ~ * {
    pointer-events: none !important;
}

/* ============================================
   ЭЛЕМЕНТЫ ВНУТРИ МОДАЛКИ
   ============================================ */

/* ИЗОБРАЖЕНИЕ */
.gallery-modal .modal-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 100000000 !important;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto !important;
    border-radius: 0;
    box-shadow: none;
    background: transparent !important;
}

.gallery-modal .modal-image.zoomed-modal {
    transform: scale(1.8);
    cursor: zoom-out;
}

/* СТРЕЛКИ НАВИГАЦИИ */
.gallery-modal .modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.05) !important;
    border: none;
    padding: 20px 24px;
    cursor: pointer;
    z-index: 100000000 !important;
    transition: all 0.3s ease;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 80px;
    pointer-events: auto !important;
}

.gallery-modal .modal-nav:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}

.gallery-modal .modal-nav.prev {
    left: 24px;
}

.gallery-modal .modal-nav.next {
    right: 24px;
}

/* СЧЕТЧИК */
.gallery-modal .modal-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 0.9rem;
    letter-spacing: 1px;
    z-index: 100000000 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    padding: 6px 18px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none !important;
}

/* МИНИАТЮРЫ */
.gallery-modal .modal-thumbs {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    max-width: 80%;
    overflow-x: auto;
    padding: 8px 12px;
    z-index: 100000000 !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-modal .modal-thumbs::-webkit-scrollbar {
    height: 3px;
}

.gallery-modal .modal-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-modal .modal-thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.gallery-modal .modal-thumb {
    width: 60px;
    height: 75px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.4;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

.gallery-modal .modal-thumb.active {
    border-color: rgba(255, 255, 255, 0.8) !important;
    opacity: 1;
}

.gallery-modal .modal-thumb:hover {
    opacity: 0.8;
}

.gallery-modal .modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent !important;
}

/* ============================================
   УБИРАЕМ БЕЛЫЙ ФОН У ИЗОБРАЖЕНИЙ
   ============================================ */

.gallery-modal .modal-image[src=""],
.gallery-modal .modal-image:not([src]) {
    background: transparent !important;
}

/* ============================================
   АДАПТИВ
   ============================================ */

@media (max-width: 992px) {
    .product-layout {
        gap: 30px;
    }
    
    .gallery-thumb {
        width: 70px;
        height: 90px;
    }
}

@media (max-width: 768px) {
    .product-page {
        padding: 12px;
    }
    
    .product-layout {
        flex-direction: column;
        gap: 24px;
    }
    
    .product-gallery {
        min-width: auto;
        width: 100%;
    }
    
    .gallery-main {
        aspect-ratio: 1/1.2;
        border-radius: 10px;
    }
    
    .gallery-thumb {
        width: 60px;
        height: 75px;
    }
    
    .product-name {
        font-size: 1.4rem;
    }
    
    .price-current {
        font-size: 1.3rem;
    }
    
    .gallery-arrow {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .gallery-modal .modal-nav {
        font-size: 1.8rem;
        padding: 14px 16px;
        min-width: 44px;
        min-height: 60px;
    }
    
    .gallery-modal .modal-nav.prev {
        left: 12px;
    }
    
    .gallery-modal .modal-nav.next {
        right: 12px;
    }
    
    .gallery-modal .modal-image {
        max-width: 95%;
        max-height: 80vh;
    }
    
    .gallery-modal .modal-thumb {
        width: 50px;
        height: 63px;
    }
    
    .gallery-modal .modal-thumbs {
        bottom: 70px;
        gap: 6px;
        padding: 6px 10px;
    }
    
    .size-btn {
        padding: 8px 18px;
        font-size: 0.8rem;
    }
    
    .qty-btn {
        padding: 8px 14px;
        font-size: 1rem;
    }
    
    .add-to-cart-btn {
        padding: 14px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .product-page {
        padding: 8px;
    }
    
    .product-back {
        margin-bottom: 16px;
    }
    
    .product-layout {
        gap: 16px;
    }
    
    .gallery-main {
        aspect-ratio: 1/1.3;
        border-radius: 8px;
    }
    
    .gallery-thumb {
        width: 50px;
        height: 63px;
        border-radius: 6px;
    }
    
    .gallery-thumbs {
        gap: 6px;
        margin-top: 10px;
    }
    
    .gallery-arrow {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        padding: 0;
    }
    
    .gallery-counter-badge {
        font-size: 0.6rem;
        padding: 3px 10px;
        bottom: 12px;
        right: 12px;
    }
    
    .product-name {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .product-prices {
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .price-current {
        font-size: 1.1rem;
    }
    
    .price-old {
        font-size: 0.85rem;
    }
    
    .sizes-label, .qty-label {
        font-size: 0.6rem;
        margin-bottom: 8px;
    }
    
    .size-btn {
        padding: 6px 14px;
        font-size: 0.75rem;
        border-radius: 6px;
    }
    
    .sizes-options {
        gap: 6px;
    }
    
    .qty-controls {
        border-radius: 6px;
    }
    
    .qty-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .qty-value {
        min-width: 32px;
        font-size: 0.9rem;
    }
    
    .add-to-cart-btn {
        padding: 12px;
        font-size: 0.75rem;
        border-radius: 6px;
        margin-bottom: 16px;
    }
    
    .product-description h3 {
        font-size: 0.6rem;
        margin-bottom: 8px;
    }
    
    .product-description li {
        font-size: 0.8rem;
        padding: 4px 0;
    }
    
    .gallery-modal .modal-nav {
        font-size: 1.4rem;
        padding: 10px 12px;
        min-width: 36px;
        min-height: 48px;
        border-radius: 8px;
    }
    
    .gallery-modal .modal-nav.prev {
        left: 6px;
    }
    
    .gallery-modal .modal-nav.next {
        right: 6px;
    }
    
    .gallery-modal .modal-image {
        max-width: 98%;
        max-height: 75vh;
    }
    
    .gallery-modal .modal-image.zoomed-modal {
        transform: scale(2.2);
    }
    
    .gallery-modal .modal-thumb {
        width: 35px;
        height: 45px;
    }
    
    .gallery-modal .modal-thumbs {
        bottom: 60px;
        gap: 4px;
        padding: 4px 8px;
    }
    
    .gallery-modal .modal-counter {
        font-size: 0.75rem;
        bottom: 24px;
        padding: 4px 14px;
    }
}

@media (max-width: 360px) {
    .gallery-thumb {
        width: 40px;
        height: 50px;
    }
    
    .size-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .qty-btn {
        padding: 4px 10px;
        font-size: 0.8rem;
        min-width: 28px;
    }
    
    .qty-value {
        min-width: 28px;
        font-size: 0.8rem;
        padding: 4px 0;
    }
}

/* ============================================
   МОБИЛЬНЫЕ УЛУЧШЕНИЯ ДЛЯ СТРАНИЦЫ ТОВАРА
   ============================================ */

@media (max-width: 768px) {
    /* Галерея на всю ширину */
    .product-gallery {
        min-width: auto;
        width: 100%;
    }
    
    .gallery-main {
        aspect-ratio: 1 / 1.2;
        border-radius: 8px;
    }
    
    /* Миниатюры меньше */
    .gallery-thumb {
        width: 55px;
        height: 70px;
        border-radius: 4px;
    }
    
    /* Информация о товаре */
    .product-name {
        font-size: 1.3rem;
    }
    
    .price-current {
        font-size: 1.2rem;
    }
    
    /* Размеры */
    .size-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Количество */
    .qty-btn {
        padding: 8px 14px;
        font-size: 1.1rem;
        min-height: 40px;
        min-width: 40px;
    }
    
    .qty-value {
        min-width: 30px;
        font-size: 1rem;
    }
    
    /* Кнопка добавления в корзину */
    .add-to-cart-btn {
        padding: 14px;
        font-size: 0.85rem;
        min-height: 50px;
    }
}

@media (max-width: 480px) {
    .gallery-main {
        aspect-ratio: 1 / 1.3;
        border-radius: 6px;
    }
    
    .gallery-thumb {
        width: 45px;
        height: 58px;
    }
    
    .gallery-arrow {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .product-name {
        font-size: 1.1rem;
    }
    
    .price-current {
        font-size: 1rem;
    }
    
    .size-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
        min-height: 38px;
    }
    
    .qty-btn {
        padding: 6px 12px;
        font-size: 1rem;
        min-height: 36px;
        min-width: 36px;
    }
    
    .add-to-cart-btn {
        padding: 12px;
        font-size: 0.75rem;
        min-height: 44px;
    }
}

/* ===== ЖЕСТЫ ДЛЯ ГАЛЕРЕИ НА ТЕЛЕФОНАХ ===== */
@media (pointer: coarse) {
    .gallery-main {
        cursor: default;
        touch-action: pan-y;
    }
    
    .gallery-arrow {
        background: rgba(255,255,255,0.85);
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   КРЕСТИК ЗАКРЫТИЯ В МОДАЛЬНОМ ОКНЕ
   ============================================ */

.gallery-modal .modal-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100000001 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: auto !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.gallery-modal .modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.gallery-modal .modal-close-btn:active {
    transform: scale(0.9);
}

.gallery-modal .modal-close-btn svg {
    width: 24px;
    height: 24px;
}

.gallery-modal .modal-close-btn svg path {
    stroke: #ffffff;
    stroke-width: 2.5;
}

/* ===== НА МАЛЕНЬКИХ ТЕЛЕФОНАХ ===== */
@media (max-width: 480px) {
    .gallery-modal .modal-close-btn {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
    
    .gallery-modal .modal-close-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 360px) {
    .gallery-modal .modal-close-btn {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
    }
    
    .gallery-modal .modal-close-btn svg {
        width: 18px;
        height: 18px;
    }
}