/**
 * CardVerse — Ficha de producto (producto-detalle.php)
 * Clases principales: cv-product-page, cv-product-layout, cv-gallery, cv-card-preview,
 * cv-product-info, cv-offers-panel, cv-offer-row, cv-benefits-bar
 */

.cv-product-page {
    --cv-purple: #7c3aed;
    --cv-purple-soft: #f5f3ff;
    --cv-orange: #f97316;
    --cv-green: #16a34a;
    --cv-bg: #f4f6f9;
    --cv-surface: #ffffff;
    --cv-border: #e8ecf1;
    --cv-text: #0f172a;
    --cv-muted: #64748b;
    --cv-radius: 14px;
    --cv-radius-lg: 20px;
    --cv-shadow-soft: 0 16px 48px rgba(15, 23, 42, 0.1);
    --cv-max: 1440px;
    overflow-x: hidden;
}

.page-producto-detalle.store-marketplace .producto-main {
    max-width: none;
    margin: 0;
    padding: 1.25rem 1.5rem 2.5rem;
    background: var(--cv-bg);
}

.cv-product-page__inner {
    max-width: var(--cv-max);
    margin: 0 auto;
    padding: 0;
}

/* ——— Topbar ——— */
.cv-product-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
}

.cv-product-topbar__actions {
    flex-shrink: 0;
    margin-left: auto;
}

.product-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.84rem;
    color: var(--cv-muted);
    min-width: 0;
}

.product-breadcrumb-list li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.product-breadcrumb-list li + li::before {
    content: "›";
    color: #cbd5e1;
    margin-right: 0.15rem;
}

.product-breadcrumb-list a {
    color: var(--cv-muted);
    text-decoration: none;
}

.product-breadcrumb-list a:hover {
    color: var(--cv-purple);
}

.product-breadcrumb-current {
    color: var(--cv-text);
    font-weight: 600;
}

