/* =============================================================================
   productos-ficha.css  ·  diseño de div.cell en productos-detalles.php
   Se carga DESPUÉS de productos.css. Solo CSS: no cambia contenido ni encabezados.
   Para volver atrás: quitar el <link> de este archivo en productos-detalles.php.
   Paleta y radios = los del panel de accesorios (azul #1561c9, texto #12304f, bordes #cdd8e6).
   ========================================================================== */

/* ------------------------------------------------------------------ rejilla de la ficha
   Tres tarjetas: imagen · información · compra (opciones + total + botones). Como máximo 2 columnas:
     izquierda: imagen (siempre arriba) y debajo la información
     derecha:   compra, con TODAS las opciones a la vista (sin scroll interno)
   La rejilla se adapta al ANCHO DEL CONTENIDO (container query sobre .cell-wrap), no al de la pantalla:
   con el menú de categorías lateral visible, el contenido es mucho más estrecho que la ventana.
     contenido <820px     1 columna: imagen, información, compra
     contenido >=820px    2 columnas: [imagen / información] | [compra]
     SIN opciones y contenido >=1200px: las 3 tarjetas en una fila (imagen | información | compra)
   Dentro de la compra, en 1 columna ancha (>=620px) las opciones van a la izquierda y total + botones a la
   derecha; en la columna estrecha de 2 columnas y en móvil, apiladas.
   Sin container queries (navegadores muy antiguos) se queda una columna: nada se rompe.            */
.cell-wrap {
    container-type: inline-size;
    container-name: ficha;
    max-width: 98%;
    margin: 0 auto 18px;
}
.cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    max-width: none;
    margin: 0;
}
.cell > .cell-rows {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    padding: 16px;
    border: 1px solid #dbe4ef;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 40, 80, .05);
    justify-content: flex-start;
}
/* productos.css da a cada tarjeta un ancho mínimo y una base flex: aquí manda la rejilla */
.cell > .cell-rows.rows-image,
.cell > .cell-rows.rows-info,
.cell > .cell-rows.rows-payment { flex-basis: auto; min-width: 0; }
/* cualquier otro bloque directo (p. ej. el recomendado) ocupa toda la fila */
.cell > :not(.cell-rows) { grid-column: 1 / -1; }

/* dentro de la compra: opciones y (total + botones) apilados */
.cell .rows-payment .flex2 {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    width: 100%;
}
.cell .rows-payment .rows-compra { width: 100%; max-width: 460px; margin-left: auto; margin-right: auto; min-width: 0; }

/* 1 columna ancha (tablet vertical): opciones | total + botones dentro de la tarjeta de compra */
@container ficha (min-width: 620px) and (max-width: 819.98px) {
    .cell .rows-payment .flex2 {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
        align-items: start;
        gap: 24px;
    }
    .cell .rows-payment .rows-compra { max-width: none; margin: 0; }
    .cell.cell-sin-opciones .rows-payment .flex2 { grid-template-columns: minmax(0, 460px); justify-content: center; }
    .cell.cell-sin-opciones .rows-payment .rows-compra { max-width: 460px; }
}
@container ficha (min-width: 620px) {
    .cell > .cell-rows { padding: 20px; }
}
/* 2 columnas: [imagen / información] | [compra] */
@container ficha (min-width: 820px) {
    .cell {
        grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
        grid-template-rows: auto 1fr;
        gap: 16px;
        align-items: start;
    }
    .cell > .rows-image   { grid-column: 1; grid-row: 1; }
    .cell > .rows-info    { grid-column: 1; grid-row: 2; }
    .cell > .rows-payment { grid-column: 2; grid-row: 1 / span 2; }
    .cell > :not(.cell-rows) { grid-row: auto; }
    .cell .rows-payment .rows-compra { max-width: none; margin: 0; }
    .cell.cell-sin-opciones .rows-payment .rows-compra { max-width: none; }
}
/* sin opciones ni accesorios que elegir: las 3 tarjetas en una fila si el contenido lo permite */
@container ficha (min-width: 1200px) {
    .cell.cell-sin-opciones {
        grid-template-columns: minmax(420px, .9fr) minmax(0, 1.2fr) minmax(340px, .85fr);
        grid-template-rows: auto;
        gap: 18px;
    }
    .cell.cell-sin-opciones > .rows-image   { grid-column: 1; grid-row: 1; }
    .cell.cell-sin-opciones > .rows-info    { grid-column: 2; grid-row: 1; }
    .cell.cell-sin-opciones > .rows-payment { grid-column: 3; grid-row: 1; }
}

