/* ==========================================================================
   Roger Editor — bloque "Ficha de producto" (PDP). Réplica 1:1 de .pdp-*
   de style.css del prototipo (tienda/producto.php). Variables ya
   compartidas del tema. */

.roger-editor-pf-breadcrumb { display: block; font-size: 13px; color: var(--fg-muted); padding: 1rem 0; }
.roger-editor-pf-breadcrumb a { color: var(--fg-muted); }
.roger-editor-pf-breadcrumb a:hover { color: var(--color-primary); }
.roger-editor-pf-breadcrumb span { margin: 0 6px; }

.pdp-layout {
    display: grid;
    grid-template-columns: 100px 1fr 420px;
    gap: 28px;
    padding: 24px 0 48px;
}
.pdp-gallery { display: contents; }
.pdp-thumbs { display: flex; flex-direction: column; gap: 12px; }
.pdp-thumb {
    width: 100px; height: 100px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    padding: 0;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s;
}
.pdp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-thumb.active,
.pdp-thumb:hover { border-color: var(--color-primary); }
.pdp-main-image {
    position: relative;
    aspect-ratio: 1/1;
    background: var(--bg-muted);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.pdp-main-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-main-image .product-badge {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    background: var(--color-sale); color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}

.pdp-info { display: flex; flex-direction: column; }
.pdp-cat { font-size: 12.5px; font-weight: 700; color: var(--color-rose); text-transform: uppercase; letter-spacing: 0.05em; }
.pdp-title { font-size: 1.30rem; margin: 8px 0 4px; line-height: 1.2; }
.pdp-sku { font-size: 12px; color: var(--fg-muted); }
.pdp-marca { font-size: 12px; color: var(--fg-muted); text-decoration: none; }
.pdp-marca strong { color: var(--color-primary); font-weight: 600; }
.pdp-marca:hover strong { color: var(--color-primary-dark); }
.pdp-price-row { display: flex; align-items: baseline; gap: 10px; margin: 18px 0; }
.pdp-price-row .price-now { font-size: 26px; font-weight: 700; color: var(--color-primary); }
.pdp-price-row .price-before { font-size: 16px; }

/* ---- Selector Por caja / Por vial ---- */
.pdp-tipo-selector { display: flex; gap: 10px; margin-top: 18px; }
.pdp-tipo-btn {
    flex: 1; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border);
    background: #fff; color: var(--fg-muted); font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.pdp-tipo-btn .pdp-tipo-detalle { display: block; font-size: 10.5px; font-weight: 500; opacity: .75; margin-top: 2px; }
.pdp-tipo-btn.activo { border-color: var(--color-primary); color: var(--color-primary); background: var(--bg-muted); }
.pdp-tipo-selector-fijo { margin-top: 18px; }
.pdp-tipo-fijo { cursor: default; flex: 0 0 auto; display: inline-block; padding: 8px 16px; font-size: 12px; }

.pdp-qty-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.qty-selector {
    display: flex; align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.qty-selector button {
    width: 36px; height: 40px;
    border: none; background: none;
    font-size: 16px; color: var(--color-plum);
    cursor: pointer;
    transition: background .2s;
}
.qty-selector button:hover { background: var(--bg-muted); }
.qty-selector input {
    width: 44px; text-align: center;
    border: none; font-family: inherit; font-size: 14px;
    -moz-appearance: textfield;
}
.qty-selector input::-webkit-outer-spin-button,
.qty-selector input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn-comprar {
    flex: 1;
    padding: 12px 20px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 14px; font-weight: 700;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .2s;
}
.btn-comprar:hover { background: var(--color-primary-dark); color: #fff; }

.pdp-trust {
    margin-top: 24px;
    display: flex; flex-direction: column; gap: 14px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.pdp-trust-item { display: flex; align-items: center; gap: 14px; color: var(--color-plum); }
.pdp-trust-icon {
    flex-shrink: 0;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--color-rose-soft);
    color: var(--color-primary);
}
.pdp-trust-item div { display: flex; flex-direction: column; gap: 2px; }
.pdp-trust-item strong { font-size: 13.5px; color: var(--color-marca); }
.pdp-trust-item span { font-size: 12.5px; color: var(--fg-muted); }

.pdp-trust-icon svg path, .pdp-trust-icon svg circle, .pdp-trust-icon svg ellipse,
.pdp-trust-icon svg rect, .pdp-trust-icon svg line, .pdp-trust-icon svg polyline, .pdp-trust-icon svg polygon {
    stroke-dasharray: var(--icon-len, 0);
    stroke-dashoffset: 0;
}
@keyframes pdp-trust-icon-draw { from { stroke-dashoffset: var(--icon-len, 0); } to { stroke-dashoffset: 0; } }
.pdp-trust-item:hover .pdp-trust-icon svg path, .pdp-trust-item:hover .pdp-trust-icon svg circle,
.pdp-trust-item:hover .pdp-trust-icon svg ellipse, .pdp-trust-item:hover .pdp-trust-icon svg rect,
.pdp-trust-item:hover .pdp-trust-icon svg line, .pdp-trust-item:hover .pdp-trust-icon svg polyline,
.pdp-trust-item:hover .pdp-trust-icon svg polygon {
    animation: pdp-trust-icon-draw 1600ms cubic-bezier(.22, .61, .36, 1);
}

/* ---- Acordeones. .filtro-grupo va acá completo (no solo el override
   .pdp-detalle) porque la ficha de producto no carga el CSS del bloque
   Catálogo — si esta página no tiene ese widget, .filtro-grupo nunca
   existiría y el <details> se vería con el marcador nativo del navegador
   en vez del layout con chevron animado. ---- */
.pdp-accordions { max-width: 900px; padding-bottom: 48px; }
.filtro-grupo {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.filtro-grupo:first-of-type { border-top: 1px solid var(--border); }
.filtro-grupo summary {
    cursor: pointer;
    font-size: 14px; font-weight: 500;
    color: var(--fg);
    list-style: none;
    display: flex; align-items: flex-start; justify-content: space-between;
    transition: color .2s;
}
.filtro-grupo summary:hover { color: var(--color-primary); }
.filtro-grupo summary::-webkit-details-marker { display: none; }
.filtro-grupo summary::after {
    content: '';
    width: 8px; height: 8px;
    border-right: 1.5px solid var(--fg-muted);
    border-bottom: 1.5px solid var(--fg-muted);
    transform: rotate(45deg);
    transition: transform .25s;
    flex-shrink: 0;
    margin-left: 8px;
}
.filtro-grupo[open] summary::after { transform: rotate(-135deg); }
.pdp-detalle summary { font-size: 15px; font-weight: 700; color: var(--color-plum); }
.pdp-detalle summary::after { border-color: var(--color-plum); }
.pdp-detalle-texto { margin-top: 14px; font-size: 14px; line-height: 1.7; color: var(--fg-muted); }

/* ---- Botón/franja "Antes/Después" siempre visible (a diferencia de la tarjeta) ---- */
.pdp-antes-despues {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px;
    background: rgba(36, 27, 33, .72);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: #fff;
    font-size: 13px; font-weight: 600; letter-spacing: .02em;
    border: none; cursor: pointer;
    transition: background .2s ease;
}
.pdp-antes-despues:hover { background: var(--color-marca); }

/* ---- Woo variation form: usamos su lógica real (variation_id/stock)
   pero visualmente ocultamos su tabla/select nativos — nuestros propios
   .pdp-tipo-btn (JS) son los que el usuario ve y toca. ---- */
.roger-editor-pf-agregar-carrito table.variations,
.roger-editor-pf-agregar-carrito .reset_variations { display: none; }
.roger-editor-pf-agregar-carrito .woocommerce-variation-price,
.roger-editor-pf-agregar-carrito .woocommerce-variation-availability { display: none; }

/* ---- Secciones "Llévalos juntos" / "También te puede interesar" ---- */
.roger-editor-pf-seccion-relacionada { padding-top: 0; }
.roger-editor-pf-seccion-relacionada .product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.roger-editor-pf-seccion-relacionada .product-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; transition: transform .25s, box-shadow .25s;
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
}
.roger-editor-pf-seccion-relacionada .product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.roger-editor-pf-seccion-relacionada .product-media { position: relative; aspect-ratio: 1/1; background: var(--bg-muted); }
.roger-editor-pf-seccion-relacionada .product-media img { width: 100%; height: 100%; object-fit: cover; }
.roger-editor-pf-seccion-relacionada .product-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.roger-editor-pf-seccion-relacionada .product-cat { font-size: 12.5px; font-weight: 700; color: var(--fg); }
.roger-editor-pf-seccion-relacionada .product-name { font-size: 13.5px; font-weight: 400; color: var(--fg-muted); line-height: 1.35; min-height: 36px; }
.roger-editor-pf-seccion-relacionada .product-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
@media (max-width: 768px) {
    .roger-editor-pf-seccion-relacionada .product-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (max-width: 1024px) {
    .pdp-layout { grid-template-columns: 80px 1fr; }
    .pdp-info { grid-column: 1 / -1; margin-top: 20px; }
}
@media (max-width: 768px) {
    .pdp-layout { grid-template-columns: 1fr; padding-top: 8px; }
    .pdp-thumb { width: 64px; height: 64px; flex-shrink: 0; }
    .pdp-info { display: contents; }
    .pdp-info > * { order: 6; }
    .roger-editor-pf-breadcrumb { font-size: 11px; margin-bottom: 4px; }
    .pdp-marca-sku-row { order: 1; gap: 6px; }
    .pdp-marca, .pdp-sku { font-size: 11px; }
    .pdp-title { order: 2; font-size: 1rem; margin: -20px 0 2px; }
    .pdp-main-image { order: 3; }
    .pdp-thumbs { order: 4; flex-direction: row; overflow-x: auto; }
    .pdp-cat { order: 5; }

    .pdp-tipo-selector { margin-top: -20px; }
    .pdp-price-row { margin: -20px 0 0; }
    .roger-editor-pf-agregar-carrito .btn-add { margin-top: -20px; }
    .pdp-trust { margin-top: -20px; padding-top: 8px; }

    .pdp-qty-row {
        position: fixed;
        left: 0; right: 0;
        bottom: 60px;
        z-index: 910;
        margin: 0;
        background: #fff;
        padding: 10px 16px;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, .06);
    }
    body.roger-editor-pdp-body { padding-bottom: 130px; }
}
