/* ══════════════════════════════════════════════════════
 *  BOGO Pro — Frontend Styles
 *  Badges, deal text, timers, nudges, archive banners,
 *  success banners, free-item tags, checkout badges
 * ══════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────── */
:root {
    --bogo-primary: #ff6b35;
    --bogo-primary-dk: #e55a28;
    --bogo-success: #27ae60;
    --bogo-success-light: #d4efdf;
    --bogo-success-dark: #1a6b3c;
    --bogo-info: #2d9cdb;
    --bogo-dark: #1e1e2f;
    --bogo-white: #ffffff;
    --bogo-radius: 8px;
    --bogo-shadow: 0 4px 15px rgba(0, 0, 0, .12);
    --bogo-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ══════════════════════════════════════════════════════
 *  PRODUCT BADGE
 * ══════════════════════════════════════════════════════ */
.bogo-badge {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* ── Badge Positions ── */
.bogo-badge--top-left {
    top: 10px;
    left: 10px;
}

.bogo-badge--top-right {
    top: 10px;
    right: 10px;
    left: auto;
}

.bogo-badge--bottom-left {
    bottom: 10px;
    left: 10px;
    top: auto;
}

.bogo-badge--bottom-right {
    bottom: 10px;
    right: 10px;
    top: auto;
    left: auto;
}

.bogo-badge--top-right.bogo-badge--text {
    border-radius: var(--bogo-radius) 0 0 var(--bogo-radius);
}

.bogo-badge--bottom-left.bogo-badge--text {
    border-radius: 0 var(--bogo-radius) var(--bogo-radius) 0;
}

.bogo-badge--bottom-right.bogo-badge--text {
    border-radius: var(--bogo-radius) 0 0 var(--bogo-radius);
}

.bogo-badge img {
    max-width: 72px;
    max-height: 72px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .2));
}

.bogo-badge--text {
    background: linear-gradient(135deg, var(--bogo-primary), var(--bogo-primary-dk));
    color: var(--bogo-white);
    padding: 5px 12px;
    border-radius: 0 var(--bogo-radius) var(--bogo-radius) 0;
    font-family: var(--bogo-font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    box-shadow: var(--bogo-shadow);
    line-height: 1.4;
}

.bogo-badge--single {
    top: 15px;
    left: 15px;
}

.bogo-badge--single img {
    max-width: 96px;
    max-height: 96px;
}

.bogo-badge--single.bogo-badge--text {
    font-size: 14px;
    padding: 7px 16px;
}

/* Ensure parent containers have relative positioning for absolute badges */
.woocommerce ul.products li.product,
.woocommerce-loop-product__link,
.woocommerce-product-gallery,
.product-element-top,
.box-image,
.wc-block-grid__product {
    position: relative !important;
    overflow: visible !important;
}

/* ══════════════════════════════════════════════════════
 *  DEAL TEXT
 * ══════════════════════════════════════════════════════ */
.bogo-deal-text {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(90deg, #fff3e6, #ffe8d6);
    color: var(--bogo-primary-dk);
    padding: 5px 10px;
    border-radius: var(--bogo-radius);
    font-family: var(--bogo-font);
    font-size: 12px;
    font-weight: 600;
    margin: 6px 0 2px;
    border-left: 3px solid var(--bogo-primary);
}

.bogo-deal-text--single {
    font-size: 14px;
    padding: 8px 14px;
    margin: 10px 0 6px;
}

/* ══════════════════════════════════════════════════════
 *  COUNTDOWN TIMER
 * ══════════════════════════════════════════════════════ */
.bogo-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bogo-dark);
    color: var(--bogo-white);
    padding: 5px 12px;
    border-radius: var(--bogo-radius);
    font-family: var(--bogo-font);
    font-size: 12px;
    font-weight: 600;
    margin: 6px 0;
    letter-spacing: .5px;
}

.bogo-timer__icon {
    font-size: 14px;
}

.bogo-timer__countdown {
    color: var(--bogo-primary);
    font-variant-numeric: tabular-nums;
    min-width: 90px;
}

.bogo-timer--expired {
    opacity: .5;
}

.bogo-timer--expired .bogo-timer__countdown {
    color: #ff4444;
}

.bogo-timer--single {
    font-size: 14px;
    padding: 8px 16px;
}

/* ══════════════════════════════════════════════════════
 *  ARCHIVE BANNER
 * ══════════════════════════════════════════════════════ */
.bogo-archive-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #ff6b35, #ff8f5e);
    color: var(--bogo-white);
    padding: 14px 22px;
    border-radius: var(--bogo-radius);
    font-family: var(--bogo-font);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    box-shadow: var(--bogo-shadow);
    animation: bogo-banner-in .5s ease-out;
}

.bogo-archive-banner__icon {
    font-size: 22px;
}

@keyframes bogo-banner-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════════════════════════════
 *  CART & MINI-CART NUDGE
 * ══════════════════════════════════════════════════════ */
.bogo-nudge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #e8f8f0, #d4efdf);
    color: #1a6b3c;
    padding: 14px 20px;
    border-radius: var(--bogo-radius);
    border-left: 4px solid var(--bogo-success);
    font-family: var(--bogo-font);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(39, 174, 96, .12);
    animation: bogo-nudge-in .4s ease-out;
}

.bogo-nudge__icon {
    font-size: 20px;
    flex-shrink: 0;
}

.bogo-nudge--mini {
    font-size: 12px;
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: 6px;
}

@keyframes bogo-nudge-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ══════════════════════════════════════════════════════
 *  DRAWER NUDGE (Shoptimizer sidebar cart & similar)
 * ══════════════════════════════════════════════════════ */
