/* =========================================================
   FICHA DE PRODUCTO — dirección "Kiosco"
   Objetivo: que la ficha entre completa en una pantalla.
   ========================================================= */

.pd-crumb { padding: 26px 0 0; }

/* ---------------------------------------------------------
   ESTRUCTURA: miniaturas | foto | info
   --------------------------------------------------------- */
.product-detail {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 40px;
    align-items: start;
    padding: 24px 0 var(--space-2xl);
    max-width: none;
    margin: 0;
}

/* Cuando hay una sola foto no hace falta la columna de miniaturas */
.product-detail--sinthumbs {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 48px;
}

/* ---------------------------------------------------------
   GALERÍA
   --------------------------------------------------------- */
.pd-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gallery-thumb {
    width: 82px;
    height: 82px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    padding: 8px;
    transition: border-color 0.18s ease;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gallery-thumb:hover { border-color: var(--text-gray); }

.gallery-thumb.active {
    border-color: var(--black);
    border-width: 2px;
    padding: 7px;
}

/* La foto sola, con la forma que tenga. Antes había un recuadro gris de
   alto fijo: las fotos verticales quedaban chiquitas en el medio con dos
   franjas a los costados. */
.main-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.main-image-container img {
    /* Sin recuadro: la foto entera, con su forma. El tope de alto es para
       que una foto muy vertical no ocupe toda la pantalla; al achicarse
       mantiene la proporción, así que no aparece ninguna franja. */
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 74vh;
    margin: 0 auto;
}

@media (max-width: 860px) {
    .main-image-container img { max-height: 62vh; }
}

.discount-badge {
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--black);
    color: var(--white);
    padding: 7px 12px;
    font-weight: 700;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-radius: 0;
    box-shadow: none;
    z-index: 2;
}

/* ---------------------------------------------------------
   COLUMNA DE INFORMACIÓN
   --------------------------------------------------------- */
.detail-info {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-top: 2px;
    min-width: 0;
}

/* El formulario es UN solo hijo del flex de arriba: necesita su propio
   ritmo interno, si no las variantes y el botón quedan amontonados. */
#add-to-cart-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.pd-kicker {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 9px;
}

.pd-title {
    margin: 0;
    font-size: clamp(23px, 2.6vw, 31px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.05;
    text-transform: uppercase;
}

.price-container {
    margin: 0;
    font-size: clamp(24px, 2.6vw, 31px);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--black);
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.old-price {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0;
}

.pd-rule {
    height: 1px;
    background: var(--border);
    margin: 2px 0;
}

.detail-desc {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text-gray);
    max-width: 48ch;
}

/* ---------------------------------------------------------
   VARIANTES — etiqueta y opciones en el mismo renglón
   --------------------------------------------------------- */
.options-group {
    display: grid;
    grid-template-columns: 66px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
}

.options-group > label {
    margin: 0;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-light);
    line-height: 1.3;
}

.size-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
}

.size-opt {
    position: relative;
    cursor: pointer;
    border: none !important;
    background: none !important;
    padding: 0 !important;
    margin: 0;
}

/* El radio cubre el chip entero en vez de medir 0×0. Así el navegador
   puede enfocarlo con el teclado y no cancela el envío en silencio. */
.size-opt input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.size-box {
    display: grid;
    place-items: center;
    min-width: 58px;
    height: 40px;
    padding: 0 15px;
    border: 1px solid #d4d4d4;
    border-radius: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--white);
    color: var(--black);
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.size-opt:hover .size-box { border-color: var(--black); }

.size-opt input:checked + .size-box {
    border-color: var(--black);
    background-color: var(--black);
    color: var(--white);
}

.size-opt input:focus-visible + .size-box {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

/* Aviso cuando falta elegir una variante */
.options-error {
    display: none;
    grid-column: 2;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--error);
    margin-top: -4px;
}

.options-group.is-error .options-error { display: block; }

.options-group.is-error .size-box { border-color: var(--black); }

.options-group.is-error > label { color: var(--black); }

