/* Reset del contenedor del theme cuando estamos en la pagina de cupones.
   Hacemos que .rpx-coupons rompa el max-width de .page-main y ocupe 100vw. */
.page-main:has(.rpx-coupons),
.columns:has(.rpx-coupons),
.column.main:has(.rpx-coupons) {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.rpx-coupons {
    --rpx-verde-oscuro: #127C3E;
    --rpx-verde-medio: #1A9E4F;
    --rpx-verde-lima: #8DC63F;
    --rpx-verde-lima-dark: #6CA62D;
    --rpx-rojo: #E63946;
    --rpx-gris-claro: #F4F4F2;
    --rpx-gris-medio: #E5E5E0;
    --rpx-gris-texto: #5A5A5A;
    --rpx-texto: #1A1A1A;
    --rpx-blanco: #FFFFFF;
    --rpx-beige: #F9F5E9;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    color: var(--rpx-texto);
    line-height: 1.4;
    background: var(--rpx-gris-claro);
    /* Romper el container y ocupar 100vw como el mockup */
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0;
}
.rpx-coupons * { box-sizing: border-box; }
.rpx-coupons,
.rpx-coupons *,
.rpx-modal-overlay,
.rpx-modal-overlay * {
    font-family: 'Nunito', 'Segoe UI', sans-serif !important;
}

.rpx-hero {
    background: linear-gradient(135deg, var(--rpx-verde-oscuro) 0%, var(--rpx-verde-medio) 100%);
    color: var(--rpx-blanco);
    padding: 60px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.rpx-hero::before, .rpx-hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: var(--rpx-verde-lima);
    opacity: 0.15;
}
.rpx-hero::before { width: 300px; height: 300px; top: -100px; left: -100px; }
.rpx-hero::after  { width: 200px; height: 200px; bottom: -80px; right: -80px; }
.rpx-hero__badge {
    display: inline-block;
    background: var(--rpx-verde-lima);
    color: var(--rpx-verde-oscuro);
    font-weight: 800;
    padding: 6px 18px;
    border-radius: 40px;
    font-size: 13px;
    letter-spacing: 2px;
    margin-bottom: 18px;
}
.rpx-hero__title {
    font-size: clamp(28px, 5vw, 52px);
    font-weight: 900;
    margin: 0 0 12px;
    letter-spacing: -1px;
}
.rpx-hero__tagline {
    font-size: clamp(14px, 2vw, 18px);
    opacity: 0.95;
    max-width: 640px;
    margin: 0 auto;
}

.rpx-coupons .rpx-filters-wrap {
    background: var(--rpx-blanco);
    padding: 24px 40px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.rpx-coupons .rpx-filters {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.rpx-coupons .rpx-filters label {
    margin: 0;
    padding: 0;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.4;
    color: var(--rpx-verde-oscuro);
    background: transparent;
}
.rpx-coupons .rpx-filters select,
.rpx-coupons .rpx-filters select.rpx-filter {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
    height: auto;
    min-height: 0;
    width: auto;
    min-width: 200px;
    margin: 0;
    padding: 11px 42px 11px 20px;
    border: 2px solid var(--rpx-gris-medio);
    border-radius: 40px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--rpx-texto);
    background-color: var(--rpx-blanco);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%23127C3E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 12px 8px;
    box-shadow: none;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rpx-coupons .rpx-filters select::-ms-expand {
    display: none;
}
.rpx-coupons .rpx-filters select:hover {
    border-color: var(--rpx-verde-lima-dark);
}
.rpx-coupons .rpx-filters select:focus,
.rpx-coupons .rpx-filters select.rpx-filter:focus {
    border-color: var(--rpx-verde-lima);
    box-shadow: 0 0 0 3px rgba(141, 198, 63, 0.22);
}

.rpx-coupons-section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}
.rpx-section-title { text-align: center; margin-bottom: 36px; }
.rpx-section-title h2 {
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 900;
    color: var(--rpx-verde-oscuro);
    margin: 0;
}
.rpx-section-title h2 span { color: var(--rpx-verde-lima); }
.rpx-section-title p { color: var(--rpx-gris-texto); font-size: 15px; margin: 6px 0 0; }

.rpx-empty { grid-column: 1 / -1; text-align: center; color: #888; padding: 40px; }

.rpx-coupons-section--upcoming { padding-top: 0; }
.rpx-coupons-section--upcoming .rpx-section-title { margin-top: 24px; }
.rpx-coupon-card--upcoming { opacity: 0.78; filter: grayscale(0.25); }
.rpx-coupon-card--upcoming:hover { opacity: 1; filter: none; }
.rpx-upcoming-badge {
    display: inline-block;
    align-self: flex-start;
    background: var(--rpx-gris-claro);
    color: var(--rpx-verde-oscuro);
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px dashed var(--rpx-verde-oscuro);
    margin-top: auto;
}

.rpx-coupons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
@media (max-width: 1199px) {
    .rpx-coupons-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .rpx-coupons-grid { grid-template-columns: 1fr; gap: 16px; }
    .rpx-coupons-section { padding: 32px 18px 56px; }
    .rpx-coupons .rpx-filters-wrap { padding: 16px 18px; }
    .rpx-coupons .rpx-filters {
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
    }
    .rpx-coupons .rpx-filters label {
        text-align: left;
    }
    .rpx-coupons .rpx-filters select,
    .rpx-coupons .rpx-filters select.rpx-filter {
        width: 100%;
        min-width: 0;
    }
}

.rpx-coupon-card {
    background: var(--rpx-beige);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    display: flex;
    box-shadow: 0 6px 20px rgba(18,124,62,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 220px;
}
.rpx-coupon-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(18,124,62,0.18);
}
.rpx-coupon-card::before,
.rpx-coupon-card::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--rpx-gris-claro);
    border-radius: 50%;
    left: 34%;
}
.rpx-coupon-card::before { top: -10px; }
.rpx-coupon-card::after  { bottom: -10px; }

.rpx-coupon-left {
    container-type: inline-size;
    width: 34%;
    background: var(--rpx-verde-oscuro);
    color: var(--rpx-blanco);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.rpx-coupon-left::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: repeating-linear-gradient(to bottom, var(--rpx-gris-claro) 0 6px, transparent 6px 12px);
}
.rpx-discount {
    /*
     * Fluid sizing: scales with the container width AND the text length.
     * --rpx-len is set inline in the template (= number of characters).
     * cqi = container query inline (= width of .rpx-coupon-left, which
     * already has horizontal padding so 100cqi excludes that padding).
     * 78cqi/length leaves visual breathing room so the text never touches
     * the edge of the green panel even with very long values.
     */
    font-size: clamp(16px, calc(78cqi / var(--rpx-len, 4)), 48px);
    font-weight: 900;
    line-height: 1;
    color: var(--rpx-verde-lima);
    max-width: 100%;
    text-align: center;
    box-sizing: border-box;
    letter-spacing: -0.5px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rpx-discount-sub {
    /* Same fluid logic for the small subtitle ("OFF", "2DA UNIDAD", etc.). */
    font-size: clamp(9px, calc(50cqi / var(--rpx-len, 6)), 16px);
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-top: 4px;
    color: var(--rpx-blanco);
    text-align: center;
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rpx-category-chip {
    background: var(--rpx-verde-lima);
    color: var(--rpx-verde-oscuro);
    /*
     * Fluid sizing: --rpx-len (set inline) is the length of the longest WORD
     * in the chip text. The chip only allows breaks on whitespace
     * (overflow-wrap/word-break: normal), so single long words like
     * "Perfumería" never split mid-character; instead the font shrinks until
     * that longest word fits in the green panel. Multi-word categories like
     * "Perfumería y acondicionador" wrap on the spaces. The 88cqi divisor
     * is calibrated so a ~10-char word ("PERFUMERÍA") sits near the upper
     * end of the clamp (no wasted space in the dark-green panel) while a
     * very long unbreakable word still scales down to fit.
     */
    font-size: clamp(9px, calc(88cqi / var(--rpx-len, 6)), 14px);
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.2;
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 12px;
    text-transform: uppercase;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    box-sizing: border-box;
    text-align: center;
}

.rpx-coupon-right {
    flex: 1;
    min-width: 0;
    padding: 18px 22px 18px 28px;
    display: flex;
    flex-direction: column;
}
.rpx-coupon-right h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--rpx-texto);
    margin: 0 0 8px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rpx-coupon-meta {
    font-size: 12px;
    color: var(--rpx-gris-texto);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    min-width: 0;
}
.rpx-coupon-meta > span {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
    min-width: 0;
}
.rpx-coupon-meta .rpx-meta-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rpx-coupon-meta span .ico {
    flex-shrink: 0;
    margin-top: 1px;
}
.rpx-coupon-meta .ico {
    display: inline-flex;
    width: 16px; height: 16px;
    align-items: center; justify-content: center;
    color: var(--rpx-verde-oscuro);
    font-size: 13px;
}

.rpx-activate-btn {
    margin-top: auto;
    background: var(--rpx-verde-lima);
    color: var(--rpx-verde-oscuro);
    padding: 10px 16px;
    border-radius: 40px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
    transition: background 0.2s, color 0.2s;
}
.rpx-activate-btn:hover { background: var(--rpx-verde-oscuro); color: var(--rpx-verde-lima); }

.rpx-how {
    background: var(--rpx-blanco);
    padding: 64px 40px;
    border-top: 1px solid var(--rpx-gris-medio);
}
.rpx-how-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
}
.rpx-how-step { text-align: center; padding: 20px; }
.rpx-how-step .num {
    width: 56px; height: 56px;
    background: var(--rpx-verde-lima);
    color: var(--rpx-verde-oscuro);
    border-radius: 50%;
    font-size: 24px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.rpx-how-step h4 {
    color: var(--rpx-verde-oscuro);
    font-size: 17px;
    margin: 0 0 8px;
    font-weight: 800;
}
.rpx-how-step p { color: var(--rpx-gris-texto); font-size: 14px; margin: 0; }

.rpx-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.rpx-modal-overlay.active { display: flex; }
.rpx-modal {
    background: var(--rpx-blanco);
    border-radius: 18px;
    max-width: 420px;
    width: 100%;
    padding: 30px 28px;
    position: relative;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}
.rpx-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0;
    background: var(--rpx-gris-claro);
    border: none;
    border-radius: 50%;
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
    color: var(--rpx-gris-texto);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.rpx-modal-close:hover { background: var(--rpx-rojo); color: var(--rpx-blanco); }
.rpx-m-discount {
    font-size: 48px;
    font-weight: 900;
    color: var(--rpx-verde-oscuro);
    line-height: 1;
    margin-bottom: 6px;
}
.rpx-m-discount span { color: var(--rpx-verde-lima); }
.rpx-m-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--rpx-texto);
    margin-bottom: 4px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rpx-m-subtitle { font-size: 13px; color: var(--rpx-gris-texto); margin-bottom: 18px; }
.rpx-qr-box {
    background: var(--rpx-beige);
    border: 3px dashed var(--rpx-verde-lima);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
}
.rpx-qr-box img { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.rpx-qr-isf {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: var(--rpx-gris-texto);
    margin-top: 8px;
    letter-spacing: 1px;
    opacity: 0.7;
}
.rpx-m-instructions {
    background: var(--rpx-gris-claro);
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    color: var(--rpx-gris-texto);
    text-align: left;
    line-height: 1.5;
    margin-bottom: 14px;
}
.rpx-m-instructions b { color: var(--rpx-verde-oscuro); }
.rpx-m-limits {
    font-size: 12px;
    color: var(--rpx-gris-texto);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}
.rpx-m-limits div {
    padding: 8px 12px;
    background: var(--rpx-gris-claro);
    border-radius: 6px;
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rpx-m-limits div .ico {
    color: var(--rpx-verde-oscuro);
    margin-right: 4px;
}
.rpx-m-limits div b {
    word-break: keep-all;
    overflow-wrap: normal;
    white-space: nowrap;
    margin-right: 4px;
}
.rpx-m-limits .ico { color: var(--rpx-verde-oscuro); font-weight: 800; }

@media (max-width: 560px) {
    .rpx-coupon-card { min-height: 180px; }
    .rpx-coupon-right h3 { font-size: 15px; }
    .rpx-activate-btn { font-size: 12px; padding: 9px 12px; }
    .rpx-modal { padding: 24px 18px; border-radius: 14px; }
    .rpx-m-discount { font-size: 40px; }
    .rpx-m-title { font-size: 17px; }
    .rpx-qr-box img { width: 170px; height: 170px; }
    .rpx-how-step { padding: 12px; }
}

@media (max-width: 380px) {
    .rpx-hero { padding: 32px 16px; }
    .rpx-hero__badge { font-size: 11px; padding: 5px 14px; }
    .rpx-coupon-card { flex-direction: column; min-height: auto; }
    .rpx-coupon-card::before,
    .rpx-coupon-card::after { display: none; }
    .rpx-coupon-left {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        padding: 14px 16px;
    }
    .rpx-coupon-left::after {
        left: 14px;
        right: 14px;
        top: auto;
        bottom: -1px;
        height: 2px;
        width: auto;
        background: repeating-linear-gradient(to right, var(--rpx-gris-claro) 0 6px, transparent 6px 12px);
    }
    .rpx-category-chip { margin-top: 0; }
    .rpx-coupon-right { padding: 16px; }
}