/* producto agotado o descatalogado: no hay tarjeta de compra, imagen e información comparten la fila */
@container ficha (min-width: 820px) {
    .cell.cell-sin-opciones:not(:has(> .rows-payment)) {
        grid-template-columns: minmax(420px, 1fr) minmax(0, 1.1fr);
        grid-template-rows: auto;
    }
    .cell.cell-sin-opciones:not(:has(> .rows-payment)) > .rows-image { grid-column: 1; grid-row: 1; }
    .cell.cell-sin-opciones:not(:has(> .rows-payment)) > .rows-info  { grid-column: 2; grid-row: 1; }
}

/* ------------------------------------------------------------------ imagen
   Imagen principal con las adicionales en vertical a su lado (a la izquierda), para ganar altura. */
.cell .rows-image {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
}
.cell .image_one { margin: 0; flex: 0 1 284px; min-width: 0; }
.cell .image_one img {
    display: block;
    width: 100%;
    max-width: 284px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 auto;
}
.cell .conten_image {
    order: -1;
    flex: 0 0 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.cell .conten_image:not(:has(img)) { display: none; }
.cell .conten_image img {
    width: 64px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0;
    background: #fff;
}
@container ficha (min-width: 420px) { .cell .conten_image img { width: 76px; } }

/* ------------------------------------------------------------------ información */
.cell .rows-info { align-items: stretch; color: #1e293b; }
.cell .rows-info > h2 { margin: 0 0 8px; font-size: 17px; line-height: 1.3; color: #12304f; }
.cell .rows-info > p { line-height: 1.5; }
.cell .rows-info ul { margin: 8px 0; padding: 0 0 0 20px; }
.cell .rows-info li { margin-bottom: 4px; line-height: 1.4; }
.cell .rows-info .precio {
    width: 100%;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e6ecf3;
    column-gap: 10px;
}
.cell .rows-info #RealPrice { font-size: 30px !important; line-height: 1.05; letter-spacing: -.4px; }
.cell .rows-info .antes { font-size: 16px; color: #64748b; }
.cell .rows-info .impuestos_incluidos { font-size: 13px; font-weight: 600; color: #475569; }
.cell .rows-info .opiniones { margin-top: 10px; }
.cell .rows-info .flex_shipping { margin-top: 10px; font-size: 14.5px; color: #1e293b; }
/* Estado de stock: misma píldora con punto de color que las tarjetas de categorias-ver.php */
.cell .rows-info .stock { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.cell .rows-info .stock > .estado {
    --est-bg: #eceff3; --est-fg: #4b5767; --est-dot: #8a97a8;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    width: auto;
    margin: 0;
    padding: 3px 10px 3px 8px;
    background: var(--est-bg);
    color: var(--est-fg);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}
.cell .rows-info .stock > .estado::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--est-dot);
}
.cell .rows-info .stock > .estado-stock         { --est-bg: #e4f5ea; --est-fg: #0a6232; --est-dot: #16a34a; }
.cell .rows-info .stock > .estado-agotado       { --est-bg: #fdeaea; --est-fg: #a11d1d; --est-dot: #dc2626; }
.cell .rows-info .stock > .estado-descatalogado { --est-bg: #eceff3; --est-fg: #4b5767; --est-dot: #8a97a8; }
/* Referencia: texto discreto con icono de etiqueta, como en las tarjetas de categorías (a la izquierda; estado y envío a la derecha) */
.cell .rows-info .stock > .referencia {
    --ico-tag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1' fill='%23000'/%3E%3C/svg%3E");
    order: 1;
    flex: 0 1 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 auto 0 0;
    padding: 0;
    background: none;
    border: 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: .01em;
    font-variant-numeric: tabular-nums;
    color: #536277;
}
.cell .rows-info .stock > .referencia::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    background: currentColor;
    -webkit-mask: var(--ico-tag) center / contain no-repeat;
    mask: var(--ico-tag) center / contain no-repeat;
}
.cell .rows-info .stock > .estado { order: 2; }
.cell .rows-info .stock > .envio_gratis { order: 3; }
.cell .rows-info .stock > .numero-articulo { order: 4; flex: 0 0 100%; margin: 0; padding: 0; border: 0; background: none; font-size: 12px; line-height: 1.3; color: #536277; }
/* Envío gratis: misma altura y tipografía que la píldora de estado, conserva su verde */
.cell .rows-info .stock > .envio_gratis {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;            /* + borde = misma altura que la píldora de estado */
    border-width: 1.5px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.3;
}

/* ------------------------------------------------------------------ tarjeta de compra (destacada) */
.cell .rows-payment {
    align-items: stretch;
    border-color: #c6d9f1;
    box-shadow: 0 6px 22px rgba(21, 97, 201, .10);
}
.cell .rows-payment .rows-accesorios { min-width: 0; width: 100%; }
/* el panel de accesorios ya no lleva su propia caja: la tarjeta es la caja */
.cell .rows-payment .accf { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
/* total con opciones, justo encima de «Añadir al carrito» */
.cell .accf-resumen-zona { margin-bottom: 12px; }
.cell .accf-resumen-zona .accf-resumen {
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #d9e2ee;
    border-radius: 12px;
    background: #f4f8fe;
    justify-content: space-between;
    align-items: baseline;
}
.cell .accf-resumen-zona .accf-total-et { font-weight: 700; color: #12304f; font-size: 14px; }
.cell .accf-resumen-zona .accf-total { font-size: 24px; line-height: 1.1; }
.cell .accf-resumen-zona .accf-nota { margin: 8px 2px 0; text-align: left; }

/* ------------------------------------------------------------------ botones */
.cell .botones {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: none;
    text-align: center;
}
.cell .botones .myButton {
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    max-width: none;
    min-height: 52px;
    margin: 0;
    padding: 0 18px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.cell .botones .myButton:active { top: 0; transform: translateY(1px); }
.cell .botones .myButton:focus-visible { outline: 3px solid #8cb6ee; outline-offset: 2px; }

/* principal: añadir al carrito */
.cell .botones #Finalizar {
    background: #1561c9;
    border: 1px solid #1561c9;
    color: #fff;
    font-size: 17px;
    box-shadow: 0 2px 6px rgba(12, 50, 110, .28);
}
.cell .botones #Finalizar:hover { background: #0f4ea6; border-color: #0f4ea6; color: #fff; }
.cell .botones #Finalizar[aria-disabled="true"],
.cell .botones #Finalizar[aria-disabled="true"]:hover {
    background: #9db3cf;
    border-color: #9db3cf;
    color: #fff;
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
    transform: none;
}
.cell .botones #Finalizar[aria-busy="true"] { cursor: wait; }

/* secundario: pago rápido PayPal */
.cell .botones #fast-paypal {
    background: #ffc439;
    border: 1px solid #e6aa12;
    color: #111827;
}
.cell .botones #fast-paypal:hover { background: #f5b82a; border-color: #d99b00; color: #111827; }

/* formulario que se despliega con "Pago rápido PayPal" (jQuery le pone display:block) */
.cell #div-paypal {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px;
    border: 1px solid #d9e2ee;
    border-radius: 12px;
    background: #f9fbfe;
    text-align: left;
}
.cell #div-paypal label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: #12304f; }
.cell #div-paypal select {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 46px;
    margin: 0 0 12px;
    padding: 0 12px;
    border: 1.5px solid #cdd8e6;
    border-radius: 10px;
    background: #fff;
    color: #12304f;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
}
.cell #div-paypal select:focus-visible { outline: 3px solid #8cb6ee; outline-offset: 1px; }
.cell #div-paypal .paypal-recargo {
    display: inline-block;
    margin: 0 0 12px;
    padding: 4px 10px;
    border: 1px solid #f0c987;
    border-radius: 999px;
    background: #fff6e6;
    color: #7a4a00;
    font-size: 13px;
    font-weight: 700;
}
.cell #div-paypal input[type="submit"] {
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: #003087;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.cell #div-paypal input[type="submit"]:hover { background: #00266b; }
.cell #div-paypal input[type="submit"]:focus-visible { outline: 3px solid #8cb6ee; outline-offset: 2px; }

/* formas de pago, descuentos y asesor */
.cell .botones .img-pagos {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 64px;
    margin: 4px auto 0;
    border: 0;
    border-radius: 0;
}
.cell .botones .qdis-trigger {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-height: 46px;
    margin: 0;
    border: 1.5px solid #cdd8e6;
    border-radius: 12px;
    box-shadow: none;
}
.cell .botones .qdis-trigger:hover { border-color: #1561c9; }
.cell .botones .qdis-trigger:focus-visible { outline: 3px solid #8cb6ee; outline-offset: 2px; }
.cell .botones .asesor { margin: 4px 0 0; }
.cell .botones .asesor img { max-width: 100% !important; height: auto !important; }

@media (prefers-reduced-motion: reduce) {
    .cell .botones .myButton { transition: none; }
}
@media (forced-colors: active) {
    .cell .rows-info .stock > .estado { border: 1px solid CanvasText; }
    .cell .rows-info .stock > .estado::before { background: CanvasText; }
    .cell .rows-info .stock > .referencia::before { background: currentColor; }
    .cell .botones .myButton, .cell #div-paypal input[type="submit"] { border: 2px solid ButtonText; }
}
