/* ==========================================
   PRODUCT MODAL COMPONENT
   ========================================== */

.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.product-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

/* Backdrop */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1;
}

/* Content Container */
.modal-content {
    background: #fff;
    width: 95%;
    max-width: 900px; /* Slightly reduced width for elegance */
    max-height: 90vh;
    border-radius: 8px; /* Standard radius */
    position: relative;
    z-index: 2;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Unified Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--color-marsala) transparent;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--color-marsala);
    border-radius: 10px;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    color: #666;
    cursor: pointer;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.modal-close:hover {
    background: var(--color-marsala);
    color: #fff;
    transform: rotate(90deg);
}

/* Modal Body Layout */
.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

/* Gallery Section */
.modal-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gallery-main {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    /* border: 1px solid #f0f0f0; Removed border for cleaner look */
}

.gallery-main img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

/* Details Section */
.modal-details {
    display: flex;
    flex-direction: column;
}

.modal-details h2 {
    font-size: 1.15rem; /* Reduced from 1.6rem */
    color: var(--color-marsala);
    margin-bottom: 0.25rem;
    font-family: var(--font-heading);
    line-height: 1.3;
    font-weight: 500;
}

.modal-code {
    font-size: 0.7rem; /* Reduced from 0.8rem */
    color: #999;
    margin-bottom: 1rem;
    font-family: var(--font-body);
}

.modal-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.price-label {
    font-size: 0.75rem; /* Reduced from 0.95rem */
    color: #666;
    font-weight: 400;
}

.price {
    font-size: 1.25rem; /* Reduced from 1.8rem */
    font-weight: 600; 
    color: var(--color-marsala);
}

.modal-description {
    font-size: 0.8rem; /* Reduced from 0.95rem */
    line-height: 1.6;
    color: #555;
    margin-bottom: 1.5rem;
    flex-grow: 1; 
    font-weight: 300;
}

.modal-stock {
    margin-bottom: 1rem;
    font-size: 0.7rem; /* Reduced from 0.85rem */
    font-weight: 500;
}

.text-success { color: #2e7d32; }
.text-danger { color: #d32f2f; }

/* Quantity & Actions - COMPACT LAYOUT */
.modal-actions-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #fff;
    padding-top: 0.75rem;
    margin-top: auto;
}

.modal-quantity {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.modal-quantity label {
    font-weight: 500;
    color: #666;
    font-size: 0.75rem; /* Reduced */
    margin: 0;
}

/* MINI CART STYLE QUANTITY SELECTOR (REPLICA) */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.quantity-selector .qty-btn {
    background: var(--color-marsala);
    color: #fff;
    border: none;
    width: 24px; /* Reduced from 28px */
    height: 24px; /* Reduced from 28px */
    border-radius: 50%;
    font-size: 0.75rem; /* Reduced */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
}

.quantity-selector .qty-btn:hover {
    background: var(--color-cabernet);
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.quantity-selector .qty-display {
    min-width: 25px; /* Reduced */
    text-align: center;
    font-size: 0.8rem; /* Reduced */
    font-weight: 600;
    color: var(--color-marsala);
}

/* ADD TO CART BUTTON */
.btn-modal-add-cart {
    width: 100%;
    padding: 0.8rem; /* Reduced padding */
    font-size: 0.75rem; /* Reduced from 0.9rem */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--color-sand); 
    color: var(--color-marsala);
    border: 1px solid var(--color-sand);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-modal-add-cart:hover {
    background: var(--color-marsala);
    color: #fff;
    border-color: var(--color-marsala);
}

.btn-modal-add-cart:disabled {
    background: #eee;
    color: #999;
    border-color: #eee;
    cursor: not-allowed;
}

/* Media Queries */
@media (max-width: 900px) {
    .modal-body {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1rem;
    }

    .gallery-main {
        height: 250px;
    }
    
    .modal-actions-wrapper {
        position: sticky;
        bottom: 0;
        margin: 0 -1.5rem -1.5rem -1.5rem;
        border-radius: 0 0 8px 8px;
        border-top: 1px solid #eee;
        background: #fff;
        padding: 1rem 1.5rem;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    }
}
