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

.product-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.product-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Оверлей */
.product-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

/* Контент */
.product-modal__content {
    position: relative;
    background: var(--craft-50);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 60px rgba(0,0,0,0.2);
    max-width: 820px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    z-index: 1;
    transform: translateY(20px);
    transition: transform var(--transition-base);
}

.product-modal.active .product-modal__content {
    transform: translateY(0);
}

/* Крестик */
.product-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    background: white;
    border: 1px solid var(--craft-400);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: var(--transition-fast);
}

.product-modal__close:hover {
    background: #fbe9e7;
    border-color: #ef9a9a;
}

/* Body: картинка + инфо */
.product-modal__body {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 28px;
    padding: 28px;
}

/* ── ЛЕВАЯ КОЛОНКА: фото + миниатюры ── */
.product-modal__image-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Главное фото */
.product-modal__image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: zoom-in;
    transition: opacity var(--transition-fast);
}

.product-modal__image:hover {
    opacity: 0.92;
}

/* Миниатюры под главным фото */
.product-modal__thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.product-modal__thumb {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.product-modal__thumb--active,
.product-modal__thumb:hover {
    opacity: 1;
    border-color: var(--green-400);
}

/* Стрелки — скрыты (листалка через миниатюры) */
.product-modal__img-prev,
.product-modal__img-next {
    display: none;
}

/* ── ПРАВАЯ КОЛОНКА: инфо ── */
.product-modal__info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Название */
.product-modal__name {
    font-family: var(--font-accent);
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--craft-900);
    line-height: var(--lh-tight);
    margin: 0;
    padding-right: 32px; /* место под крестик */
}

/* Цены */
.product-modal__prices {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.product-modal__price {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--green-800);
}

.product-modal__price-old {
    font-size: var(--fs-base);
    color: #999;
    text-decoration: line-through;
}

/* Бейдж */
.product-modal__badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    border-radius: var(--radius-status);
    border: 1px solid;
    align-self: flex-start;
}

/* Объём */
.product-modal__volume {
    display: flex;
    gap: 8px;
    font-size: var(--fs-base);
    color: var(--craft-900);
}

.product-modal__volume-label {
    font-weight: var(--fw-semibold);
    color: var(--text-label);
}

/* Количество */
.product-modal__quantity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-modal__quantity-label {
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    color: var(--text-label);
}

.product-modal__quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-modal__qty-btn {
    width: 32px;
    height: 32px;
    border: 2px solid var(--green-150);
    background: white;
    color: var(--green-700);
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-weight: var(--fw-bold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.product-modal__qty-btn:hover {
    background: var(--green-50);
    border-color: var(--green-300);
}

.product-modal__qty-value {
    min-width: 30px;
    text-align: center;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
}

/* Кнопка в корзину */
.product-modal__cart-btn {
    margin-top: 4px;
    align-self: flex-start;
}

/* Описание */
.product-modal__description {
    font-size: var(--fs-sm);
    color: #555;
    line-height: var(--lh-relaxed);
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--craft-400);
}

/* =============================================
   АДАПТИВ МОДАЛКИ
   ============================================= */

@media (max-width: 700px) {
    .product-modal__body {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 16px;
    }

    .product-modal__image {
        height: 240px;
    }

    .product-modal__name {
        font-size: var(--fs-lg);
    }
}

@media (max-width: 480px) {
    .product-modal__content {
        width: 96%;
        max-height: 95vh;
    }

    .product-modal__body {
        padding: 16px;
        gap: 12px;
    }

    .product-modal__image {
        height: 200px;
    }

    .product-modal__name {
        font-size: var(--fs-md);
    }

    .product-modal__price {
        font-size: var(--fs-xl);
    }

    .product-modal__close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .product-modal__cart-btn {
        width: 100%;
    }

    .product-modal__thumb {
        width: 48px;
        height: 48px;
    }
}

/* =============================================
   ЛАЙТБОКС
   ============================================= */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lightbox__overlay {
    position: absolute;
    inset: 0;
}

/* Основное фото */
.lightbox__img {
    position: relative;
    max-width: calc(100vw - 120px);
    max-height: calc(100vh - 150px);
    object-fit: contain;
    border-radius: 8px;
    z-index: 1;
    flex-shrink: 0;
}

/* Закрыть */
.lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox__close:hover {
    background: rgba(255,255,255,0.25);
}

/* Стрелки */
.lightbox__prev,
.lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    margin-top: -36px;
}

.lightbox__prev { left: 16px; }
.lightbox__next { right: 16px; }

.lightbox__prev:hover,
.lightbox__next:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-50%) scale(1.08);
}

.lightbox__prev.hidden,
.lightbox__next.hidden {
    display: none;
}

/* Миниатюры внизу */
.lightbox__thumbs {
    position: relative;
    z-index: 3;
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    max-width: 90vw;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.lightbox__thumbs::-webkit-scrollbar {
    display: none;
}

.lightbox__thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.45;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.lightbox__thumb--active,
.lightbox__thumb:hover {
    opacity: 1;
    border-color: rgba(255,255,255,0.8);
}

/* Счётчик */
.lightbox__counter {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    z-index: 3;
    background: rgba(0,0,0,0.5);
    padding: 3px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Мобильный */
@media (max-width: 600px) {
    .lightbox__prev { left: 8px; }
    .lightbox__next { right: 8px; }

    .lightbox__img {
        max-width: calc(100vw - 80px);
        max-height: calc(100vh - 160px);
    }

    .lightbox__thumb {
        width: 44px;
        height: 44px;
    }
}
.product-modal__variants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0;
}

.product-modal__variant {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 14px;
    border: 2px solid var(--craft-400);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--craft-900);
    transition: border-color 0.2s, background 0.2s;
    line-height: 1.4;
}

.product-modal__variant:hover {
    border-color: var(--green-400);
    background: var(--green-50);
}

.product-modal__variant--active {
    border-color: var(--green-500);
    background: var(--green-50);
    color: var(--green-800);
}

.product-modal__variant:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: var(--craft-400);
    background: #f5f5f5;
}

.product-modal__variant-price {
    font-size: var(--fs-xs);
    color: var(--green-700);
    font-weight: var(--fw-bold);
}

.product-modal__variant-sold {
    font-size: 10px;
    color: var(--color-error);
}
