/* ============================================================
   Smart Coupon Button — Frontend Styles v1.1.0
   ============================================================ */

:root {
    --scb-accent:     #3fbfb0;
    --scb-radius:     6px;
    --scb-transition: 200ms ease;
    --scb-font:       inherit;
}

/* ── Widget / card shared wrapper ───────────────────────── */
.scb-coupon-widget {
    display: inline-flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--scb-font);
}

/* ── Progress bar ───────────────────────────────────────── */
.scb-progress-wrap { width: 100%; }
.scb-progress-bar {
    background: rgba(0,0,0,.10);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    width: 100%;
}
.scb-progress-fill {
    display: block;
    height: 100%;
    background: var(--scb-accent, #3fbfb0);
    border-radius: 99px;
    transition: width .55s cubic-bezier(.4,0,.2,1);
}

/* ── Button base ────────────────────────────────────────── */
.scb-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    border-radius: var(--scb-radius);
    cursor: pointer;
    border: 2px solid transparent;
    transition: opacity var(--scb-transition), transform var(--scb-transition), background var(--scb-transition), color var(--scb-transition);
    white-space: nowrap;
    outline: none;
    text-decoration: none;
}
.scb-btn:active  { transform: scale(.97); }
.scb-btn:focus-visible { box-shadow: 0 0 0 3px rgba(63,191,176,.4); }

