/* Sponsored slots and CheSuper house promos (WP-F1, js/ad-slot.js). Tokens from css/tokens.css,
   so light ([data-theme="light"]) and dark both work. A sponsored unit is always visibly set
   apart from organic results: a label bar with "Patrocinado" and "¿Por qué veo esto?". */

.ad-bar {
    display: flex;
    flex-wrap: wrap;            /* never wider than its slot: a nowrap row widened the list page */
    align-items: center;
    gap: 0.2rem 0.5rem;
    min-height: 1.25rem;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    line-height: 1.2;
    color: var(--text-secondary);
}

.ad-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.45rem;
    border-radius: var(--radius-full, 9999px);
    border: 1px solid var(--warning-primary, #f59e0b);
    color: var(--warning-primary, #f59e0b);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

[data-theme="light"] .ad-chip {
    color: #92400e;
    border-color: #d97706;
    background: #fffbeb;
}

.ad-chip-house {
    border-color: var(--brand-primary, #2563eb);
    color: var(--text-link, #60a5fa);
}

[data-theme="light"] .ad-chip-house {
    color: var(--color-blue-800, #1e40af);
    border-color: var(--color-blue-600, #2563eb);
    background: var(--color-blue-050, #eff6ff);
}

.ad-brand {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-secondary);
}

.ad-why-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;               /* WCAG 2.2 target size (24 x 24) */
    margin-left: auto;
    padding: 0.2rem 0;
    border: 0;
    background: none;
    color: var(--text-link, #60a5fa);
    font: inherit;
    font-size: 0.7rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}

[data-theme="light"] .ad-why-link {
    color: var(--color-blue-700, #1d4ed8);
}

/* P1 / P2: a product card that reads as an ad, not as result #3 */
.product-card.ad-card {
    border: 1px solid var(--warning-primary, #f59e0b);
    border-left-width: 4px;
    margin: 0.35rem 0 0.45rem;
}

[data-theme="light"] .product-card.ad-card {
    border-color: #d97706;
}

.ad-noresults {
    margin-top: 0.5rem;
}

.ad-noresults-title {
    margin: 0.25rem 0 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* House promos (CheSuper's own sections, shown in shadow mode) */
.ad-house {
    margin: 0.35rem 0 0.45rem;
    padding: 0.55rem 0.85rem 0.7rem;
    border-radius: 8px;
    border: 1px dashed var(--border-strong, rgba(255, 255, 255, 0.3));
    background: var(--surface-card-inverse);
}

[data-theme="light"] .ad-house {
    border-color: var(--color-slate-500, #94a3b8);
}

.ad-house-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: inherit;
    text-decoration: none;
}

.ad-house-title {
    font-weight: 700;
    color: var(--text-strong);
}

.ad-house-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.ad-house-cta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-link, #60a5fa);
}

[data-theme="light"] .ad-house-cta {
    color: var(--color-blue-700, #1d4ed8);
}

/* P3: cart sidebar suggestion */
.ad-cart {
    margin: 0.75rem 0 0.25rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--warning-primary, #f59e0b);
    background: var(--surface-card-inverse);
}

@media (max-width: 768px) {
    /* keep "+ Agregar" clear of the floating list button */
    .cart-items .ad-cart {
        margin-bottom: 4.75rem;
    }
}

.ad-cart-title {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-strong);
}

.ad-cart-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ad-cart-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--surface-card-muted);
}

.ad-cart-info {
    flex: 1;
    min-width: 0;
}

.ad-cart-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.ad-cart-price {
    font-size: 0.72rem;
    color: var(--success-primary);
}

.ad-cart-add {
    flex-shrink: 0;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--brand-primary);
    background: transparent;
    color: var(--text-link, #60a5fa);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
}

[data-theme="light"] .ad-cart-add {
    color: var(--color-blue-700, #1d4ed8);
}

/* P4: sponsored substitute */
.ad-substitute {
    min-width: 0;
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-medium);
}

.ad-substitute .substitute-item {
    border: 1px solid var(--warning-primary, #f59e0b);
}

.ad-substitute-header {
    margin-bottom: 0.35rem;
}

/* P5: search chips below the search box */
.search-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    max-width: 640px;
    margin: 0.75rem auto 0;
    padding: 0 0.25rem;
}

.search-chips-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.search-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full, 9999px);
    border: 1px solid var(--border-medium);
    background: var(--surface-control);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

[data-theme="light"] .search-chip {
    background: var(--color-slate-050, #ffffff);
    border-color: var(--color-slate-500, #94a3b8);
    color: var(--color-slate-900, #0f172a);
}

.search-chip:hover {
    border-color: var(--brand-primary);
}

.search-chip-sponsored {
    border-color: var(--warning-primary, #f59e0b);
}

[data-theme="light"] .search-chip-sponsored {
    border-color: #d97706;
}

.search-chip .ad-chip {
    font-size: 0.58rem;
    padding: 0 0.3rem;
}

.search-chips-note {
    max-width: 640px;
    margin: 0.35rem auto 0;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.search-chips-note .ad-why-link {
    margin-left: 0.25rem;
}

@media (max-width: 480px) {
    /* one row on a phone (it scrolls sideways), so the Hoy conviene strip's first deal stays on
       the first screen under any number of chips (FX-2b follow-up, final review confirmed 25) */
    .search-chips {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        padding-bottom: 0.15rem;
    }

    .search-chips::-webkit-scrollbar {
        display: none;
    }

    .search-chips-label,
    .search-chip {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* P8: sponsored deal on /ofertas */
.ad-deal {
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--warning-primary, #f59e0b);
    background: var(--surface-card-inverse);
}

.ad-deal-body {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
}

.ad-deal-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--surface-card-muted);
}

.ad-deal-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ad-deal-name {
    font-weight: 600;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.ad-deal-price {
    font-size: 0.82rem;
    color: var(--success-primary);
}

.ad-deal-offer {
    color: var(--warning-primary, #ca8a04);
    font-weight: 600;
}

/* amber on white is 2.15:1; this is 7:1 (AA at any size) */
[data-theme="light"] .ad-deal-offer,
[data-theme="light"] .ad-multibuy,
[data-theme="light"] .ad-card .product-price-multibuy {
    color: #92400e;
}

/* "llevando N" next to a multi-buy effective per-unit price (P4 / P10) */
.ad-multibuy {
    color: var(--warning-primary, #f59e0b);
    font-weight: 600;
    white-space: nowrap;
}

/* P9: "Presentado por" label (the game) */
.ad-presented {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ad-presented .ad-why-link {
    margin-left: 0;
}

/* P10: calendar strip (above the grid; the chain order below never changes) */
.ad-strip {
    margin: 0 0 1rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--warning-primary, #f59e0b);
    background: var(--surface-card-inverse);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.ad-strip-house {
    border-style: dashed;
    border-color: var(--border-strong, rgba(255, 255, 255, 0.3));
}

.ad-strip-body {
    display: block;
    color: inherit;
    text-decoration: none;
    line-height: 1.4;
}

.ad-strip-product {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* "¿Por qué veo esto?" bottom sheet */
.ad-why-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--overlay-dim, rgba(0, 0, 0, 0.5));
}

.ad-why-backdrop[hidden] {
    display: none;
}

body.ad-why-open {
    overflow: hidden;
}

.ad-why-sheet {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 1.5rem;
    border-radius: 16px 16px 0 0;
    background: var(--surface-popover, #1e293b);
    color: var(--text-primary);
    box-shadow: var(--shadow-strong);
}

[data-theme="light"] .ad-why-sheet {
    background: var(--color-slate-050, #ffffff);
    color: var(--color-slate-900, #0f172a);
}

@media (min-width: 640px) {
    .ad-why-backdrop {
        align-items: center;
    }

    .ad-why-sheet {
        border-radius: 16px;
    }
}

.ad-why-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.ad-why-title {
    margin: 0 2rem 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: inherit;
}

.ad-why-content .ad-chip {
    margin-bottom: 0.5rem;
}

.ad-why-reason {
    margin: 0.4rem 0 0.6rem;
    font-weight: 600;
    line-height: 1.4;
}

.ad-why-detail,
.ad-why-muted {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

[data-theme="light"] .ad-why-detail,
[data-theme="light"] .ad-why-muted {
    color: var(--color-slate-600, #475569);
}

.ad-why-advertiser {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    margin: 0.9rem 0 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--surface-control);
    font-size: 0.85rem;
}

[data-theme="light"] .ad-why-advertiser {
    background: var(--color-slate-200, #f1f5f9);
}

.ad-why-advertiser dt {
    font-weight: 600;
    color: var(--text-secondary);
}

[data-theme="light"] .ad-why-advertiser dt {
    color: var(--color-slate-600, #475569);
}

.ad-why-advertiser dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.ad-why-policy {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-link, #60a5fa);
}

[data-theme="light"] .ad-why-policy {
    color: var(--color-blue-700, #1d4ed8);
}

/* politica-publicidad.html */
.policy-page {
    min-height: 100vh;
    background: var(--surface-app);
    color: var(--text-primary);
}

.policy-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem 16px 2rem;
}

.policy-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.policy-back {
    color: var(--text-link, #60a5fa);
    font-weight: 500;
    text-decoration: none;
}

[data-theme="light"] .policy-back {
    color: var(--color-blue-700, #1d4ed8);
}

.policy-theme {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-medium);
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.policy-content {
    padding: 1.5rem 1.25rem;
    border-radius: 16px;
    background: var(--surface-card-inverse);
    line-height: 1.6;
}

.policy-content h1 {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
    color: var(--text-heading);
}

.policy-content h2 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.1rem;
    color: var(--text-heading);
}

.policy-content p,
.policy-content li {
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.policy-content p {
    margin: 0 0 0.75rem;
}

.policy-content ul {
    padding-left: 1.2rem;
    margin: 0 0 0.75rem;
}

.policy-content li {
    margin-bottom: 0.4rem;
}

.policy-content a {
    color: var(--text-link, #60a5fa);
}

[data-theme="light"] .policy-content a {
    color: var(--color-blue-700, #1d4ed8);
}

.policy-updated {
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

.policy-lead {
    font-size: 1rem;
    color: var(--text-primary) !important;
}

[data-theme="light"] .policy-content h1,
[data-theme="light"] .policy-content h2,
[data-theme="light"] .policy-lead {
    color: var(--color-slate-900, #0f172a) !important;
}

[data-theme="light"] .policy-content p,
[data-theme="light"] .policy-content li {
    color: var(--color-slate-700, #334155);
}

@media (min-width: 768px) {
    .policy-content {
        padding: 2rem 2.25rem;
    }
}

/* units sit inside centred page sections (the home hero): keep their text left-aligned */
.ad-card,
.ad-house,
.ad-cart,
.ad-substitute,
.ad-deal,
.ad-strip,
.ad-noresults,
.ad-why-sheet {
    text-align: left;
}

.ad-why-close:focus:not(:focus-visible) {
    outline: none;
}

/* The unit's price at 11-13 px: --success-primary is 3.8:1 in both themes (final review nit n9) */
.ad-cart-price,
.ad-deal-price {
    color: #34d399;                 /* 7.6:1 on the dark card */
}

[data-theme="light"] .ad-cart-price,
[data-theme="light"] .ad-deal-price {
    color: #047857;                 /* 5.5:1 on white */
}