.product-breadcrumb-name {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-product-action-btn,
.product-action-btn {
    min-height: 44px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-color: var(--cv-border);
    background: var(--cv-surface);
    white-space: nowrap;
}

.cv-product-action-btn:hover {
    border-color: var(--cv-purple);
    color: var(--cv-purple);
}

/* ——— Layout 3 columnas ——— */
.cv-product-layout {
    display: grid;
    gap: 1.75rem 2rem;
    align-items: start;
}

@media (min-width: 992px) {
    .cv-product-layout {
        grid-template-columns: minmax(280px, 32%) minmax(0, 1fr) minmax(440px, 38%);
    }

    .cv-gallery {
        position: sticky;
        top: calc(var(--store-header-h, 212px) + 1rem);
    }

    .cv-offers-panel {
        position: sticky;
        top: calc(var(--store-header-h, 212px) + 1rem);
        min-width: 440px;
        align-self: start;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .cv-product-layout {
        grid-template-columns: minmax(220px, 38%) minmax(0, 1fr);
        align-items: start;
    }

    .cv-gallery {
        position: relative;
        top: 0;
    }

    .cv-product-info__body,
    .product-info-col .producto-hero {
        padding-top: 0;
        min-width: 0;
    }

    .cv-effect-box,
    .product-effect-box {
        margin-top: 0.5rem;
    }

    .cv-offers-panel {
        grid-column: 1 / -1;
    }
}

/* ——— Galería ——— */
.cv-gallery {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.85rem;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.cv-gallery__thumbs {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex-shrink: 0;
    width: 72px;
}

.cv-gallery-thumb,
.product-gallery-thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    background: var(--cv-surface);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.cv-gallery-thumb img,
.product-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-gallery-thumb.is-active,
.cv-gallery-thumb:hover,
.product-gallery-thumb.is-active,
.product-gallery-thumb:hover {
    border-color: var(--cv-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.cv-gallery-thumb--3d {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--cv-muted);
    text-align: center;
    line-height: 1.2;
    padding: 0.35rem;
}

.cv-gallery-thumb--3d i {
    font-size: 1.15rem;
    color: var(--cv-purple);
}

.cv-card-preview,
.product-gallery-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 0;
    background: transparent;
    border-radius: 0;
}

.cv-card-preview img,
.product-gallery-main img {
    width: 100%;
    max-width: 420px;
    height: auto;
    border-radius: 14px;
    box-shadow: var(--cv-shadow-soft);
    transition: transform 0.25s ease;
}

.cv-card-preview img:hover {
    transform: translateY(-3px);
}

/* ——— Info central (sin card pesada) ——— */
.cv-product-info__body,
.product-info-col .producto-hero {
    display: block;
    margin: 0;
    padding: 0.25rem 0 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.cv-product-kicker,
.producto-hero-type {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cv-muted);
    margin: 0 0 0.45rem;
}

.cv-product-title,
.producto-hero-title {
    font-size: clamp(1.65rem, 2.8vw, 2.35rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.025em;
    color: var(--cv-text);
    margin: 0 0 1rem;
}

.cv-product-badges,
.cv-product-stats,
.product-hero-badges,
.product-stat-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.cv-product-formats {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--cv-text);
    margin: -0.35rem 0 1rem;
}

.cv-product-formats::before {
    content: 'Formato: ';
    font-weight: 700;
    color: var(--cv-muted);
}

.cv-product-formats .cv-format-pill--forbidden { color: #dc2626; font-weight: 600; }
.cv-product-formats .cv-format-pill--limited { color: #d97706; font-weight: 600; }
.cv-product-formats .cv-format-pill--semi { color: #ca8a04; font-weight: 600; }
.cv-product-formats .cv-format-pill--unlimited { color: #059669; font-weight: 600; }

.product-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.2;
}

.product-badge--set {
    background: var(--cv-purple-soft);
    color: var(--cv-purple);
}

.product-badge--rarity {
    background: #fff7ed;
    color: #c2410c;
}

.product-badge--code {
    background: #f1f5f9;
    color: #475569;
}

.product-badge--stat {
    background: #f8fafc;
    border: 1px solid var(--cv-border);
    color: var(--cv-text);
    font-weight: 600;
}

.cv-effect-box,
.product-effect-box {
    background: #f8fafc;
    border: 1px solid var(--cv-border);
    border-radius: var(--cv-radius);
    padding: 1rem 1.15rem;
    margin-bottom: 1.15rem;
}

.product-effect-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--cv-muted);
    margin: 0 0 0.55rem;
}

.cv-effect-text,
.producto-hero-desc {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--cv-text);
    margin: 0 0 0.75rem;
    max-height: 11rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.product-rulings-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--cv-purple);
    text-decoration: none;
}

.product-rulings-link:hover {
    color: #6d28d9;
    text-decoration: underline;
}

.cv-meta-table,
.product-meta-list {
    display: grid;
    gap: 0.55rem;
    margin: 0 0 1.15rem;
    font-size: 0.9rem;
    border-top: 1px solid var(--cv-border);
    padding-top: 1rem;
}

.cv-meta-table div,
.product-meta-list div {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.75rem;
    align-items: baseline;
}

.cv-meta-table dt,
.product-meta-list dt {
    margin: 0;
    color: var(--cv-muted);
    font-weight: 600;
}

.cv-meta-table dd,
.product-meta-list dd {
    margin: 0;
    color: var(--cv-text);
    font-weight: 500;
}

.cv-physical-alert,
.product-store-alert {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    border-radius: var(--cv-radius);
    background: var(--cv-purple-soft);
    border: 1px solid rgba(124, 58, 237, 0.18);
    font-size: 0.88rem;
}

.cv-physical-alert i,
.product-store-alert i {
    font-size: 1.3rem;
    color: var(--cv-purple);
    flex-shrink: 0;
}

.cv-physical-alert strong,
.product-store-alert strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--cv-text);
}

.cv-physical-alert p,
.product-store-alert p {
    color: var(--cv-muted);
    font-size: 0.84rem;
    margin: 0;
}

/* ——— Panel ofertas ——— */
.cv-offers-panel__inner,
.product-offers-col .producto-listings-section {
    margin: 0;
    padding: 1.15rem 1.2rem;
    border-radius: var(--cv-radius-lg);
    border: 1px solid var(--cv-border);
    background: var(--cv-surface);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.05);
}

.cv-offers-header,
.cv-offers-head,
.product-offers-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.85rem;
    flex-wrap: nowrap;
}

.cv-offers-head__copy {
    flex: 1;
    min-width: 0;
}

.cv-offers-title,
.producto-listings-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--cv-text);
    margin: 0 0 0.15rem;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.cv-offers-sub,