/* ---------------------------------------------------------
   CANTIDAD + BOTÓN, EN UNA SOLA FILA
   --------------------------------------------------------- */
.qty-selector-detail {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin: 6px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.qty-input-wrapper {
    display: flex;
    border: 1px solid var(--black);
    border-radius: 0;
    overflow: hidden;
    height: 50px;
    flex-shrink: 0;
}

.qty-input-wrapper button {
    background: var(--white);
    border: none;
    width: 40px;
    height: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    transition: background 0.16s ease, color 0.16s ease;
}

.qty-input-wrapper button:hover { background: var(--black); color: var(--white); }

.qty-input-wrapper input {
    width: 46px;
    height: 100%;
    padding: 0;
    border: none;
    border-left: 1px solid var(--black);
    border-right: 1px solid var(--black);
    border-radius: 0;
    text-align: center;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    -moz-appearance: textfield;
}

.qty-input-wrapper input:focus { border-color: var(--black); }

.qty-input-wrapper input::-webkit-outer-spin-button,
.qty-input-wrapper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pd-buy {
    flex: 1;
    min-width: 0;
    height: 50px;
    display: grid;
    place-items: center;
    background: var(--black);
    color: var(--white);
    border: 1px solid var(--black);
    border-radius: 0;
    margin: 0;
    padding: 0 20px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.pd-buy:hover:not(:disabled) { background: var(--white); color: var(--black); }

.pd-buy:disabled { opacity: 0.45; cursor: not-allowed; }

.stock-warning {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--black);
    border-left: 2px solid var(--black);
    padding-left: 12px;
}

.pd-feedback {
    display: none;
    margin: 0;
    background: var(--black);
    color: var(--white);
    padding: 12px 16px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    text-align: center;
}

.pd-notfound {
    padding: var(--space-2xl) 0;
    text-align: center;
    color: var(--text-gray);
    font-size: 0.95rem;
}

.pd-notfound a {
    border-bottom: 1px solid var(--black);
    color: var(--black);
    font-weight: 600;
}

/* ---------------------------------------------------------
   RESPONSIVO
   --------------------------------------------------------- */
@media (max-width: 1024px) {
    .product-detail { gap: 0 28px; grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr); }
    .gallery-thumb { width: 70px; height: 70px; }
}