.scb-btn--teal    { background: var(--scb-accent,#3fbfb0); color:#fff; border-color:var(--scb-accent,#3fbfb0); }
.scb-btn--teal:hover { opacity:.86; }
.scb-btn--dark    { background:#1a1a1a; color:#fff; border-color:#1a1a1a; }
.scb-btn--dark:hover { background:#333; border-color:#333; }
.scb-btn--outline { background:transparent; color:var(--scb-accent,#3fbfb0); border-color:var(--scb-accent,#3fbfb0); }
.scb-btn--outline:hover { background:var(--scb-accent,#3fbfb0); color:#fff; }
.scb-btn--custom  { background:var(--scb-accent,#3fbfb0); color:#fff; border-color:var(--scb-accent,#3fbfb0); }
.scb-btn--custom:hover { opacity:.84; }

/* Applied state */
.scb-btn.is-applied { opacity:.6; cursor:default; }
.scb-btn.is-applied:hover { opacity:.6; transform:none; }

/* Loading spinner */
.scb-btn.is-loading .scb-btn-text { opacity:0; }
.scb-btn.is-loading .scb-btn-spinner { opacity:1; }
.scb-btn-spinner {
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: scb-spin .7s linear infinite;
    opacity: 0;
    transition: opacity .15s;
}
@keyframes scb-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Coupon Cards
   ============================================================ */

/* Group wrapper */
.scb-coupon-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 16px 0;
    box-sizing: border-box;
}
.scb-coupon-group--horizontal { flex-direction: row; align-items: flex-start; }
.scb-coupon-group--vertical   { flex-direction: column; align-items: flex-start; }
.scb-coupon-group--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

/* Auto-display wrapper */
.scb-auto-display { margin: 20px 0; }

/* ── Card base (button_title_image & button_title) ────── */
.scb-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px;
    cursor: pointer;
    transition: box-shadow .2s, transform .18s, border-color .18s;
    text-align: center;
    width: 200px;
    flex-shrink: 0;
    box-sizing: border-box;
    text-decoration: none;
    color: inherit;
}
.scb-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,.11);
    transform: translateY(-3px);
    border-color: #d1d5db;
}

/* Applied visual state on card */
.scb-card.scb-card--applied {
    border-color: #6ee7b7;
    background: #f0fdf4;
}
.scb-card.scb-card--applied .scb-card__title { color: #16a34a; }

/* ── Image-only mode ────────────────────────────────────── */
.scb-card--image {
    padding: 0;
    width: auto;
    max-width: 240px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 12px;
    overflow: hidden;
}
.scb-card--image:hover {
    box-shadow: 0 10px 32px rgba(0,0,0,.18);
    transform: translateY(-3px);
    border: none;
}

/* ── Button-only mode ───────────────────────────────────── */
.scb-card--button {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: auto;
    flex-shrink: 1;
    border-radius: 0;
    overflow: visible;
}
.scb-card--button:hover { transform: none; box-shadow: none; }

/* ── button_title mode (no image) ───────────────────────── */
.scb-card--button_title {
    width: auto;
    min-width: 160px;
    max-width: 280px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 12px 16px;
    gap: 10px;
}
.scb-card--button_title .scb-card__title { flex: 1; width: auto; }
.scb-card--button_title .scb-btn { flex-shrink: 0; }

/* ── Featured image ─────────────────────────────────────── */
.scb-card__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    background: #f3f4f6;
}
.scb-card--image .scb-card__image {
    aspect-ratio: unset;
    border-radius: 12px;
    min-height: 120px;
}
.scb-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .28s ease;
}
.scb-card:hover .scb-card__image img,
.scb-card--image:hover img { transform: scale(1.05); }

.scb-card__image--placeholder {
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    min-height: 100px;
}

/* Image overlay on hover for image-only mode */
.scb-card--image .scb-card__image::after {
    content: '+ Apply';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.38);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity .2s;
    border-radius: 12px;
}
.scb-card--image:hover .scb-card__image::after { opacity: 1; }

/* ── Card title ─────────────────────────────────────────── */
.scb-card__title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
    cursor: pointer;
    width: 100%;
    transition: color .15s;
}
.scb-card__title:hover { color: var(--scb-accent, #3fbfb0); }

/* ── Loading overlay on whole card ─────────────────────── */
.scb-card.scb-is-loading { pointer-events: none; opacity: .7; }

/* ============================================================
   Popup / Toast
   ============================================================ */
.scb-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.46);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: scb-fade-in .2s ease;
    box-sizing: border-box;
}
@keyframes scb-fade-in { from { opacity:0; } to { opacity:1; } }

.scb-popup {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 72px rgba(0,0,0,.24);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    animation: scb-slide-up .24s cubic-bezier(.4,0,.2,1);
    position: relative;
}
@keyframes scb-slide-up {
    from { opacity:0; transform:translateY(22px); }
    to   { opacity:1; transform:translateY(0); }
}

.scb-popup__header {
    padding: 20px 24px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.scb-popup__icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
    flex-shrink: 0;
}
.scb-popup__icon--success { background:#e8faf8; color:#1a9e93; }
.scb-popup__icon--warning { background:#fff8e1; color:#b45309; }
.scb-popup__icon--error   { background:#fdecea; color:#dc2626; }

.scb-popup__close {
    background: none; border: none; cursor: pointer;
    color: #9ca3af; font-size: 18px; line-height:1;
    padding: 4px; margin-left: auto;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.scb-popup__close:hover { color:#333; background:#f3f4f6; }

.scb-popup__body { padding: 14px 24px 24px; }

.scb-popup__title {
    font-size: 17px; font-weight: 700; color:#111827;
    margin: 10px 0 8px;
}
.scb-popup__message {
    font-size: 14px; color:#4b5563; line-height:1.65; margin:0;
}
.scb-popup__message strong { color:#111827; }

.scb-popup__badge {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 14px; padding: 7px 14px;
    border-radius: 99px; font-size: 12px;
    font-weight: 600; letter-spacing: .04em;
}
.scb-popup__badge--active   { background:#e8faf8; color:#1a9e93; }
.scb-popup__badge--inactive { background:#fff3e0; color:#d97706; }

.scb-popup__progress {
    margin-top: 16px;
    background: rgba(0,0,0,.08);
    border-radius: 99px; height: 8px; overflow: hidden;
}
.scb-popup__progress-fill {
    height: 100%;
    background: var(--scb-accent, #3fbfb0);
    border-radius: 99px;
    transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .scb-coupon-group--horizontal { flex-direction: column; }
    .scb-coupon-group--grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .scb-card { width: 100%; max-width: none; }
    .scb-card--button { width: auto; }
    .scb-card--image  { max-width: 100%; }
}

/* ── Queued state (coupon saved, cart conditions not yet met) ── */
.scb-card--queued {
    border-color: #fbbf24;
    background: #fffbeb;
}
.scb-card--queued .scb-card__title { color: #92400e; }

.scb-btn.is-queued {
    opacity: .75;
    cursor: default;
}
.scb-btn.is-queued:hover { opacity: .75; transform: none; }

/* Queued badge in popup */
.scb-popup__badge--queued {
    background: #fffbeb;
    color: #92400e;
}