.producto-listings-sub {
    margin: 0;
    font-size: 0.8rem;
    color: var(--cv-muted);
    line-height: 1.35;
}

.cv-offers-tools,
.cv-offers-toolbar,
.product-offers-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.cv-offers-filter-btn,
.cv-offers-sort,
.product-offers-filter-btn,
.product-offers-sort {
    min-height: 38px;
    border-radius: 10px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.cv-offers-sort,
.product-offers-sort {
    min-width: 118px;
    max-width: 132px;
}

.product-offers-filter-panel {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.product-offers-filter-condition {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.product-offers-filter-condition__label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cv-muted, #64748b);
}

.product-offers-condition-select,
.producto-market-cond-select {
    min-height: 38px;
    border-radius: 10px;
    font-size: 0.82rem;
}

.producto-market-toolbar {
    display: flex;
    justify-content: flex-end;
}

.producto-market-cond-select-wrap {
    min-width: min(100%, 220px);
}

.cv-offer-row__cond-note,
.product-offer-card__cond-note {
    display: block;
    font-size: 0.72rem;
    color: var(--cv-muted, #64748b);
    margin-top: 0.15rem;
}

.cv-offers-source,
.product-offers-source {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    color: var(--cv-purple);
    font-weight: 600;
    background: var(--cv-purple-soft);
}

.cv-offers-list-wrap {
    margin: 0;
    padding: 0;
    overflow: visible;
}

.cv-offers-list,
.product-offers-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
}

/* ——— Fila de oferta horizontal compacta ——— */
.cv-offer-row,
.product-offer-card:not(.cv-offer-item) {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) minmax(112px, 128px);
    grid-template-areas: "thumb info commerce";
    gap: 0.55rem 0.75rem;
    align-items: center;
    min-height: 86px;
    max-height: none;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--cv-border);
    border-radius: 12px;
    background: var(--cv-surface);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    cursor: default;
    transform: none !important;
    flex-direction: unset !important;
    box-shadow: none;
}

.cv-offer-row:hover,
.product-offer-card:not(.cv-offer-item):hover {
    border-color: rgba(124, 58, 237, 0.28);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    background: #fafbfc;
    transform: none !important;
}

.cv-offer-thumb,
.cv-offer-row__thumb,
.product-offer-card__media {
    grid-area: thumb;
    width: 52px;
    height: 76px;
    min-height: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none !important;
}

.cv-offer-thumb img,
.cv-offer-row__thumb img,
.product-offer-card__media img,
.page-producto-detalle .tienda-product-image {
    width: 100% !important;
    height: 100% !important;
    max-height: 76px !important;
    object-fit: contain !important;
    display: block;
    padding: 0.15rem;
}

.cv-offer-info,
.cv-offer-row__main,
.product-offer-card__body {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    padding: 0 !important;
}