.bogo-nudge--drawer {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--bogo-success);
    border-radius: 10px;
    padding: 0;
    margin: 12px 0;
    overflow: hidden;
    animation: bogo-nudge-in .4s ease-out;
}

/* Header: deal tag + offer title */
.bogo-nudge__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 8px;
}

.bogo-nudge__tag {
    background: var(--bogo-success);
    color: var(--bogo-white);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.bogo-nudge__title {
    font-size: 13px;
    font-weight: 700;
    color: #166534;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Progress bar — Gaming Style ── */
.bogo-nudge__progress-wrap {
    padding: 0 14px 6px;
}

.bogo-nudge__progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bogo-nudge__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bogo-info), #3b82f6);
    border-radius: 4px;
    transition: width .6s cubic-bezier(.22, 1, .36, 1),
        background .4s ease;
    position: relative;
}

/* High progress (66%+) — shift to green */
.bogo-nudge__progress-fill--high {
    background: linear-gradient(90deg, #3b82f6, var(--bogo-success));
}

/* Completed state (100%) — full green with pulse glow */
.bogo-nudge__progress-fill--complete {
    background: linear-gradient(90deg, var(--bogo-success), #16a34a, #22c55e);
    animation: bogo-progress-pulse 1.5s ease-in-out infinite;
}

.bogo-nudge__progress-bar--complete {
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

@keyframes bogo-progress-pulse {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(34, 197, 94, 0.3);
    }

    50% {
        box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
    }
}

.bogo-nudge__progress-label {
    font-size: 10px;
    font-weight: 600;
    color: #15803d;
    text-align: right;
    margin-top: 3px;
    letter-spacing: .3px;
}

/* Message row */
.bogo-nudge__message-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 10px;
    background: rgba(255, 255, 255, .5);
    border-top: 1px solid #d1fae5;
}

.bogo-nudge__message-row .bogo-nudge__icon {
    font-size: 16px;
    flex-shrink: 0;
}

.bogo-nudge__message-row .bogo-nudge__message {
    font-size: 12px;
    font-weight: 600;
    color: #166534;
    line-height: 1.4;
}

/* Inside Shoptimizer drawer specifically */
.shoptimizer-mini-cart-wrap .bogo-nudge--drawer {
    margin: 10px 0 6px;
    border-radius: 8px;
}

/* ══════════════════════════════════════════════════════
 *  SUCCESS BANNER (Offer Completed!)
 * ══════════════════════════════════════════════════════ */
.bogo-nudge--success {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 2px solid #22c55e;
    border-left: 5px solid #16a34a;
    border-radius: 12px;
    padding: 0;
    margin: 12px 0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.2);
    animation: bogo-success-in .5s ease-out;
}

.bogo-nudge__success-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px 10px;
}

.bogo-nudge__success-icon {
    font-size: 28px;
    flex-shrink: 0;
    animation: bogo-icon-bounce .6s ease-out;
}

@keyframes bogo-icon-bounce {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.bogo-nudge__success-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bogo-nudge__success-text strong {
    font-size: 14px;
    font-weight: 800;
    color: #166534;
    line-height: 1.3;
}

.bogo-nudge__success-offer {
    font-size: 11px;
    font-weight: 600;
    color: #15803d;
    opacity: .8;
}

.bogo-nudge__savings {
    padding: 8px 18px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    background: rgba(255, 255, 255, .5);
    border-top: 1px solid #bbf7d0;
}

.bogo-savings-amount {
    font-size: 16px;
    font-weight: 900;
    color: #16a34a;
}

/* Success progress bar (100% green + glow) */
.bogo-nudge--success .bogo-nudge__progress-wrap {
    padding: 0 18px 12px;
}

@keyframes bogo-success-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ══════════════════════════════════════════════════════
 *  FREE-ITEM TAG (Cart, Mini-Cart, Checkout)
 * ══════════════════════════════════════════════════════ */
.bogo-free-tag {
    display: inline-block;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: var(--bogo-white);
    padding: 2px 10px;
    border-radius: 20px;
    font-family: var(--bogo-font);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.25);
    animation: bogo-tag-pop .3s ease-out;
}

.bogo-free-tag--mini {
    font-size: 9px;
    padding: 1px 6px;
    margin-left: 4px;
}

@keyframes bogo-tag-pop {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Strikethrough original price styling */
.woocommerce-cart-form del,
.woocommerce-mini-cart del,
.woocommerce-checkout-review-order del {
    opacity: .55;
    font-size: .9em;
}

/* ══════════════════════════════════════════════════════
 *  CHECKOUT BADGE
 * ══════════════════════════════════════════════════════ */
.bogo-checkout-badge {
    display: inline-block;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: var(--bogo-white);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--bogo-font);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-left: 8px;
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════
 *  RESPONSIVE
 * ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .bogo-badge img {
        max-width: 56px;
        max-height: 56px;
    }

    .bogo-badge--text {
        font-size: 10px;
        padding: 4px 8px;
    }

    .bogo-timer {
        font-size: 10px;
        padding: 3px 6px;
        gap: 3px;
        white-space: nowrap;
        flex-wrap: nowrap;
    }

    .bogo-timer__label {
        display: none;
    }

    .bogo-timer__countdown {
        min-width: auto;
    }

    .bogo-nudge {
        font-size: 13px;
        padding: 10px 14px;
    }

    .bogo-archive-banner {
        font-size: 14px;
        padding: 10px 16px;
    }

    .bogo-nudge--success .bogo-nudge__success-header {
        padding: 10px 14px 8px;
    }

    .bogo-nudge__success-text strong {
        font-size: 13px;
    }

    .bogo-savings-amount {
        font-size: 14px;
    }
}