/* ============================================================
   COUPONS — Coupon card design system
   Used in business editor preview + client banner.
   ============================================================ */

/* Coupon card base */
.coupon-card {
    position: relative;
    display: flex;
    overflow: hidden;
    border-radius: 1rem;
    color: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
    isolation: isolate;
    min-height: 92px;
}
.coupon-card-bg {
    position: absolute; inset: 0;
    background-position: center; background-size: cover;
    opacity: .35; filter: saturate(1.1);
    z-index: -1;
}
.coupon-card-overlay {
    position: absolute; inset: 0;
    background: inherit;
    opacity: .92;
    z-index: -1;
}
.coupon-card-body {
    flex: 1; min-width: 0;
    padding: .9rem 1rem;
    display: flex; align-items: center; gap: .85rem;
}
.coupon-card-disc {
    flex: 0 0 auto;
    min-width: 64px;
    padding: .35rem .65rem;
    border-radius: .75rem;
    background: rgba(255, 255, 255, .18);
    backdrop-filter: blur(6px);
    text-align: center;
    font-weight: 900;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: -.5px;
    border: 1.5px dashed rgba(255, 255, 255, .55);
}
.coupon-card-info { min-width: 0; flex: 1; }
.coupon-card-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 900;
    font-size: .95rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.coupon-card-name {
    font-weight: 700;
    font-size: .85rem;
    opacity: .98;
    line-height: 1.25;
    margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical;
}
.coupon-card-desc {
    font-size: .72rem; opacity: .82;
    margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.coupon-card-meta {
    font-size: .68rem; opacity: .72;
    margin-top: 4px;
    font-weight: 600;
}
.coupon-card-action {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex; align-items: center;
    padding: 0 .85rem;
    background: rgba(0, 0, 0, .18);
}
.coupon-card-action button,
.coupon-card-action a {
    background: #fff;
    color: #18181b;
    font-weight: 800;
    font-size: .75rem;
    padding: .45rem .85rem;
    border-radius: .55rem;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s;
}
.coupon-card-action button:hover,
.coupon-card-action a:hover { transform: scale(1.05); }

/* Decorative perforation */
.coupon-card::before,
.coupon-card::after {
    content: "";
    position: absolute;
    width: 16px; height: 16px;
    background: var(--coupon-edge-color, #fff);
    border-radius: 50%;
    top: 50%; transform: translateY(-50%);
    z-index: 1;
}
.coupon-card::before { left: -8px; }
.coupon-card::after  { right: -8px; }

/* ── Themes ─────────────────────────────────────────────────── */
.coupon-theme-lime    { background: linear-gradient(135deg, #65A30D 0%, #4D7C0F 100%); }
.coupon-theme-orange  { background: linear-gradient(135deg, #F97316 0%, #C2410C 100%); }
.coupon-theme-pink    { background: linear-gradient(135deg, #EC4899 0%, #BE185D 100%); }
.coupon-theme-blue    { background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%); }
.coupon-theme-purple  { background: linear-gradient(135deg, #A855F7 0%, #6D28D9 100%); }
.coupon-theme-dark    { background: linear-gradient(135deg, #27272A 0%, #0A0A0A 100%); }
.coupon-theme-red     { background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%); }
.coupon-theme-teal    { background: linear-gradient(135deg, #14B8A6 0%, #0F766E 100%); }

/* ── Theme picker (editor) ─────────────────────────────────── */
.theme-swatch-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
}
.theme-swatch {
    height: 36px;
    border-radius: .55rem;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: transform .12s, border-color .15s;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.theme-swatch:hover { transform: scale(1.04); }
.theme-swatch.is-selected {
    border-color: #0A0A0A;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0A0A0A;
}

/* Image upload zone (compact) */
.coupon-upload-zone {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    min-height: 92px;
    border: 2px dashed #d4d4d8;
    border-radius: .75rem;
    background: #fafafa;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, background .15s;
}
.coupon-upload-zone:hover,
.coupon-upload-zone.drag-over { border-color: #65A30D; background: #f7fee7; }
.coupon-upload-zone.uploading { border-color: #3B82F6; }
.coupon-upload-zone img {
    width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0;
}
.coupon-upload-zone .upload-prompt {
    text-align: center; color: #71717a; font-size: .75rem; font-weight: 600;
    padding: .5rem; z-index: 1;
}
.coupon-upload-zone .upload-remove {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,.7); color: #fff; border: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 3;
}

/* Live preview wrapper */
.coupon-preview-wrap {
    background: linear-gradient(135deg, #fafafa 0%, #f4f4f5 100%);
    border: 1px dashed #d4d4d8;
    border-radius: .75rem;
    padding: 1rem;
}
.coupon-preview-wrap > .label {
    font-size: .65rem; font-weight: 700; letter-spacing: 1.5px;
    color: #71717a; text-transform: uppercase; margin-bottom: .5rem;
}

/* =============================================================
   PLANTILLAS RÁPIDAS
   ============================================================= */
.coupon-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .75rem;
}
.coupon-template-card {
    position: relative;
    text-align: left;
    padding: 1rem;
    border-radius: 1rem;
    border: 1.5px solid transparent;
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    overflow: hidden;
    min-height: 168px;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
/* Fallback si por algún motivo no se aplica un tema */
.coupon-template-card:not([class*="coupon-theme-"]) {
    background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
}
.coupon-template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, .35);
}
.coupon-template-card::after {
    content: '';
    position: absolute; right: -14px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.25) inset;
}
.coupon-template-emoji {
    font-size: 1.5rem;
    line-height: 1;
}
.coupon-template-tag {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    opacity: .85;
}
.coupon-template-disc {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    margin-top: auto;
    text-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.coupon-template-name {
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.25;
    opacity: .95;
}
.coupon-template-cta {
    margin-top: .35rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .7rem;
    font-weight: 700;
    padding: .35rem .55rem;
    border-radius: .5rem;
    background: rgba(0,0,0,.22);
    align-self: flex-start;
}
@media (max-width: 640px) {
    .coupon-templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .5rem;
    }
    .coupon-template-card { min-height: 150px; padding: .85rem; }
    .coupon-template-disc { font-size: 1.65rem; }
}