.cv-offer-row__title,
.product-offer-card__title {
    font-size: 0.84rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: var(--cv-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-offer-row__set,
.product-offer-card__set {
    font-size: 0.74rem;
    color: var(--cv-muted);
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-offer-row__code {
    font-size: 0.72rem;
    color: #94a3b8;
    margin: 0;
    font-weight: 600;
}

.cv-offer-row__meta,
.product-offer-card__meta {
    display: none;
}

.cv-offer-price,
.cv-offer-row__commerce,
.product-offer-card__price-row {
    grid-area: commerce;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.15rem;
    text-align: right;
    min-width: 0;
}

.cv-offer-row__price,
.product-offer-card__price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--cv-green);
    letter-spacing: -0.02em;
    line-height: 1;
}

.cv-offer-row__shipping,
.product-offer-card__shipping {
    font-size: 0.68rem;
    color: var(--cv-muted);
    white-space: nowrap;
}

.cv-offer-row__stock {
    display: none;
}

.cv-offer-actions,
.cv-offer-row__actions,
.product-offer-card__actions {
    margin-top: 0.2rem;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
    width: 100%;
}

.cv-offer-collection-btn,
.btn-add-collection {
    flex-shrink: 0;
    width: 42px;
    min-width: 42px;
    min-height: 36px;
    padding: 0;
    border-radius: 10px;
    border: 1.5px solid var(--cv-purple);
    background: #fff;
    color: var(--cv-purple);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cv-offer-collection-btn:hover,
.btn-add-collection:hover {
    background: var(--cv-purple-soft, #f5f3ff);
    border-color: #6d28d9;
    color: #6d28d9;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.18);
}

.cv-offer-collection-btn:focus-visible,
.btn-add-collection:focus-visible {
    outline: 2px solid var(--cv-purple);
    outline-offset: 2px;
}

.btn-add-collection.is-in-collection,
.cv-offer-collection-btn.is-in-collection {
    border-color: #ef4444;
    color: #ef4444;
    background: #fff5f5;
}

.btn-add-collection.is-in-collection:hover,
.cv-offer-collection-btn.is-in-collection:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #ffe4e6;
}

.cv-offer-row__actions .tienda-btn-cart,
.cv-offer-row__actions .btn-market-prices,
.product-offer-card__actions .tienda-btn-cart,
.product-offer-card__actions .btn-market-prices {
    flex: 1;
    width: auto;
    min-width: 0;
    min-height: 36px;
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.68rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
}

.cv-offer-row__actions .btn-market-prices,
.product-offer-card__actions .btn-market-prices {
    background: var(--cv-purple);
    border: 1px solid var(--cv-purple);
    color: #fff;
}

.cv-offer-row__actions .btn-market-prices:hover,
.product-offer-card__actions .btn-market-prices:hover {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
}

.cv-offer-row__actions .btn-vendor-cart,
.cv-offer-row__actions .btn-add-cart,
.product-offer-card__actions .btn-vendor-cart,
.product-offer-card__actions .btn-add-cart {
    background: #16a34a;
    border: 1px solid #16a34a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.28);
}

.cv-offer-row__actions .btn-vendor-cart:hover,
.cv-offer-row__actions .btn-add-cart:hover,
.product-offer-card__actions .btn-vendor-cart:hover,
.product-offer-card__actions .btn-add-cart:hover {
    background: #15803d;
    border-color: #15803d;
    color: #fff;
}

.product-offer-card--in-stock {
    border-color: rgba(22, 163, 74, 0.35);
    background: linear-gradient(90deg, rgba(220, 252, 231, 0.55) 0%, #fff 28%);
}

.product-offer-card--in-stock .cv-offer-row__price,
.product-offer-card--in-stock .product-offer-card__price {
    color: #15803d;
}

.product-offer-card--market {
    opacity: 1;
}

[data-theme="dark"] .product-offer-card--in-stock {
    border-color: rgba(34, 197, 94, 0.35);
    background: linear-gradient(90deg, rgba(22, 101, 52, 0.25) 0%, #1e293b 30%);
}

[data-theme="dark"] .product-offer-card--in-stock .cv-offer-row__price,
[data-theme="dark"] .product-offer-card--in-stock .product-offer-card__price {
    color: #4ade80;
}

.producto-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    width: fit-content;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
}

.producto-stock-badge--out {
    background: #f1f5f9;
    color: #64748b;
}

.cv-view-all-offers,
.cv-offers-more,
.product-offers-more {
    width: 100%;
    min-height: 44px;
    margin-top: 0.85rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.86rem;
    border-color: rgba(124, 58, 237, 0.35);
    color: var(--cv-purple);
    background: var(--cv-purple-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.cv-view-all-offers:hover,
.cv-offers-more:hover,
.product-offers-more:hover {
    background: var(--cv-purple);
    border-color: var(--cv-purple);
    color: #fff;
}

/* ——— Offcanvas todas las ofertas ——— */
.cv-offers-drawer,
.cv-all-offers-panel,
.offcanvas.cv-offers-drawer {
    width: min(620px, 42vw) !important;
    max-width: 100vw;
    overflow-x: hidden;
    height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1199.98px) {
    .cv-offers-drawer,
    .cv-all-offers-panel,
    .offcanvas.cv-offers-drawer {
        width: min(560px, 50vw) !important;
    }
}

@media (max-width: 991.98px) {
    .cv-offers-drawer,
    .cv-all-offers-panel,
    .offcanvas.cv-offers-drawer {
        width: min(520px, 90vw) !important;
    }
}

@media (max-width: 576px) {
    .cv-offers-drawer,
    .cv-all-offers-panel,
    .offcanvas.cv-offers-drawer,
    .cv-all-offers-panel.offcanvas-bottom,
    .cv-all-offers-panel.offcanvas-end {
        width: 100vw !important;
        max-width: 100vw;
    }
}

.cv-offers-drawer-body,
.cv-all-offers-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 18px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.cv-all-offers-header,
.cv-offers-drawer .offcanvas-header {
    flex-shrink: 0;
    border-bottom: 1px solid var(--cv-border);
    padding: 18px 18px 16px;
}

.cv-offers-filters {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    padding-bottom: 12px;
    margin: 0 -2px 4px;
    flex-shrink: 0;
}

.cv-offers-tools--modal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 10px;
    flex-shrink: 0;
}

.cv-offers-filters .product-offers-filter-panel,
.cv-offers-filters .cv-offers-filter-panel {
    margin-bottom: 0;
}

.cv-offers-list--modal .cv-offer-cond {
    margin: 0;
    line-height: 1.25;
    flex-shrink: 0;
}

.cv-offers-tools--modal .cv-offers-search-wrap {
    grid-column: 1 / -1;
    height: 46px;
    padding: 0 0.85rem;
    border-radius: 14px;
}

.cv-offers-tools--modal .cv-offers-search {
    min-height: 44px;
    font-size: 0.9rem;
}

.cv-offers-list--modal {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    padding-right: 0;
}

/* ——— Item del drawer (marketplace row) ——— */
.cv-offers-list--modal .cv-offer-item {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) 150px;
    grid-template-areas: none;
    gap: 14px;
    align-items: center;
    min-height: 118px;
    padding: 14px 16px;
    border: 1px solid #e8eaf2;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    min-width: 0;
    margin-bottom: 12px;
    overflow: visible;
    cursor: default;
    transform: none !important;
    flex-direction: unset !important;
}

.cv-offers-list--modal .cv-offer-item:last-child {
    margin-bottom: 0;
}

.cv-offers-list--modal .cv-offer-item:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
    border-color: rgba(124, 58, 237, 0.35);
}

.cv-offers-list--modal .cv-offer-thumb {
    width: 72px;
    height: 96px;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    align-self: center;
    padding: 0;
    border: 0;
    grid-area: unset;
}

.cv-offers-list--modal .cv-offer-thumb img {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block;
    padding: 4px;
}

.cv-offers-list--modal .cv-offer-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    align-self: center;
    overflow: visible;
}

.cv-offers-list--modal .cv-offer-title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    color: #111827;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cv-offers-list--modal .cv-offer-set {
    margin: 0;
    font-size: 12px;
    line-height: 1.25;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cv-offers-list--modal .cv-offer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}

