.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 1rem;
    margin: 0;
    will-change: opacity;
    transition: opacity 0.3s ease-out;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.product-modal {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 520px;
    max-height: 75vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    margin: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-overlay.active .product-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
    transition: all 0.2s ease;
    border: 1px solid #E5E7EB;
    color: #6B7280;
    font-size: 0.875rem;
}

.modal-close:hover {
    background: #F9FAFB;
    transform: scale(1.1);
    border-color: #E5E7EB;
    color: #111827;
}

.modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (min-width: 768px) {
    .modal-content {
        flex-direction: row;
        height: calc(75vh - 4rem);
    }
}

.modal-image {
    position: relative;
    flex: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

@media (min-width: 768px) {
    .modal-image {
        max-width: 50%;
    }
}

.modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-image:hover img {
    transform: scale(1.02);
}

.modal-details {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-category {
    display: inline-block;
    background: #EEF2FF;
    color: #4F46E5;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    align-self: flex-start;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    margin-bottom: 0.375rem;
}

.modal-price {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0071DC;
    margin-bottom: 0.75rem;
}

.modal-description {
    color: #4B5563;
    line-height: 1.5;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #F9FAFB;
    border-radius: 0.75rem;
    border: 1px solid #E5E7EB;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.modal-actions button {
    flex: 1;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: 0;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.modal-actions button {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: 0;
    min-height: 1.75rem;
    border: none;
    outline: none;
    cursor: pointer;
}

.whatsapp-btn {
    background: #25D366;
    color: white;
}

.whatsapp-btn:hover {
    background: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.2);
}

.whatsapp-btn:active {
    transform: translateY(0);
}

.cart-btn {
    background: #0071DC;
    color: white;
}

.cart-btn:hover {
    background: #004F9A;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 113, 220, 0.2);
}

.cart-btn:active {
    transform: translateY(0);
}

/* Make button icons smaller */
.modal-actions button i {
    font-size: 0.75rem;
}

/* Loading state */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #E5E7EB;
    border-top-color: #0071DC;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Product card action buttons */
.product-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.product-card-actions button {
    flex: 1;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
    color: white;
}

.product-card-actions .cart-btn {
    background: #0071DC;
}

.product-card-actions .cart-btn:hover {
    background: #004F9A;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 113, 220, 0.2);
}

.product-card-actions .cart-btn:active {
    transform: translateY(0);
}

/* Animation for cart success */
@keyframes addedToCart {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
