/* BWOD Cart Upsell Popup Styles */

/* Prevent body scroll when popup is open */
body.bwod-upsell-open {
    overflow: hidden;
}

/* Popup overlay */
.bwod-upsell-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.bwod-upsell-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Popup container */
.bwod-upsell-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bwod-upsell-container.bwod-upsell-active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Close button */
.bwod-upsell-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    color: #333;
}

.bwod-upsell-close:hover {
    background: #af966e;
    color: #ffffff;
    transform: rotate(90deg);
}

/* Header */
.bwod-upsell-header {
    padding: 28px 24px 20px;
    border-bottom: 2px solid #af966e;
    background: linear-gradient(135deg, #ffffff 0%, #faf8f5 100%);
}

.bwod-upsell-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

/* Products container */
.bwod-upsell-products {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
}

/* Custom scrollbar */
.bwod-upsell-products::-webkit-scrollbar {
    width: 8px;
}

.bwod-upsell-products::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.bwod-upsell-products::-webkit-scrollbar-thumb {
    background: #af966e;
    border-radius: 4px;
}

.bwod-upsell-products::-webkit-scrollbar-thumb:hover {
    background: #9a8460;
}

/* Loading state */
.bwod-upsell-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.bwod-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #af966e;
    border-radius: 50%;
    animation: bwod-spin 1s linear infinite;
}

@keyframes bwod-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Product item */
.bwod-upsell-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.bwod-upsell-item:last-child {
    margin-bottom: 0;
}

.bwod-upsell-item:hover {
    border-color: #af966e;
    box-shadow: 0 4px 12px rgba(175, 150, 110, 0.15);
    transform: translateY(-2px);
}

/* Product image */
.bwod-upsell-item-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.bwod-upsell-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product details */
.bwod-upsell-item-details {
    flex: 1;
    min-width: 0;
}

.bwod-upsell-item-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.bwod-upsell-item-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.bwod-upsell-item-title a:hover {
    color: #af966e;
}

.bwod-upsell-item-price {
    font-size: 16px;
    font-weight: 700;
    color: #af966e;
}

.bwod-upsell-item-price del {
    opacity: 0.5;
    font-weight: 400;
    margin-right: 6px;
}

/* Add to cart button in product item */
.bwod-upsell-item-action {
    flex-shrink: 0;
}

.bwod-upsell-add-to-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #af966e;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.bwod-upsell-add-to-cart:hover:not(:disabled) {
    background: #9a8460;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(175, 150, 110, 0.3);
}

.bwod-upsell-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bwod-upsell-add-to-cart.loading {
    position: relative;
    color: transparent;
}

.bwod-upsell-add-to-cart.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: bwod-spin 0.6s linear infinite;
}

.bwod-upsell-add-to-cart.added {
    background: #4caf50;
}

/* Action buttons */
.bwod-upsell-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: #faf8f5;
    border-top: 1px solid #e5e5e5;
}

.bwod-btn {
    flex: 1;
    display: inline-block;
    padding: 14px 24px;
    text-align: center;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.bwod-btn-cart {
    background: #ffffff;
    color: #af966e;
    border: 2px solid #af966e;
}

.bwod-btn-cart:hover {
    background: #af966e;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(175, 150, 110, 0.2);
}

.bwod-btn-checkout {
    background: #af966e;
    color: #ffffff;
    border: 2px solid #af966e;
}

.bwod-btn-checkout:hover {
    background: #9a8460;
    border-color: #9a8460;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(175, 150, 110, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .bwod-upsell-container {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .bwod-upsell-header {
        padding: 24px 20px 16px;
    }
    
    .bwod-upsell-header h3 {
        font-size: 18px;
    }
    
    .bwod-upsell-products {
        padding: 20px;
        max-height: 350px;
    }
    
    .bwod-upsell-item {
        flex-direction: column;
        text-align: center;
    }
    
    .bwod-upsell-item-image {
        width: 80px;
        height: 80px;
    }
    
    .bwod-upsell-item-action {
        width: 100%;
    }
    
    .bwod-upsell-add-to-cart {
        width: 100%;
        justify-content: center;
    }
    
    .bwod-upsell-actions {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .bwod-upsell-header h3 {
        font-size: 16px;
    }
    
    .bwod-upsell-products {
        padding: 16px;
    }
    
    .bwod-upsell-item {
        padding: 12px;
        gap: 12px;
    }
    
    .bwod-upsell-item-title {
        font-size: 14px;
    }
    
    .bwod-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Beaver Builder compatibility */
.fl-builder-edit .bwod-upsell-popup {
    display: none !important;
}

/* Ensure popup works with Beaver Themer */
.fl-theme-builder-content .bwod-upsell-popup {
    z-index: 999999 !important;
}