/* ========================================
   МОДАЛЬНОЕ ОКНО ТОВАРА
   ======================================== */

.modal-product {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-product.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Overlay */
.modal-product__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

/* Контент модального окна */
.modal-product__content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    margin: 5vh auto;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

/* Кнопка закрытия */
.modal-product__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.modal-product__close:hover {
    background-color: var(--accent-blue);
    transform: rotate(90deg);
}

.modal-product__close svg {
    color: var(--text-primary);
}

/* Тело модального окна */
.modal-product__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px;
}

/* ========== ГАЛЕРЕЯ ========== */
.modal-product__gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gallery__main {
    width: 100%;
    aspect-ratio: 1280 / 1067;
    background-color: var(--surface-alt);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.gallery__thumb {
    aspect-ratio: 1280 / 1067;
    background-color: var(--surface-alt);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.gallery__thumb:hover {
    border-color: var(--accent-blue);
}

.gallery__thumb.active {
    border-color: var(--accent-blue);
}

.gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========== ИНФОРМАЦИЯ ========== */
.modal-product__info {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.product-modal__title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.product-modal__price {
    display: flex;
    align-items: center;
    gap: 15px;
}

.price-current {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-blue);
}

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

/* Наличие товара */
.product-modal__stock {
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
}

.product-modal__stock.in-stock {
    color: var(--success);
    background-color: rgba(76, 175, 80, 0.1);
}

.product-modal__stock.out-of-stock {
    color: var(--text-secondary);
    background-color: rgba(255, 152, 0, 0.1);
}

/* Атрибуты */
.product-modal__attributes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px;
    background-color: var(--card-bg);
    border: 1px solid var(--divider);
    border-radius: 8px;
}

.attribute-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    background-color: var(--surface-alt);
    border-radius: 4px;
}

.attribute-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attribute-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Действия */
.product-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
}

/* ========== ОПИСАНИЕ ========== */
.modal-product__description {
    padding: 30px 40px;
    border-top: 1px solid var(--border-color);
}

.modal-product__description h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.modal-product__description p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Сохранение форматирования текста (отступы, пробелы) */
.modal-product__description #productDescription {
    white-space: pre-wrap;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 968px) {
    .modal-product__body {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
    }
    
    .product-modal__title {
        font-size: 1.5rem;
    }
    
    .price-current {
        font-size: 2rem;
    }
    
    .modal-product__description {
        padding: 20px;
    }
    
    .product-modal__attributes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .modal-product__content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-product__body {
        padding: 20px 15px;
    }
    
    .gallery__thumbs {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .product-modal__actions {
        position: sticky;
        bottom: 0;
        background-color: var(--card-bg);
        padding: 15px;
        margin: 0 -15px;
        border-top: 1px solid var(--border-color);
    }
}

