/* UpSell AI Frontend Styles - Elegant Pop-up */

/* Pop-up Overlay */
.upsellai-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

.upsellai-popup-overlay.active {
    display: flex;
}

/* Pop-up Container */
.upsellai-popup-container {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.4s ease-out;
}

/* Close Button */
.upsellai-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    transition: all 0.3s;
    z-index: 10;
}

.upsellai-popup-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

/* Pop-up Content */
.upsellai-popup-content {
    padding: 40px 30px 30px;
}

/* Pop-up Title */
.upsellai-popup-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    text-align: center;
}

/* Pop-up Subtitle */
.upsellai-popup-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0 0 30px 0;
    text-align: center;
    line-height: 1.5;
}

/* Product Card in Pop-up */
.upsellai-popup-product {
    background: #fafafa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.upsellai-popup-product-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
}

.upsellai-popup-product-name {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 10px 0;
}

.upsellai-popup-product-price {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
}

.upsellai-popup-product-reason {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin: 0 0 20px 0;
    font-style: italic;
}

/* Add to Cart Button in Pop-up */
.upsellai-popup-add-to-cart {
    width: 100%;
    padding: 18px 30px;
    background: white;
    color: #1a1a1a;
    border: 2px solid #1a1a1a;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upsellai-popup-add-to-cart:hover {
    background: #1a1a1a;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.upsellai-popup-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .upsellai-popup-container {
        width: 95%;
        max-width: none;
    }
    
    .upsellai-popup-content {
        padding: 30px 20px 20px;
    }
    
    .upsellai-popup-title {
        font-size: 20px;
    }
    
    .upsellai-popup-product-image {
        height: 250px;
    }
    
    .upsellai-popup-product-name {
        font-size: 18px;
    }
    
    .upsellai-popup-product-price {
        font-size: 24px;
    }
}

/* OLD STYLES - Keep for backward compatibility but hide */

.upsellai-container {
    margin: 40px 0;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.upsellai-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.upsellai-loading {
    text-align: center;
    padding: 40px;
    color: #ffffff;
}

.upsellai-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.upsellai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.upsellai-product-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.upsellai-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.upsellai-product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 16px;
}

.upsellai-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upsellai-product-info {
    flex: 1;
    margin-bottom: 16px;
}

.upsellai-product-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
    line-height: 1.4;
}

.upsellai-product-price {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

.upsellai-product-reason {
    font-size: 13px;
    color: #718096;
    font-style: italic;
}

.upsellai-add-to-cart {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.upsellai-add-to-cart:hover:not(:disabled) {
    opacity: 0.9;
    transform: scale(1.02);
}

.upsellai-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.upsellai-error {
    text-align: center;
    padding: 20px;
    color: #ffffff;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 8px;
}

/* Hide elements with x-cloak until Alpine.js loads */
[x-cloak] {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .upsellai-container {
        padding: 20px;
        margin: 20px 0;
    }
    
    .upsellai-title {
        font-size: 20px;
    }
    
    .upsellai-grid {
        grid-template-columns: 1fr;
    }
}
