/* ============================================================ */
/* МОДАЛКА ТОВАРА */
/* ============================================================ */
.product-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    justify-content: flex-end;
    align-items: flex-end;
}
.product-modal-overlay.active { display: flex; }

.product-modal-content {
    width: 100%;
    height: 100%;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease forwards;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-image-section {
    position: relative;
    height: 60%;
    background: #f4f4f5;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.modal-close-btn:hover {
    background: white;
    transform: scale(1.05);
}

.modal-main-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.modal-slider {
    display: flex;
    flex-wrap: nowrap;
    height: 100%;
    transition: transform 0.3s ease;
}

.modal-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-slide img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
    transition: background 0.2s;
    z-index: 10;
}
.modal-nav:hover { background: white; }
.modal-nav.prev { left: 10px; }
.modal-nav.next { right: 10px; }

.image-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}
.image-dots span {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #d1d5db;
    transition: 0.3s;
}
.image-dots span.active { background: var(--primary-green); width: 16px; border-radius: 4px; }

.modal-info-section {
    flex: 1;
    background: var(--white);
    padding: 20px 20px 100px 20px;
    overflow-y: auto;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    margin-top: -20px;
    position: relative;
    z-index: 2;
}
.modal-handle {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    color: #9ca3af;
    cursor: pointer;
}

.modal-info-content h2 {
    font-size: 22px; font-weight: 600; margin-bottom: 6px;
}
.modal-price {
    font-size: 20px; font-weight: 700; color: var(--text-dark); margin-bottom: 16px;
}
.modal-variants {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.modal-variant-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    font-size: 13px; font-weight: 500; color: var(--text-dark);
    cursor: pointer; transition: 0.2s;
}
.modal-variant-btn.active { border-color: var(--primary-green); color: var(--primary-green); }

.modal-divider { height: 1px; background: var(--border); margin: 16px 0; }

.modal-desc h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.modal-desc #modalDescText {
    font-size: 14px; line-height: 1.6; color: var(--text-gray);
}
.modal-desc #modalDescText b { color: var(--text-dark); }

.modal-footer {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    padding: 16px 20px 24px 20px;
    background: var(--white);
    border-top: 1px solid var(--border);
}
.buy-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px; font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.buy-btn:hover { background: #2d5f53; }

@media (min-width: 768px) {
    .product-modal-overlay { align-items: center; justify-content: center; }
    .product-modal-content { max-width: 400px; height: 90vh; border-radius: 20px; }
    .modal-image-section { height: 50%; border-radius: 20px 20px 0 0; }
}

/* ============================================================ */
/* КОРЗИНА */
/* ============================================================ */
.cart-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: flex-end;
}
.cart-overlay.active { display: flex; }

.cart-modal {
    width: 100%; max-width: 480px;
    height: 100%;
    background: var(--white);
    display: flex; flex-direction: column;
    animation: slideRight 0.3s ease forwards;
}
@keyframes slideRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.cart-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid var(--border);
}
.cart-header h2 { font-size: 18px; font-weight: 600; }
.cart-close-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-gray); }

.cart-items { flex: 1; overflow-y: auto; padding: 20px; }
.empty-cart { text-align: center; color: var(--text-gray); margin-top: 40px; }
.cart-item {
    display: flex; gap: 12px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border); padding-bottom: 16px;
}
.cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 14px; font-weight: 500; }
.cart-item-price { font-size: 13px; color: var(--text-gray); margin-top: 4px; }

.cart-footer {
    padding: 20px; border-top: 1px solid var(--border);
    background: var(--white);
}
.cart-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.checkout-btn {
    width: 100%; padding: 14px; background: var(--primary-green); color: white;
    border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.checkout-btn:hover { background: #2d5f53; }

/* ============================================================ */
/* ОФОРМЛЕНИЕ ЗАКАЗА */
/* ============================================================ */
.checkout-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}
.checkout-overlay.active { display: flex; }

.checkout-modal {
    width: 92%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--white);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease forwards;
}

.checkout-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid var(--border);
}
.checkout-header h2 { font-size: 18px; font-weight: 600; color: var(--text-dark); }
.checkout-close-btn {
    background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-gray); padding: 4px;
}

.checkout-body { flex: 1; overflow-y: auto; padding: 20px; }
.checkout-product {
    display: flex; gap: 14px; align-items: center;
    padding: 12px; background: #f8f9fa; border-radius: 12px;
}
.checkout-product-img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.checkout-product-name { font-size: 15px; font-weight: 500; color: var(--text-dark); margin-bottom: 4px; }
.checkout-product-price { font-size: 14px; color: var(--text-gray); }
.checkout-divider { height: 1px; background: var(--border); margin: 20px 0; }

.checkout-form { display: flex; flex-direction: column; gap: 12px; }
.checkout-input, .checkout-textarea {
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
    font-size: 15px; font-family: inherit; background: #fff; transition: border-color 0.2s; color: var(--text-dark);
}
.checkout-input:focus, .checkout-textarea:focus {
    outline: none; border-color: var(--primary-green); box-shadow: 0 0 0 3px rgba(61, 123, 109, 0.1);
}
.checkout-input::placeholder, .checkout-textarea::placeholder { color: #9ca3af; }
.checkout-textarea { resize: vertical; min-height: 50px; }

.checkout-footer { padding: 20px; border-top: 1px solid var(--border); background: var(--white); }
.checkout-total {
    display: flex; justify-content: space-between; font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text-dark);
}
.checkout-submit-btn {
    width: 100%; padding: 14px; background: var(--primary-green); color: white;
    border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: background 0.2s;
}
.checkout-submit-btn:hover { background: #2d5f53; }
.checkout-submit-btn:active { transform: scale(0.98); }

@media (min-width: 768px) { .checkout-modal { max-height: 80vh; } }