/* ============================================
   BUNDLE SALE - FRONTEND STYLES
   ============================================ */

/* === WRAPPER === */
.bundle-sale-wrapper {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    margin: 20px 0;
    overflow: hidden;
}

/* === BADGE === */
.bundle-sale-badge {
    margin-bottom: 15px;
}

.bundle-sale-badge span {
    display: inline-block;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 30px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === TITLE === */
.bundle-sale-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 10px;
    line-height: 1.3;
}

/* === DESCRIPTION === */
.bundle-sale-description {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* === PRICING TIERS === */
.bundle-sale-tiers {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.bundle-sale-tiers .tiers-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px;
}

.tiers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tier-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 16px;
    transition: all 0.3s ease;
    cursor: default;
    flex: 1;
    min-width: 180px;
}

.tier-item.active {
    border-color: #27ae60;
    background: #e8f5e9;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.tier-qty {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.tier-discount {
    font-weight: 700;
    color: #27ae60;
    font-size: 14px;
}

.tier-label {
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* === PRODUCT GRID === */
.bundle-sale-products {
    display: grid;
    grid-template-columns: repeat(var(--bundle-columns, 3), 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

/* List layout */
.bundle-layout-list {
    grid-template-columns: 1fr !important;
}

.bundle-layout-list .bundle-product-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.bundle-layout-list .bundle-product-card-image {
    flex-shrink: 0;
    width: 120px;
}

/* Compact layout */
.bundle-layout-compact {
    grid-template-columns: repeat(var(--bundle-columns, 3), 1fr) !important;
    gap: 10px !important;
}

.bundle-layout-compact .bundle-product-card {
    padding: 10px;
}

.bundle-layout-compact .bundle-product-card-image img {
    max-height: 80px;
    object-fit: contain;
}

/* === PRODUCT CARD === */
.bundle-product-card {
    background: #fafafa;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.bundle-product-card:hover {
    border-color: #2ecc71;
    box-shadow: 0 4px 16px rgba(46, 204, 113, 0.15);
    transform: translateY(-2px);
}

.bundle-product-card.is-optional.excluded {
    opacity: 0.4;
    filter: grayscale(1);
}

/* Optional toggle */
.bundle-optional-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    z-index: 2;
}

.bundle-optional-toggle input[type="checkbox"] {
    accent-color: #2ecc71;
    width: 16px;
    height: 16px;
}

/* Product image */
.bundle-product-card-image {
    position: relative;
    margin-bottom: 12px;
}

.bundle-product-card-image img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
}

/* Plus sign between products */
.bundle-plus-sign {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: #e8f5e9;
    color: #2ecc71;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Product info */
.bundle-product-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bundle-product-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.4;
}

.bundle-product-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #e74c3c;
}

.bundle-product-card-price del {
    font-size: 13px;
    color: #aaa;
    font-weight: 400;
}

/* === QUANTITY CONTROLS === */
.bundle-product-qty-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-top: 8px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
    padding: 0;
}

.qty-minus {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.qty-plus {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.qty-btn:hover {
    background: #2ecc71;
    color: #fff;
    border-color: #2ecc71;
}

.bundle-qty-input {
    width: 50px !important;
    height: 36px;
    text-align: center;
    border: 2px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 15px;
    font-weight: 600;
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
    margin: 0;
}

.bundle-qty-input::-webkit-inner-spin-button,
.bundle-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* === FOOTER / PRICING SECTION === */
.bundle-sale-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f5 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.bundle-sale-pricing {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bundle-original-price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.bundle-original-price .label {
    color: #888;
}

.bundle-original-price .price.strikethrough {
    text-decoration: line-through;
    color: #aaa;
    font-size: 16px;
}

.bundle-final-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bundle-final-price .label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.bundle-final-price .price {
    font-size: 28px;
    font-weight: 800;
    color: #2ecc71;
}

.bundle-savings {
    margin-top: 4px;
}

.savings-badge {
    display: inline-block;
    background: #27ae60;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.bundle-discount-info {
    font-size: 13px;
    color: #e74c3c;
    font-weight: 600;
    margin-top: 2px;
}

/* === ADD TO CART BUTTON === */
.bundle-add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 36px;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bundle-add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
    background: linear-gradient(135deg, #27ae60 0%, #219a52 100%);
}

.bundle-add-to-cart-btn:active {
    transform: translateY(0);
}

.bundle-add-to-cart-btn .btn-icon {
    font-size: 20px;
}

.bundle-add-to-cart-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.bundle-add-to-cart-btn.loading .btn-text::after {
    content: '...';
    animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* === SUCCESS/ERROR MESSAGES === */
.bundle-sale-message {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 15px;
    display: none;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bundle-sale-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.bundle-sale-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.bundle-sale-message a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

/* === PLACEHOLDER (Elementor editor) === */
.bundle-sale-placeholder {
    background: #f8f9fa;
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: #888;
}

/* === ERROR === */
.bundle-error {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #ffeeba;
}

.bundle-inactive {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media screen and (max-width: 1024px) {
    .bundle-sale-products {
        --bundle-columns: 2;
    }
    
    .bundle-sale-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .bundle-sale-pricing {
        align-items: center;
    }
    
    .bundle-add-to-cart-btn {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 768px) {
    .bundle-sale-wrapper {
        padding: 20px;
        border-radius: 12px;
    }
    
    .bundle-sale-title {
        font-size: 22px;
    }
    
    .bundle-sale-products {
        --bundle-columns: 2;
        gap: 12px;
    }
    
    .bundle-plus-sign {
        width: 28px;
        height: 28px;
        font-size: 16px;
        right: -20px;
    }
    
    .tiers-list {
        flex-direction: column;
    }
    
    .tier-item {
        min-width: unset;
    }
    
    .bundle-final-price .price {
        font-size: 24px;
    }
    
    .bundle-add-to-cart-btn {
        padding: 14px 24px;
        font-size: 15px;
    }
}

@media screen and (max-width: 480px) {
    .bundle-sale-wrapper {
        padding: 15px;
        margin: 10px 0;
    }
    
    .bundle-sale-products {
        --bundle-columns: 1;
        gap: 10px;
    }
    
    .bundle-product-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        text-align: left;
        padding: 12px;
    }
    
    .bundle-product-card-image {
        flex-shrink: 0;
        width: 80px;
        margin-bottom: 0;
    }
    
    .bundle-product-card-image img {
        max-height: 80px;
    }
    
    .bundle-plus-sign {
        display: none;
    }
    
    .bundle-product-qty-control {
        justify-content: flex-start;
    }
    
    .bundle-sale-title {
        font-size: 20px;
    }
    
    .bundle-final-price .price {
        font-size: 22px;
    }
    
    .bundle-add-to-cart-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}
