/* Shared Product Modal CSS — single source of truth for all product pages */

/* ==================== OVERLAY ==================== */
.product-modal,
.product-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.product-modal.active,
.product-modal-overlay.active {
    display: flex;
}

/* ==================== MODAL CONTAINER ==================== */
.product-modal-content,
.product-modal-overlay > .product-modal {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 480px;
    max-width: 90vw;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

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

/* ==================== CLOSE BUTTON ==================== */
.product-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    box-shadow: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.product-modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    color: white;
}

.modal-handle { display: none; }

/* ==================== IMAGE / GALLERY ==================== */
.modal-gallery,
.product-modal-image {
    position: relative;
    width: 100%;
    height: 440px;
    max-height: 440px;
    overflow: hidden;
    background: var(--warm-cream, #FEFEFE);
    border-radius: 16px 16px 0 0;
}

.modal-gallery-wrapper {
    display: flex;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.modal-gallery-wrapper::-webkit-scrollbar { display: none; }

.modal-gallery-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: flex-start;
}

.modal-gallery-slide img,
.product-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--warm-cream, #FEFEFE);
}

.modal-gallery-slide .emoji-fallback {
    font-size: 6rem;
}

/* Gallery arrows */
.modal-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--terracotta, #E0AA9A);
    transition: all 0.3s;
}

.modal-gallery-arrow:hover {
    background: var(--terracotta, #E0AA9A);
    color: white;
}

.modal-gallery-prev { left: 12px; }
.modal-gallery-next { right: 12px; }

/* Gallery dots */
.modal-gallery-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.modal-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-gallery-dot.active {
    background: white;
    transform: scale(1.2);
}

/* ==================== DETAILS AREA ==================== */
.product-modal-details,
.product-modal-body {
    padding: 20px 24px 24px;
}

.modal-product-name,
.product-modal-name {
    font-family: 'Lato', sans-serif;
    font-size: 18px;
    color: #444;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-product-price,
.product-modal-price {
    font-size: 18px;
    font-weight: 600;
    color: #c9a590;
}

.modal-product-description,
.product-modal-desc {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Read More — desktop: hidden */
.desc-read-more {
    display: none;
}

/* Selectors */
#modalColorSelector select,
#modalSizeSelector select {
    font-size: 14px;
    padding: 8px;
    font-weight: 500;
}

/* Add-ons */
#modalAddOns label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

/* Add to cart button */
.modal-add-to-cart,
.product-modal-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--terracotta, #E0AA9A), #d4917d);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-add-to-cart:hover,
.product-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 112, 74, 0.3);
    opacity: 0.95;
}

/* Share button in gallery */
#modalShareBtn {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s;
}

#modalShareBtn:hover {
    background: rgba(0, 0, 0, 0.7);
}

#modalShareBtn svg {
    stroke: white !important;
}

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
    .product-modal-content,
    .product-modal-overlay > .product-modal {
        width: min(340px, 90vw);
        max-width: 340px;
        max-height: 85vh;
        border-radius: 16px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .product-modal-body {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .modal-gallery,
    .product-modal-image {
        height: auto;
        max-height: none;
        aspect-ratio: 1;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal-gallery img,
    .modal-gallery-slide img,
    .product-modal-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: var(--warm-cream, #FEFEFE);
    }

    .modal-gallery-arrow { display: none !important; }

    .modal-gallery-indicators { bottom: 6px; }
    .modal-gallery-dot { width: 6px; height: 6px; }

    .product-modal-details,
    .product-modal-body {
        padding: 1rem;
    }

    .product-modal-details h2,
    .modal-product-name,
    .product-modal-name {
        font-size: 15px !important;
        font-weight: 600;
        color: #777 !important;
        margin-bottom: 0;
    }

    .modal-product-price,
    .product-modal-price {
        font-size: 13px !important;
        color: #d4b5a5 !important;
        margin-bottom: 0;
    }

    .modal-product-description,
    .product-modal-desc {
        font-size: 12px !important;
        margin: 0.5rem 0;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.4;
        color: #888;
        font-weight: 600;
    }

    .modal-product-description.expanded,
    .product-modal-desc.expanded {
        display: block !important;
        -webkit-line-clamp: unset !important;
        overflow: visible !important;
    }

    .desc-read-more {
        display: block;
        text-align: right;
        background: none;
        border: none;
        color: var(--terracotta, #E0AA9A);
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        padding: 0;
        margin-top: -2px;
        margin-bottom: 8px;
        font-family: 'Lato', sans-serif;
    }

    #modalAddOns label {
        font-weight: 600 !important;
        color: #888 !important;
    }

    .product-modal-close {
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .modal-add-to-cart,
    .product-modal-btn {
        padding: 10px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 10px;
    }

    #modalColorSelector select,
    #modalSizeSelector select {
        padding: 0.5rem;
        font-size: 13px;
    }
}