.cv-offers-list--modal .cv-badge-rarity {
    font-size: 11px;
    font-weight: 700;
    color: #6d28d9;
    background: #f3e8ff;
    border-radius: 999px;
    padding: 3px 7px;
}

.cv-offers-list--modal .cv-code {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.cv-offers-list--modal .cv-stock-badge {
    display: inline-flex;
    margin-top: 2px;
    width: fit-content;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    background: #eef2f7;
    border-radius: 999px;
    padding: 4px 8px;
    line-height: 1.2;
}

.cv-offers-list--modal .cv-stock-badge--in {
    color: #15803d;
    background: #dcfce7;
}

.cv-offers-list--modal .cv-offer-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    align-self: center;
    grid-area: unset;
}

.cv-offers-list--modal .cv-offer-price {
    font-size: 22px;
    font-weight: 900;
    color: #16a34a;
    line-height: 1;
    white-space: nowrap;
}

.cv-offers-list--modal .cv-offer-shipping {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    line-height: 1.2;
}

.cv-offers-list--modal .cv-offer-side-actions,
.cv-offers-list--modal .cv-offer-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    margin-top: 0;
    flex-shrink: 0;
}

.cv-offers-list--modal .cv-offer-btn,
.cv-offers-list--modal .cv-offer-side-actions .btn-market-prices,
.cv-offers-list--modal .cv-offer-side-actions .btn-vendor-cart,
.cv-offers-list--modal .cv-offer-actions .btn-market-prices,
.cv-offers-list--modal .cv-offer-actions .btn-vendor-cart {
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    line-height: 1.15;
}

.cv-offers-list--modal .cv-offer-side-actions .cv-offer-collection-btn,
.cv-offers-list--modal .cv-offer-side-actions .btn-add-collection,
.cv-offers-list--modal .cv-offer-actions .cv-offer-favorite,
.cv-offers-list--modal .cv-offer-actions .cv-offer-collection-btn,
.cv-offers-list--modal .cv-offer-actions .btn-add-collection {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 12px;
    flex-shrink: 0;
}

