/**
 * O2 Bundles - Upsell Styles
 *
 * @package WC_Product_Bundles
 * @version 1.3.0
 */

/* =============================================
   CSS VARIABLES
   ============================================= */
:root {
    --wcpb-primary: #0066cc;
    --wcpb-primary-hover: #0052a3;
    --wcpb-success: #2e7d32;
    --wcpb-success-bg: #e8f5e9;
    --wcpb-text: #333;
    --wcpb-text-muted: #666;
    --wcpb-border: #e0e0e0;
    --wcpb-bg: #f9f9f9;
}

/* =============================================
   PRODUCT PAGE UPSELL BANNER
   ============================================= */
.wcpb-upsell-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    background: transparent;
}

.wcpb-upsell-banner-content {
    flex: 1;
    min-width: 0;
    padding: 20px 24px;
}

.wcpb-upsell-banner-title {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
}

.wcpb-upsell-banner-title strong {
    font-weight: 700;
}

.wcpb-savings-amount {
    font-weight: 700;
}

.wcpb-savings-amount .woocommerce-Price-amount {
    font-weight: 700;
}

.wcpb-upsell-banner-btn {
    flex-shrink: 0;
    padding: 14px 28px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    margin: 20px 24px;
    margin-left: 0;
}

.wcpb-upsell-banner-btn:hover {
    opacity: 0.85;
}

.wcpb-upsell-banner-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* =============================================
   POPUP OVERLAY
   ============================================= */
.wcpb-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wcpb-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

body.wcpb-popup-open {
    overflow: hidden;
}

.wcpb-popup-container {
    background: #fff;
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.wcpb-popup-overlay.active .wcpb-popup-container {
    transform: scale(1) translateY(0);
}

.wcpb-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 36px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    z-index: 10;
}

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

.wcpb-popup-content {
    padding: 30px;
}

.wcpb-popup-header {
    text-align: center;
    margin-bottom: 25px;
}

.wcpb-popup-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--wcpb-text);
}

.wcpb-popup-description {
    font-size: 15px;
    color: var(--wcpb-text-muted);
    margin: 0;
}

/* =============================================
   POPUP OFFERS
   ============================================= */
.wcpb-popup-offers {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wcpb-popup-offer {
    position: relative;
    background: var(--wcpb-bg);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--wcpb-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wcpb-popup-offer:hover {
    border-color: var(--wcpb-primary);
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.15);
}

.wcpb-offer-badge {
    position: absolute;
    top: -10px;
    left: 20px;
    padding: 5px 12px;
    background: #ff6b6b;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcpb-offer-image {
    width: 80px;
    height: 80px;
    float: left;
    margin-right: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--wcpb-border);
}

.wcpb-offer-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcpb-offer-details {
    overflow: hidden;
}

.wcpb-offer-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--wcpb-text);
}

.wcpb-offer-products {
    font-size: 12px;
    color: var(--wcpb-text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}

.wcpb-offer-pricing {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.wcpb-offer-original {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.wcpb-offer-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--wcpb-text);
}

.wcpb-offer-save {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--wcpb-success-bg);
    color: var(--wcpb-success);
    border-radius: 12px;
    font-weight: 600;
}

/* Popup footer */
.wcpb-popup-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--wcpb-border);
}

.wcpb-popup-skip {
    background: none;
    border: none;
    color: var(--wcpb-text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 10px 20px;
    transition: color 0.2s ease;
}

.wcpb-popup-skip:hover {
    color: var(--wcpb-text);
    text-decoration: underline;
}

/* Loading */
.wcpb-loading {
    text-align: center;
    padding: 40px;
}

.wcpb-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--wcpb-border);
    border-top-color: var(--wcpb-primary);
    border-radius: 50%;
    animation: wcpb-spin 0.8s linear infinite;
}

@keyframes wcpb-spin {
    to { transform: rotate(360deg); }
}

/* =============================================
   ADD TO CART BUTTON (shared)
   ============================================= */
.wcpb-add-upsell {
    display: inline-block;
    padding: 10px 20px;
    background: var(--wcpb-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    line-height: 1.4;
}

.wcpb-add-upsell:hover {
    background: var(--wcpb-primary-hover) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.wcpb-add-upsell.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
    .wcpb-upsell-banner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wcpb-upsell-banner-content {
        text-align: center;
        padding: 20px 20px 10px 20px;
    }
    
    .wcpb-upsell-banner-title {
        font-size: 14px;
    }
    
    .wcpb-upsell-banner-btn {
        margin: 10px 20px 20px 20px;
        padding: 14px 20px;
        text-align: center;
    }
    
    .wcpb-popup-content {
        padding: 25px 20px;
    }
    
    .wcpb-popup-title {
        font-size: 22px;
    }
    
    .wcpb-offer-image {
        float: none;
        width: 60px;
        height: 60px;
        margin: 0 auto 10px auto;
    }
    
    .wcpb-offer-details {
        text-align: center;
    }
    
    .wcpb-offer-pricing {
        justify-content: center;
    }
    
    .wcpb-popup-offer .wcpb-add-upsell {
        width: 100%;
    }
}
