/* ANIMATIONS */
@keyframes cod-click-bounce {
    0% { transform: scale(1); }
    40% { transform: scale(0.97); }
    100% { transform: scale(1); }
}

.cod-bundle-frontend {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
    -webkit-tap-highlight-color: transparent !important;
}

.cod-bundle-frontend * {
    -webkit-tap-highlight-color: transparent !important;
}

/* Ensure inner bbp card is also transparent */
.cod-bundle-frontend .bbp-bundle-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: block !important;
}

.cod-bundle-frontend .bundle-header,
.cod-bundle-frontend .bbp-bundle-header {
    display: none !important;
}

/* FORCE WIDTH ON PARENT CONTAINERS */
.cod-form-pro-container,
.cod-bundle-frontend {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* WIDTH 100% FIX */
.cod-bundle-frontend .bundle-offers,
.cod-bundle-frontend .bbp-bundle-offers,
.cod-bundle-frontend .bbp-bundle-offers-wrapper,
.cod-bundle-frontend .bbp-bundle-card {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}

.cod-bundle-frontend .bundle-offer,
.cod-bundle-frontend .bbp-bundle-offer {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: var(--bundle-bg, #ffffff);
    border: 2px solid var(--bundle-border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 8px !important;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    display: flex !important;
    flex-direction: column !important; /* VERTICAL STACK FOR BASIC */
    opacity: 1 !important;
}

.cod-bundle-frontend .bbp-pack-card {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important; /* ENABLE EQUAL HEIGHT CARDS */
    box-sizing: border-box !important;
    background: var(--bundle-bg, #ffffff);
    border: 2px solid var(--bundle-border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 0 !important; /* GRID USES GAP */
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    display: flex !important;
    flex-direction: column !important; /* VERTICAL STACK FOR HORIZONTAL CARDS */
    opacity: 1 !important;
}

.cod-bundle-frontend .bbp-bogo-offer,
.cod-bundle-frontend .bbp-combo-offer {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: var(--bundle-bg, #ffffff);
    border: 2px solid var(--bundle-border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 12px !important;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    display: flex !important;
    flex-direction: row !important; /* HORIZONTAL ROW FOR BOGO/COMBO */
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 12px !important;
    opacity: 1 !important;
    text-align: left !important;
}

.cod-bundle-frontend .bbp-offer-top {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100% !important;
    gap: 10px !important;
}

/* Ensure secondary content always breaks into its own row in BOGO/Combo */
.cod-bundle-frontend .bbp-bogo-offer > .cod-bundle-variations,
.cod-bundle-frontend .bbp-bogo-offer > .bbp-gift-banner,
.cod-bundle-frontend .bbp-bogo-offer > .bbp-combo-products,
.cod-bundle-frontend .bbp-combo-offer > .cod-bundle-variations,
.cod-bundle-frontend .bbp-combo-offer > .bbp-gift-banner,
.cod-bundle-frontend .bbp-combo-offer > .bbp-combo-products {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-top: 12px !important;
}

/* OFFER INFO - Text Block */
.cod-bundle-frontend .bbp-offer-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cod-bundle-frontend .bbp-offer-title {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.cod-bundle-frontend .bbp-offer-sub {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    margin-top: 2px;
}

/* OFFER BADGE */
.cod-bundle-frontend .bbp-offer-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background-color: var(--bundle-tag-bg, #dcfce7);
    color: var(--bundle-tag-text, #374151);
    font-weight: 600;
    white-space: nowrap;
}

/* POPULAR BADGE (Fallback) */
.cod-bundle-frontend .bbp-popular-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    z-index: 100;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    font-size: 10px;
    line-height: normal;
    color: white;
    background: var(--bundle-highlight, #8b5cf6);
    padding: 4px 12px;
    border-radius: 6px;
    pointer-events: none;
}

/* OFFER PRICE */
.cod-bundle-frontend .bbp-offer-price {
    flex: 0 0 auto;
    text-align: right;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    white-space: nowrap;
}

/* Explicitly hide the offer body until selected to prevent empty height */
.cod-bundle-frontend .bbp-bundle-offer .bbp-offer-body {
    display: none;
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.cod-bundle-frontend .bbp-bundle-offer.selected .bbp-offer-body {
    display: block;
    animation: cod-slide-down 0.3s ease forwards;
}

@keyframes cod-slide-down {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* HOVER: Grow a little bit */
.cod-bundle-frontend .bundle-offer:hover,
.cod-bundle-frontend .bbp-bundle-offer:hover,
.cod-bundle-frontend .bbp-pack-card:hover,
.cod-bundle-frontend .bbp-bogo-offer:hover,
.cod-bundle-frontend .bbp-combo-offer:hover {
    border-color: var(--bundle-highlight, #8b5cf6) !important;
    transform: scale(1.02) !important;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    z-index: 10;
}

/* CLICK: Small Bounce */
.cod-bundle-frontend .bundle-offer:active,
.cod-bundle-frontend .bbp-bundle-offer:active,
.cod-bundle-frontend .bbp-pack-card:active,
.cod-bundle-frontend .bbp-bogo-offer:active,
.cod-bundle-frontend .bbp-combo-offer:active {
    animation: cod-click-bounce 0.3s ease;
}

.cod-bundle-frontend .bundle-offer:hover .bundle-checkmark,
.cod-bundle-frontend .bundle-offer:hover .bbp-radio-circle,
.cod-bundle-frontend .bbp-bundle-offer:hover .bbp-offer-radio,
.cod-bundle-frontend .bbp-pack-card:hover .bbp-offer-radio,
.cod-bundle-frontend .bbp-bogo-offer:hover .bbp-bogo-radio,
.cod-bundle-frontend .bbp-bogo-offer:hover .bbp-combo-radio,
.cod-bundle-frontend .bbp-combo-offer:hover .bbp-combo-radio {
    border-color: var(--bundle-highlight, #8b5cf6) !important;
}

/* SELECTED STATE - Exact Match to Preview */
.cod-bundle-frontend .bundle-offer.selected,
.cod-bundle-frontend .bbp-bundle-offer.selected,
.cod-bundle-frontend .bbp-pack-card.selected,
.cod-bundle-frontend .bbp-bogo-offer.selected,
.cod-bundle-frontend .bbp-combo-offer.selected {
    background: var(--bundle-selected-bg, #f3e8ff) !important;
    border-color: var(--bundle-highlight, #8b5cf6) !important;
    box-shadow: 0 0 0 2px var(--bundle-highlight, #8b5cf6) !important;
    transform: scale(1) !important;
}

/* FORCE WHITE BACKGROUND ON SELECTED RADIO */
.cod-bundle-frontend .bundle-offer.selected .bundle-checkmark,
.cod-bundle-frontend .bbp-bundle-offer.selected .bbp-offer-radio,
.cod-bundle-frontend .bbp-pack-card.selected .bbp-offer-radio,
.cod-bundle-frontend .bbp-bogo-offer.selected .bbp-bogo-radio,
.cod-bundle-frontend .bbp-bogo-offer.selected .bbp-combo-radio,
.cod-bundle-frontend .bbp-combo-offer.selected .bbp-combo-radio {
    background-color: #ffffff !important;
    background-image: none !important;
    border-color: var(--bundle-highlight, #8b5cf6) !important;
    position: relative !important;
}

/* Ensure no Before element interferes */
.cod-bundle-frontend .bundle-offer.selected .bundle-checkmark::before,
.cod-bundle-frontend .bbp-bundle-offer.selected .bbp-offer-radio::before,
.cod-bundle-frontend .bbp-pack-card.selected .bbp-offer-radio::before,
.cod-bundle-frontend .bbp-bogo-offer.selected .bbp-bogo-radio::before,
.cod-bundle-frontend .bbp-bogo-offer.selected .bbp-combo-radio::before,
.cod-bundle-frontend .bbp-combo-offer.selected .bbp-combo-radio::before {
    display: none !important;
}

/* Restore dot via pseudo-element */
.cod-bundle-frontend .bundle-offer.selected .bundle-checkmark::after,
.cod-bundle-frontend .bbp-bundle-offer.selected .bbp-offer-radio::after,
.cod-bundle-frontend .bbp-pack-card.selected .bbp-offer-radio::after,
.cod-bundle-frontend .bbp-bogo-offer.selected .bbp-bogo-radio::after,
.cod-bundle-frontend .bbp-bogo-offer.selected .bbp-combo-radio::after,
.cod-bundle-frontend .bbp-combo-offer.selected .bbp-combo-radio::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    border-radius: 50% !important;
    margin: 0 !important;
    border: none !important;
    background-color: var(--bundle-highlight, #8b5cf6) !important;
    display: block !important;
}

/* COMPACT LAYOUT & RADIO SPACING */
.cod-bundle-frontend .bbp-offer-radio {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    border: 2px solid #d1d5db !important;
    border-radius: 50% !important;
    margin-right: 12px !important;
    display: inline-block !important;
    position: relative !important;
    background: #fff;
}

.cod-bundle-frontend .bbp-bundle-offer img {
    margin-right: 12px !important;
}

/* MOBILE OPTIMIZATIONS */
@media (max-width: 480px) {
    .cod-bundle-frontend .bundle-offer,
    .cod-bundle-frontend .bbp-bundle-offer {
        padding: 12px !important;
    }

    .cod-bundle-frontend .bbp-offer-top {
        gap: 8px !important;
    }

    .cod-bundle-frontend .bbp-offer-radio {
        flex: 0 0 auto !important;
        margin-right: 4px !important;
    }

    .cod-bundle-frontend .bbp-bundle-offer img {
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 40px !important;
        object-fit: cover !important;
        margin-right: 4px !important;
        border-radius: 4px !important;
    }

    .cod-bundle-frontend .bbp-offer-info {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .cod-bundle-frontend .bbp-offer-title {
        font-size: 13px !important;
    }

    .cod-bundle-frontend .bbp-offer-price {
        flex: 0 0 auto !important;
    }

    .cod-bundle-frontend .bbp-price-current {
        font-size: 16px !important;
    }

    .cod-bundle-frontend .bbp-price-old {
        font-size: 12px !important;
    }

    .cod-order-button {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

.cod-bundle-frontend .bundle-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 20px;
}

.cod-bundle-frontend .bundle-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cod-bundle-frontend .bundle-checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cod-bundle-frontend .bundle-offer.selected .bundle-checkmark {
    background: var(--bundle-highlight, #8b5cf6);
    border-color: var(--bundle-highlight, #8b5cf6);
}

.cod-bundle-frontend .bundle-offer.selected .bundle-checkmark::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

.cod-bundle-frontend .bundle-content {
    flex: 1;
}

.cod-bundle-frontend .bundle-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.cod-bundle-frontend .bundle-subtitle {
    font-size: 13px;
    color: #6b7280;
}

.cod-bundle-frontend .bundle-pricing {
    text-align: right;
}

.cod-bundle-frontend .bundle-price,
.cod-bundle-frontend .bbp-price-current {
    font-size: 20px;
    font-weight: 700;
    color: var(--bundle-price, #111827);
}

.cod-bundle-frontend .bundle-compared,
.cod-bundle-frontend .bbp-price-old {
    font-size: 14px;
    color: var(--bundle-compared, #ef4444);
    text-decoration: line-through;
}

.cod-bundle-frontend .bundle-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    margin: 8px;
    background: #fef3c7;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
}

.cod-bundle-frontend .bundle-timer span {
    font-weight: 700;
    background: #92400e;
    color: #fef3c7;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.cod-bundle-frontend .bundle-gift {
    text-align: center;
    padding: 10px;
    margin: 8px;
    background: #dcfce7;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #166534;
}

.cod-bundle-frontend .bundle-protection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    font-size: 14px;
    color: #166534;
}

/* RIBBON STYLES (Extracted from Template) */
.cod-bundle-frontend .bbp-bundle-offer.has-ribbon .bbp-popular-badge {
    display: none !important;
}

.cod-bundle-frontend .bbp-dynamic-ribbon {
    position: absolute !important;
    top: -12px !important;
    right: 10px !important;
    z-index: 100 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    text-align: center !important;
    white-space: nowrap !important;
    font-size: 10px !important;
    line-height: 24px !important;
    color: white !important;
    pointer-events: none;
}

/* Centrado EXCLUSIVO para Plantilla Bloque (Horizontal) */
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Style 0: Pill */
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="0"] {
    top: -10px !important;
    right: 16px !important;
    background: var(--bundle-highlight, #8b5cf6) !important;
    padding: 4px 12px !important;
    border-radius: 6px !important;
    line-height: normal !important;
}
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="0"] {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Image Ribbons */
.cod-bundle-frontend .bbp-dynamic-ribbon:not([data-style="0"]) {
    background-color: transparent !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 100% 100% !important;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8) !important;
}

/* Style 2 */
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="2"] {
    top: -13px !important;
    right: 10px !important;
    min-width: 160px !important;
    height: 25px !important;
    padding: 0 45px 2px 45px !important;
}
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="2"] {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Style 3 */
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="3"] {
    top: -15px !important;
    right: 16px !important;
    min-width: 130px !important;
    height: 30px !important;
    line-height: 29px !important;
    padding: 0 15px 0 45px !important;
}
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="3"] {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Style 4 */
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="4"] {
    top: -8px !important;
    right: 40px !important;
    min-width: 160px !important;
    height: 25px !important;
    padding: 0 45px 2px 45px !important;
}
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="4"] {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Style 5 */
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="5"] {
    top: -12px !important;
    right: 10px !important;
    min-width: 120px !important;
    height: 24px !important;
    padding: 0 25px 2px 25px !important;
    line-height: 23px !important;
}
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="5"] {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Compacts (1, 6, 7) */
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="1"],
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="6"],
.cod-bundle-frontend .bbp-dynamic-ribbon[data-style="7"] {
    top: -13px !important;
    right: 16px !important;
    min-width: 100px !important;
    height: 25px !important;
    padding: 0 15px 2px 15px !important;
}
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="1"],
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="6"],
.cod-bundle-frontend .bbp-cards-bundle .bbp-dynamic-ribbon[data-style="7"] {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* GRID LAYOUTS FOR HORIZONTAL (BLOCK) */
.cod-bundle-frontend .bbp-cards-bundle {
    display: grid !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Default dynamic grid */
.cod-bundle-frontend .bbp-grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
}

/* 3 boxes in one line */
.cod-bundle-frontend .bbp-grid-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

/* 4 boxes -> 2 arriba and 2 abajo (2 per line) */
.cod-bundle-frontend .bbp-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
}

@media (max-width: 480px) {
    .cod-bundle-frontend .bbp-grid-3 {
        gap: 6px !important;
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .cod-bundle-frontend .bbp-grid-4 {
        gap: 10px !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .cod-bundle-frontend .bbp-pack-card {
        padding: 10px 6px !important;
    }
    .cod-bundle-frontend .bbp-offer-title {
        font-size: 11px !important;
    }
}