.cv-offer-row__thumb--clickable {
    cursor: zoom-in;
    transition: box-shadow 0.15s;
}

.cv-offer-row__thumb--clickable:hover,
.cv-offer-row__thumb--clickable:focus-visible {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
    outline: none;
}

.cv-offer-image-modal .modal-content {
    border: 0;
    border-radius: 16px;
    overflow: hidden;
}

.cv-offer-image-modal__img {
    max-width: 100%;
    max-height: min(72vh, 640px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

.cv-offers-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--cv-border);
    border-radius: 10px;
    background: #f8fafc;
    grid-column: 1 / -1;
}

.cv-offers-search-wrap i {
    color: var(--cv-muted);
    flex-shrink: 0;
}

.cv-offers-search {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    min-height: 34px;
}

.cv-offers-search:focus {
    box-shadow: none;
}

.cv-offer-row__rarity,
.product-offer-card__rarity {
    font-size: 0.74rem;
    color: #7c3aed;
    margin: 0;
    line-height: 1.25;
    font-weight: 600;
}

.cv-share-toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 120%);
    z-index: 1090;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 0.84rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.cv-share-toast.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* ——— Barra de beneficios ——— */
.cv-benefits-bar,
.product-trust-badges {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-top: 2rem;
    padding: 0;
    background: var(--cv-surface);
    border: 1px solid var(--cv-border);
    border-radius: var(--cv-radius-lg);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.cv-benefits-bar__item,
.product-trust-badge {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.25rem 1.15rem;
    font-size: 0.82rem;
    color: var(--cv-muted);
    border-right: 1px solid var(--cv-border);
}

.cv-benefits-bar__item:last-child {
    border-right: none;
}

.cv-benefits-bar__item i,
.product-trust-badge i {
    font-size: 1.35rem;
    color: var(--cv-purple);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.cv-benefits-bar__item strong,
.product-trust-badge strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--cv-text);
    margin-bottom: 0.15rem;
}

.cv-benefits-bar__item span {
    display: block;
    font-size: 0.78rem;
    line-height: 1.4;
}

/* ——— Mobile bar ——— */
.product-mobile-action {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--cv-border);
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(8px);
}

.product-mobile-action__inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: var(--cv-max);
    margin: 0 auto;
}

.product-mobile-action__price {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--cv-text);
}

.product-mobile-action #productMobileBtn {
    min-height: 44px;
    min-width: 140px;
    background: var(--cv-purple);
    border-color: var(--cv-purple);
}

.producto-error {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--cv-surface);
    border-radius: var(--cv-radius-lg);
    border: 1px solid var(--cv-border);
}

.product-cta-btn {
    min-height: 44px;
    border-radius: 12px;
    font-weight: 700;
}

/* ——— Responsive ——— */
@media (max-width: 991.98px) {
    .cv-offers-panel__inner {
        padding: 1.15rem;
    }
}

@media (max-width: 767.98px) {
    .page-producto-detalle.store-marketplace .producto-main {
        padding: 0.75rem 0.75rem 5.5rem;
    }

    .cv-product-topbar {
        flex-wrap: wrap;
    }

    .product-breadcrumb-home-label,
    .product-breadcrumb-list li:nth-child(3),
    .product-breadcrumb-list #breadcrumbType {
        display: none;
    }

    .product-breadcrumb-name {
        max-width: 140px;
    }

    .cv-product-topbar__actions {
        width: 100%;
        justify-content: flex-end;
    }

    .cv-gallery {
        flex-direction: column-reverse;
        align-items: center;
    }

    .cv-gallery__thumbs {
        flex-direction: row;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .cv-gallery__thumbs::-webkit-scrollbar {
        display: none;
    }

    .cv-gallery-thumb,
    .product-gallery-thumb {
        width: 56px;
        height: 56px;
        flex-shrink: 0;
    }

    .cv-card-preview img,
    .product-gallery-main img {
        max-width: min(300px, 92vw);
    }

    .cv-meta-table div,
    .product-meta-list div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .cv-offer-row,
    .product-offer-card:not(.cv-offer-item) {
        grid-template-columns: 48px minmax(0, 1fr);
        grid-template-areas:
            "thumb info"
            "commerce commerce";
        gap: 0.55rem;
        min-height: 0;
        padding: 0.65rem;
    }

    .cv-offer-price,
    .cv-offer-row__commerce,
    .product-offer-card__price-row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        gap: 0.45rem;
    }

    .cv-offer-row__price,
    .product-offer-card__price {
        font-size: 1.1rem;
    }

    .cv-offer-actions,
    .cv-offer-row__actions,
    .product-offer-card__actions {
        flex: 1 1 140px;
        max-width: 100%;
        margin-top: 0;
    }

    .cv-offers-head,
    .product-offers-head {
        flex-wrap: wrap;
    }

    .cv-offers-tools,
    .cv-offers-toolbar,
    .product-offers-toolbar {
        width: 100%;
        justify-content: flex-end;
    }

    .cv-all-offers-panel.offcanvas-bottom {
        width: 100% !important;
        max-width: 100% !important;
        height: min(90dvh, 720px);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    .cv-benefits-bar,
    .product-trust-badges {
        grid-template-columns: 1fr;
    }

    .cv-benefits-bar__item {
        border-right: none;
        border-bottom: 1px solid var(--cv-border);
    }

    .cv-benefits-bar__item:last-child {
        border-bottom: none;
    }
}