@media (max-width: 860px) {
    /* Una columna: foto arriba, miniaturas en fila, info abajo */
    .product-detail,
    .product-detail--sinthumbs {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-top: 18px;
    }

    .pd-thumbs {
        order: 2;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .pd-thumbs::-webkit-scrollbar { display: none; }

    .gallery-thumb { flex: 0 0 auto; width: 64px; height: 64px; }

    .pd-gallery { order: 1; }
    .detail-info { order: 3; gap: 16px; }



    .options-group { grid-template-columns: 60px minmax(0, 1fr); gap: 14px; }
    #add-to-cart-form { gap: 18px; }
    .qty-selector-detail { padding-top: 18px; }
}

@media (max-width: 480px) {
    .options-group { grid-template-columns: 1fr; gap: 8px; }
    .options-error { grid-column: 1; }
    .qty-selector-detail { gap: 10px; }
    .qty-input-wrapper { height: 48px; }
    .pd-buy { height: 48px; font-size: 0.66rem; letter-spacing: 0.12em; padding: 0 10px; }
}

/* ── Variantes con precio propio ─────────────────────────────────────────
   "1 kg · $8.400" en vez de una lista de opciones que valen todas igual. */
.pd-variantes { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-variantes .size-opt { flex: 1 1 130px; }
.pd-variantes .size-box {
    display: flex; flex-direction: column; gap: 3px;
    min-height: 58px; padding: 10px 14px;
    align-items: flex-start; justify-content: center;
    text-align: left; width: 100%;
}
.pd-variantes .size-box b { font-size: 0.92rem; font-weight: 700; }
.pd-variantes .size-box em {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 0.82rem; font-style: normal; font-variant-numeric: tabular-nums;
    opacity: 0.72;
}
.size-opt--agotada { opacity: 0.42; }
.size-opt--agotada .size-box { cursor: not-allowed; text-decoration: line-through; }

/* Aviso de que queda poco: urgencia honesta, sólo cuando es verdad. */
.pd-quedan {
    display: inline-block; margin-left: 12px; padding: 3px 9px;
    border: 1px solid #a8620b; color: #a8620b;
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
    vertical-align: middle;
}

/* ── Datos de entrega en la ficha ───────────────────────────────────── */
.pd-datos { list-style: none; margin: 26px 0 0; padding: 18px 0 0; border-top: 1px solid #ededed; }
.pd-datos li { display: flex; gap: 10px; flex-wrap: wrap; padding: 7px 0; font-size: 0.86rem; }
.pd-datos b { flex: 0 0 150px; font-weight: 700; }
.pd-datos span { color: #5a5a5a; }
.pd-datos a { color: #000; text-decoration: underline; }

/* ── Relacionados ───────────────────────────────────────────────────── */
.pd-rel { max-width: 1280px; margin: 0 auto; padding: 56px 20px 10px; }
.pd-rel h2 {
    margin: 0 0 20px; font-size: 0.66rem; font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase; color: #8a8a8a;
}
.pd-rel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.pd-rel-item { display: block; text-decoration: none; color: inherit; }
.pd-rel-foto { position: relative; display: block; overflow: hidden; background: #fafafa; }
.pd-rel-foto img { width: 100%; height: auto; display: block; transition: transform 0.35s ease; }
.pd-rel-item:hover img { transform: scale(1.035); }
.pd-rel-agotado {
    position: absolute; left: 0; bottom: 0;
    padding: 5px 10px; background: #000; color: #fff;
    font-size: 0.56rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase;
}
.pd-rel-nombre { display: block; margin-top: 10px; font-size: 0.88rem; font-weight: 600; line-height: 1.35; }
.pd-rel-precio {
    display: block; margin-top: 3px;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 0.88rem; font-variant-numeric: tabular-nums; color: #5a5a5a;
}

/* ── Producto que ya no está: salida, no callejón ───────────────────── */
.pd-nohay { max-width: 720px; margin: 0 auto; padding: 70px 20px 110px; text-align: center; }
.pd-nohay-rot {
    display: block; margin-bottom: 10px;
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.18em;
    text-transform: uppercase; color: #8a8a8a;
}
.pd-nohay h1 {
    margin: 0 0 12px; font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 900;
    letter-spacing: -0.04em; text-transform: uppercase;
}
.pd-nohay p { margin: 0 auto 26px; max-width: 42ch; color: #5a5a5a; line-height: 1.65; }
.pd-nohay-buscar { display: flex; gap: 8px; max-width: 440px; margin: 0 auto 40px; }
.pd-nohay-buscar input {
    flex: 1; min-height: 52px; padding: 0 14px;
    border: 1px solid #000; border-radius: 0; font-family: inherit; font-size: 1rem;
}
.pd-nohay-buscar button {
    min-height: 52px; padding: 0 22px; border: 1px solid #000;
    background: #000; color: #fff; font-family: inherit;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.13em;
    text-transform: uppercase; cursor: pointer;
}
.pd-nohay-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 34px; }
.pd-nohay-grid a { display: block; text-decoration: none; color: inherit; }
.pd-nohay-grid img { width: 100%; height: auto; display: block; }
.pd-nohay-grid .n { display: block; margin-top: 8px; font-size: 0.82rem; font-weight: 600; line-height: 1.3; }
.pd-nohay-grid .p {
    display: block; font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 0.82rem; color: #5a5a5a;
}
.pd-nohay-volver {
    display: inline-block; font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.13em; text-transform: uppercase; color: #000;
}

@media (max-width: 760px) {
    .pd-rel-grid, .pd-nohay-grid { grid-template-columns: repeat(2, 1fr); }
    .pd-datos b { flex: 0 0 100%; }
}
