/* ==========================================================================
   UpsellStack Frontend Styles
   ========================================================================== */

/* ---------- Offers (General) ---------- */
.upsellstack-offer {
    margin: 16px 0;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}

.upsellstack-offer__heading {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-left: 4px solid;
    border-radius: 8px 8px 0 0;
}

.upsellstack-offer__body {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 8px 8px;
}

.upsellstack-offer__heading + .upsellstack-offer__body {
    border-top: 0;
    border-radius: 0 0 8px 8px;
}

.upsellstack-offer__product {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 8px 0;
}

.upsellstack-offer__product + .upsellstack-offer__product {
    border-top: 1px solid #f3f4f6;
    margin-top: 8px;
    padding-top: 16px;
}

.upsellstack-offer__image {
    flex: 0 0 64px;
}

.upsellstack-offer__image img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.upsellstack-offer__details {
    flex: 1;
}

.upsellstack-offer__checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-wrap: wrap;
}

.upsellstack-offer__checkbox {
    width: 20px;
    height: 20px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.upsellstack-offer__name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.upsellstack-offer__price {
    font-size: 14px;
    margin-left: auto;
}

.upsellstack-offer__price del {
    color: #9ca3af;
    font-size: 12px;
}

.upsellstack-offer__price ins {
    text-decoration: none;
    color: #059669;
    font-weight: 700;
}

.upsellstack-offer__savings {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    margin-left: 4px;
}

.upsellstack-offer__desc {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 0;
    width: 100%;
}

.upsellstack-offer__cta {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.upsellstack-offer__cta:hover {
    opacity: 0.9;
}

/* ---------- Timer ---------- */
.upsellstack-offer__timer {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    color: #dc2626;
    font-weight: 500;
}

.upsellstack-timer-countdown {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------- Popup ---------- */
.upsellstack-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: upsellstack-fade-in 0.3s ease;
}

@keyframes upsellstack-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.upsellstack-popup {
    position: relative;
    width: 100%;
    padding: 32px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: upsellstack-slide-up 0.3s ease;
}

@keyframes upsellstack-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.upsellstack-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background 0.2s;
}

.upsellstack-popup-close:hover {
    background: #e5e7eb;
}

/* ---------- Post Purchase ---------- */
.upsellstack-post-purchase-wrap {
    max-width: 600px;
    margin: 30px auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.upsellstack-pp-header {
    text-align: center;
    margin-bottom: 24px;
}

.upsellstack-pp-header h2 {
    font-size: 22px;
    color: #1e293b;
    margin: 0 0 8px;
}

.upsellstack-pp-header p {
    color: #6b7280;
    margin: 0;
}

.upsellstack-pp-product {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
}

.upsellstack-pp-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.upsellstack-pp-info {
    flex: 1;
}

.upsellstack-pp-info h3 {
    font-size: 16px;
    margin: 0 0 8px;
    color: #1e293b;
}

.upsellstack-pp-price del {
    color: #9ca3af;
}

.upsellstack-pp-price ins {
    text-decoration: none;
    color: #059669;
    font-weight: 700;
    font-size: 18px;
}

.upsellstack-pp-savings {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
    margin-left: 8px;
}

.upsellstack-pp-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 160px;
}

.upsellstack-pp-accept {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: #3b82f6;
    color: #fff;
    transition: background 0.2s;
}

.upsellstack-pp-accept:hover {
    background: #2563eb;
}

.upsellstack-pp-decline {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
}

/* ---------- Frequently Bought Together ---------- */
.upsellstack-fbt {
    margin: 30px 0;
    padding: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.upsellstack-fbt__heading {
    font-size: 18px;
    margin: 0 0 20px;
    color: #1e293b;
}

.upsellstack-fbt__products {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.upsellstack-fbt__product {
    text-align: center;
    min-width: 120px;
    max-width: 160px;
}

.upsellstack-fbt__product img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.upsellstack-fbt__product label {
    cursor: pointer;
    display: block;
}

.upsellstack-fbt__product--current {
    border: 2px solid #3b82f6;
    padding: 12px;
    border-radius: 8px;
}

.upsellstack-fbt__plus {
    font-size: 24px;
    font-weight: 700;
    color: #9ca3af;
}

.upsellstack-fbt__name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-top: 8px;
}

.upsellstack-fbt__price {
    display: block;
    font-size: 13px;
    margin-top: 4px;
}

.upsellstack-fbt__price del {
    color: #9ca3af;
    font-size: 12px;
}

.upsellstack-fbt__check {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.upsellstack-fbt__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.upsellstack-fbt__total {
    font-size: 16px;
    color: #374151;
}

.upsellstack-fbt__cta {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.upsellstack-fbt__cta:hover {
    opacity: 0.9;
}

/* ---------- Next Order Coupon ---------- */
.upsellstack-next-coupon {
    margin: 20px 0;
    border: 2px dashed #22c55e;
    border-radius: 12px;
    overflow: hidden;
}

.upsellstack-next-coupon__header {
    background: #f0fdf4;
    padding: 16px 20px;
}

.upsellstack-next-coupon__header h3 {
    margin: 0;
    color: #15803d;
    font-size: 18px;
}

.upsellstack-next-coupon__body {
    padding: 20px;
    text-align: center;
}

.upsellstack-next-coupon__code {
    display: inline-block;
    background: #f0fdf4;
    padding: 4px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 18px;
    color: #15803d;
    letter-spacing: 1px;
}

.upsellstack-next-coupon__copy {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.upsellstack-next-coupon__copy:hover {
    background: #16a34a;
}

.upsellstack-next-coupon__expiry {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
}

/* ---------- Cart badge ---------- */
.upsellstack-cart-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 4px;
}

.upsellstack-qty-locked {
    display: inline-block;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 13px;
    color: #6b7280;
}

/* ---------- Loading State ---------- */
.upsellstack-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ---------- Checkout Bump Responsive ---------- */
@media (max-width: 768px) {
    .upsellstack-checkout-bump .upsellstack-offer__cta {
        width: 100% !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }
    .upsellstack-checkout-bump__price-cta {
        width: 100% !important;
        flex-basis: 100% !important;
        flex-shrink: 1 !important;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .upsellstack-pp-product {
        flex-direction: column;
        text-align: center;
    }
    .upsellstack-pp-actions {
        width: 100%;
    }
    .upsellstack-fbt__products {
        flex-direction: column;
    }
    .upsellstack-fbt__plus {
        transform: rotate(90deg);
    }
    .upsellstack-offer__product {
        flex-wrap: wrap;
    }
}
