/* ===================================
   PRODUCT MODAL STYLES
   =================================== */

.product-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
}

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

.product-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.product-modal__container {
    position: absolute;
    inset: 0;
    background: white;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow-y: auto;
}

.product-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    width: 50px;
    height: 50px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 30px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.product-modal__close:hover {
    background: var(--gray-100);
    transform: rotate(90deg);
}

/* Gallery */
.product-modal__gallery {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

.product-modal__main-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.product-modal__main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius-lg);
}

.product-modal__thumbnails {
    display: flex;
    gap: 10px;
    padding: 1rem 2rem;
    overflow-x: auto;
}

.product-modal__thumbnails img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
    border: 2px solid transparent;
}

.product-modal__thumbnails img.active,
.product-modal__thumbnails img:hover {
    opacity: 1;
    border-color: var(--primary);
}

/* Info */
.product-modal__info {
    padding: 3rem;
    overflow-y: auto;
}

.product-modal__title {
    font-size: var(--text-3xl);
    margin-bottom: var(--spacing-md);
}

.product-modal__price-block {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: var(--spacing-lg);
}

.product-modal__price {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--primary);
}

.product-modal__content {
    margin: var(--spacing-lg) 0;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: var(--text-base);
}

.feature-item svg {
    color: var(--success);
    flex-shrink: 0;
}

/* Form */
.product-modal__form {
    background: var(--gray-50);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    margin: var(--spacing-lg) 0;
}

.product-modal__form h3 {
    margin-bottom: 1rem;
}

.product-modal__form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-modal__form input,
.product-modal__form textarea {
    padding: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    font-family: inherit;
}

.product-modal__form input:focus,
.product-modal__form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Guarantees */
.product-modal__guarantees {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
}

.guarantee-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-sm);
    color: var(--gray-600);
}

/* Tabs */
.product-modal__tabs {
    display: flex;
    gap: 1rem;
    margin: var(--spacing-lg) 0;
    border-bottom: 2px solid var(--gray-200);
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    padding: var(--spacing-md) 0;
}

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

/* Responsive */
@media (max-width: 768px) {
    .product-modal__container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .product-modal__gallery {
        /* position: relative;
        height: 60vh; */
        position: relative;      /* убираем sticky, чтобы не мешал */
        height: auto;            /* вместо 60vh, чтобы не ломать пропорции */
        display: flex;
        flex-direction: row;     /* РЯДОМ: слева фото, справа превью */
        align-items: stretch;
    }

    .product-modal__main-image {
        flex: 1 1 auto;
        padding: 1rem;
    }

    .product-modal__main-image img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    .product-modal__thumbnails {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;   /* превью в колонку */
        gap: 8px;
        padding: 1rem 0.5rem 1rem 0;
        overflow-y: auto;         /* вертикальный скролл, если много фото */
        overflow-x: hidden;
        max-height: 100%;         /* подстраивается по высоте блока */
    }

    .product-modal__thumbnails img {
        width: 60px;
        height: 60px;
    }
    
    .product-modal__info {
        padding: 2rem 1rem;
    }
    
    .product-modal__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}
/* ===================================
   MODAL ENHANCEMENTS
   Gallery Navigation, Specs Table, Accordions
   =================================== */

/* Gallery Navigation Arrows */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 32px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-nav:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

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

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

/* Thumbnails Enhancement */
.modal__thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 90, 56, 0.2);
}

.thumbnail:hover {
    border-color: var(--secondary-color);
}

/* Specs Table */
.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.specs-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

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

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

.spec-key {
    font-weight: 600;
    color: var(--text-dark);
    width: 40%;
}

.spec-value {
    color: var(--text-secondary);
}

.no-specs {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

/* Accordion Styles */
.product-accordion {
    margin-top: 30px;
}

.accordion-item {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion-item:hover {
    border-color: var(--primary-color);
}

.accordion-header {
    padding: 16px 20px;
    background: #f9f9f9;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
}

.accordion-header:hover {
    background: #f0f0f0;
}

.accordion-header.active {
    background: var(--primary-color);
    /* color: white; */
}

.accordion-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-header.active .accordion-icon path {
    stroke: white;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.accordion-content.active {
    max-height: 1000px;
}

.accordion-inner {
    padding: 20px;
    background: white;
}

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

.accordion-inner li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.accordion-inner strong {
    color: var(--text-dark);
}

.accordion-inner p {
    margin: 10px 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Price Display in Modal */
.new-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.old-price {
    font-size: 20px;
    color: var(--text-secondary);
    text-decoration: line-through;
    margin-left: 10px;
}

/* Modal Description */
#modalDescription {
    margin: 20px 0;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 15px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .gallery-nav-prev {
        left: 10px;
    }
    
    .gallery-nav-next {
        right: 10px;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .spec-key {
        width: 50%;
        font-size: 14px;
    }
    
    .spec-value {
        font-size: 14px;
    }
    
    .accordion-header h3 {
        font-size: 14px;
    }
    
    .new-price {
        font-size: 24px;
    }
    
    .old-price {
        font-size: 18px;
    }
}