@media (max-width: 576px) {
    .cv-offers-drawer.offcanvas-bottom,
    .cv-all-offers-panel.offcanvas-bottom {
        height: min(90dvh, 720px);
        max-height: min(90dvh, 720px);
    }

    .cv-offers-list--modal .cv-offer-item {
        grid-template-columns: 64px minmax(0, 1fr);
        align-items: center;
        min-height: 132px;
        padding: 14px;
        gap: 12px;
    }

    .cv-offers-list--modal .cv-offer-thumb {
        width: 64px;
        height: 88px;
        min-height: 88px;
        align-self: center;
    }

    .cv-offers-list--modal .cv-offer-content {
        align-self: center;
    }

    .cv-offers-list--modal .cv-offer-side {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        padding-top: 10px;
        border-top: 1px solid #eef2f7;
        gap: 8px;
        width: 100%;
        align-self: stretch;
    }

    .cv-offers-list--modal .cv-offer-price {
        font-size: 20px;
    }

    .cv-offers-list--modal .cv-offer-side-actions,
    .cv-offers-list--modal .cv-offer-actions {
        flex: 0 1 auto;
        justify-content: flex-end;
        width: auto;
    }

    .cv-offers-list--modal .cv-offer-btn,
    .cv-offers-list--modal .cv-offer-side-actions .btn-market-prices,
    .cv-offers-list--modal .cv-offer-side-actions .btn-vendor-cart,
    .cv-offers-list--modal .cv-offer-actions .btn-market-prices,
    .cv-offers-list--modal .cv-offer-actions .btn-vendor-cart {
        min-height: 40px;
        font-size: 12px;
    }

    .cv-offers-tools--modal {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .cv-benefits-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cv-benefits-bar__item:nth-child(2) {
        border-right: none;
    }

    .cv-benefits-bar__item:nth-child(1),
    .cv-benefits-bar__item:nth-child(2) {
        border-bottom: 1px solid var(--cv-border);
    }
}

/* Overrides legacy store / tienda styles */
.page-producto-detalle .store-product-layout {
    display: grid;
}

.page-producto-detalle .producto-hero-img {
    max-width: none;
    margin: 0;
}

.page-producto-detalle .producto-listings-grid--few {
    max-width: none;
}

.page-producto-detalle .tienda-products,
.page-producto-detalle #listingsGrid,
.page-producto-detalle .cv-offers-list:not(.cv-offers-list--modal) {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 0.55rem !important;
    min-height: 0 !important;
}

.page-producto-detalle .cv-offers-list--modal {
    gap: 0 !important;
}

.page-producto-detalle .tienda-product.producto-listing-item,
.page-producto-detalle .cv-offer-row {
    display: grid !important;
    flex-direction: unset !important;
}

.page-producto-detalle .tienda-product-img,
.page-producto-detalle .cv-offer-row__thumb {
    min-height: 0 !important;
    padding: 0 !important;
    background: #f8fafc !important;
}

.page-producto-detalle .store-marketplace .tienda-product:hover {
    transform: none !important;
}

.page-producto-detalle .producto-listing-item {
    cursor: default;
}
