/**
 * WooCommerce Bundle Offers - Frontend Styles - Enhanced Version
 */

.wc-bundle-offers-widget {
    max-width: 1070px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.bundle-offers-title {
    text-align: center;
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bundle-offers-subtitle {
    text-align: center;
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.bundle-offers-title::before,
.bundle-offers-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
}

.bundle-offers-title::before {
    margin-right: 20px;
}

.bundle-offers-title::after {
    margin-left: 20px;
}

.bundle-offers-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px 10px 10px 10px; /* Extra top padding for badges */
}

/* Grid Layout */
.wc-bundle-offers-widget.layout-grid .bundle-offers-container {
    display: grid;
}

/* Specific column counts */
.wc-bundle-offers-widget.columns-1 .bundle-offers-container {
    grid-template-columns: 1fr;
}

.wc-bundle-offers-widget.columns-2 .bundle-offers-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 100%;
}

@media (min-width: 768px) {
    .wc-bundle-offers-widget.columns-2 .bundle-offers-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wc-bundle-offers-widget.columns-3 .bundle-offers-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .wc-bundle-offers-widget.columns-4 .bundle-offers-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* List Layout */
.wc-bundle-offers-widget.layout-list .bundle-offers-container {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset !important;
}

/* Slider Layout - Vertical Stack with Horizontal Scroll */
.wc-bundle-offers-widget.layout-slider {
    position: relative;
    padding: 0 80px; /* Space for arrows */
}

.wc-bundle-offers-widget.layout-slider .bundle-offers-container {
    position: relative;
    display: block;
    min-height: 200px; /* Prevent collapse */
    overflow: visible;
}

.wc-bundle-offers-widget.layout-slider .bundle-offer-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.wc-bundle-offers-widget.layout-slider .bundle-offer-item.active {
    position: relative;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Slider Navigation Arrows - Minimal Transparent Circles */
.bundle-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.bundle-slider-nav:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bundle-slider-nav.prev {
    left: 10px;
}

.bundle-slider-nav.next {
    right: 10px;
}

.bundle-slider-nav svg {
    width: 20px;
    height: 20px;
    stroke: #000;
    stroke-width: 2;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.bundle-slider-nav:hover svg {
    opacity: 1;
}

.bundle-slider-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 768px) {
    .wc-bundle-offers-widget.layout-slider {
        padding: 0 60px;
    }
    
    .bundle-slider-nav {
        width: 40px;
        height: 40px;
    }
    
    .bundle-slider-nav svg {
        width: 18px;
        height: 18px;
    }
    
    .bundle-slider-nav.prev {
        left: 5px;
    }
    
    .bundle-slider-nav.next {
        right: 5px;
    }
    
    /* Variant selection on mobile */
    .bundle-variant-selection {
        padding: 15px;
    }
    
    .bundle-variant-item {
        padding: 12px;
    }
    
    .bundle-variant-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px;
    }
}

.bundle-offer-item {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 30px 20px 20px 20px; /* More top padding for badges */
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 3px solid transparent;
    min-width: 0; /* Prevent flex item overflow */
    overflow: visible; /* CHANGED: Allow badges to show outside */
    display: flex;
    flex-direction: column;
}

.bundle-offer-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.bundle-offer-item.highlighted {
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Selected state - uses custom colors from admin */
.bundle-offer-item.selected {
    border-color: var(--selected-border-color, #000000) !important;
    border-width: var(--selected-border-width, 3px) !important;
    border-style: solid !important;
    background-color: var(--selected-bg-color, #f0f8ff) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Highlighted but not selected - should not have selection border */
.bundle-offer-item.highlighted:not(.selected) {
    border: 3px solid transparent;
}

/* Variant Selection Section */
.bundle-variant-selection {
    width: 100%;
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.bundle-variant-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.bundle-variant-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.bundle-variant-item:last-child {
    margin-bottom: 0;
}

.variant-item-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
}

.bundle-variant-attribute {
    margin-bottom: 10px;
}

.bundle-variant-attribute:last-child {
    margin-bottom: 0;
}

.bundle-variant-attribute label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #666;
}

.bundle-variant-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.bundle-variant-select:focus {
    outline: none;
    border-color: #000;
}

.bundle-variant-select:hover {
    border-color: #999;
}

/* Badge Positioning */
.bundle-badge {
    position: absolute;
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.bundle-badge.badge-top-left {
    top: -12px;
    left: 20px;
}

.bundle-badge.badge-top-right {
    top: -12px;
    right: 20px;
}

.bundle-badge.badge-top-center {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
}

.bundle-content {
    display: flex;
    align-items: center; /* Center align for better desktop look */
    gap: 15px;
    flex: 1;
    min-height: 60px; /* Ensure minimum height */
}

.bundle-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

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

.bundle-content input[type="radio"] {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #000;
    margin-top: 0; /* Center aligned now */
}

.bundle-info {
    flex: 1;
    min-width: 0; /* Prevent overflow */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bundle-label {
    font-size: 20px; /* Larger for desktop */
    font-weight: 700;
    margin-bottom: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.bundle-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 0;
    line-height: 1.4;
    word-wrap: break-word;
}

.bundle-unit-price {
    font-size: 13px;
    color: #666;
    margin-top: 0;
    word-wrap: break-word;
}

.bundle-savings {
    font-size: 14px;
    color: #4CAF50;
    font-weight: 700;
    margin-top: 0;
}

.bundle-pricing {
    text-align: right;
    flex-shrink: 0;
    min-width: 120px; /* Ensure space for prices */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.bundle-price {
    font-size: 32px; /* Bigger for desktop */
    font-weight: 900;
    color: #ff6b35;
    line-height: 1;
    margin-bottom: 0;
}

.bundle-regular-price {
    font-size: 18px;
    color: #999;
    text-decoration: line-through;
    margin-top: 0;
    white-space: nowrap;
}
}

.bundle-add-to-cart {
    width: 100%;
    background: #000;
    color: #fff;
    border: none;
    padding: 18px 30px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.bundle-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.bundle-add-to-cart:active {
    transform: translateY(0);
}

.bundle-add-to-cart svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.bundle-add-to-cart i {
    font-size: 20px;
    flex-shrink: 0;
}

.bundle-add-to-cart.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.bundle-add-to-cart.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Cart item styles */
.bundle-discount-badge {
    display: inline-block;
    background: #e8f34d;
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 5px;
}

.bundle-offer-label {
    color: #666;
    font-style: italic;
}

/* Selected state */
.bundle-offer-item.selected {
    border-color: #2271b1;
}

/* Responsive */
@media (max-width: 768px) {
    .wc-bundle-offers-widget {
        padding: 15px 10px;
    }
    
    .bundle-offers-container {
        grid-template-columns: 1fr !important;
        padding: 15px 5px 10px 5px; /* Less padding on mobile */
        gap: 15px; /* Slightly less gap */
    }
    
    .bundle-offers-title {
        font-size: 24px;
    }
    
    .bundle-offers-subtitle {
        font-size: 14px;
    }
    
    .bundle-offers-title::before,
    .bundle-offers-title::after {
        display: none;
    }
    
    .bundle-offer-item {
        padding: 25px 15px 15px 15px; /* Tighter padding on mobile */
    }
    
    .bundle-content {
        flex-direction: column; /* Stack vertically on mobile */
        gap: 10px;
    }
    
    .bundle-content input[type="radio"] {
        align-self: flex-start; /* Radio at top-left */
        width: 28px;
        height: 28px; /* Bigger tap target */
    }
    
    .bundle-info {
        width: 100%;
    }
    
    .bundle-label {
        font-size: 18px; /* Slightly larger on mobile */
        font-weight: 700;
    }
    
    .bundle-description {
        font-size: 13px;
    }
    
    .bundle-pricing {
        text-align: left; /* Left align on mobile */
        width: 100%;
        margin-top: 10px;
    }
    
    .bundle-price {
        font-size: 28px; /* Bigger price on mobile */
        color: #ff6b35;
    }
    
    .bundle-regular-price {
        font-size: 16px;
    }
    
    .bundle-unit-price,
    .bundle-savings {
        font-size: 14px;
    }
    
    .bundle-add-to-cart {
        font-size: 16px;
        padding: 16px 30px;
    }
    
    .wc-bundle-offers-widget.layout-slider .bundle-offer-item {
        flex: 0 0 280px;
    }
    
    /* Badge adjustments for mobile */
    .bundle-badge {
        font-size: 10px;
        padding: 6px 16px;
        top: -10px;
    }
}

/* Success message */
.bundle-success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error message */
.bundle-error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #f44336;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}
