/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

/* Ensure image modal is above cart modal */
#imageModal {
    z-index: 10002 !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#modalImage {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-caption {
    color: white;
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    padding: 0 20px;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ccc;
}

.modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 30px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    pointer-events: auto;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Make thumbnails clickable */
.thumbnail-image {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.thumbnail-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-content {
        padding: 10px;
    }

    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    #modalImage {
        max-height: 70vh;
    }

    .nav-btn {
        font-size: 24px;
        padding: 12px 16px;
    }

    .modal-nav {
        padding: 0 10px;
    }
}