/* ============================================================
   PRODUCTOS — MJ Nutrición
   ============================================================ */

/* ── Layout principal ── */
.prod-layout {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* ── Sidebar filtros ── */
.prod-sidebar {
    position: sticky;
    top: 5rem;
}
.prod-sidebar-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--gris);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #e8eef3;
}
.prod-cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.prod-cat-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .6rem;
    border-radius: 8px;
    font-size: .88rem;
    color: var(--negro);
    text-decoration: none;
    transition: background .15s, color .15s;
    gap: .4rem;
}
.prod-cat-list li a:hover { background: #f0fdf4; color: var(--verde); }
.prod-cat-list li a.activa { background: var(--verde); color: #fff; font-weight: 600; }
.prod-cat-list li a .cat-count {
    font-size: .72rem;
    font-weight: 600;
    background: rgba(0,0,0,.08);
    border-radius: 50px;
    padding: .1rem .45rem;
    flex-shrink: 0;
}
.prod-cat-list li a.activa .cat-count { background: rgba(255,255,255,.25); }

/* ── Área de productos ── */
.prod-main {}
.prod-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.prod-toolbar-total {
    font-size: .85rem;
    color: var(--gris);
}
.prod-toolbar-total strong { color: var(--negro); }

/* ── Grilla de productos ── */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

/* ── Card de producto ── */
.prod-card {
    background: #fff;
    border: 1.5px solid #e8eef3;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s, border-color .2s;
    text-decoration: none;
    color: inherit;
}
.prod-card:hover {
    box-shadow: 0 8px 32px rgba(60,176,67,.13);
    transform: translateY(-3px);
    border-color: #c5d8c6;
}
.prod-card-img {
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    overflow: hidden;
    position: relative;
}
.prod-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.prod-card:hover .prod-card-img img { transform: scale(1.05); }
.prod-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.prod-card-img-placeholder svg { width: 52px; height: 52px; fill: #a7d3ab; }
.prod-card-badge {
    position: absolute;
    top: .65rem;
    left: .65rem;
    background: #ef4444;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 50px;
}
.prod-card-body {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}
.prod-card-cat {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--verde);
}
.prod-card-nombre {
    font-size: .92rem;
    font-weight: 700;
    color: var(--negro);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.prod-card-precios {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin-top: auto;
    padding-top: .4rem;
}
.prod-card-precio-actual {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--negro);
}
.prod-card-precio-tachado {
    font-size: .82rem;
    color: var(--gris);
    text-decoration: line-through;
}
.prod-card-sin-stock {
    font-size: .72rem;
    color: #ef4444;
    font-weight: 600;
    margin-top: .2rem;
}

/* ── Estado vacío ── */
.prod-vacio {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gris);
    grid-column: 1/-1;
}
.prod-vacio svg { width: 56px; height: 56px; fill: #c5d8c6; margin: 0 auto 1rem; display: block; }
.prod-vacio h3 { font-size: 1rem; font-weight: 700; color: var(--negro); margin-bottom: .4rem; }

/* ── Paginación ── */
.prod-paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.prod-pag-num, .prod-pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    border-radius: 9px;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--negro);
    border: 1.5px solid #e8eef3;
    background: #fff;
    transition: background .15s, border-color .15s, color .15s;
    padding: 0 .5rem;
}
.prod-pag-num:hover, .prod-pag-btn:hover {
    background: #f0fdf4;
    border-color: var(--verde);
    color: var(--verde);
}
.prod-pag-num.activa {
    background: var(--verde);
    border-color: var(--verde);
    color: #fff;
    pointer-events: none;
}
.prod-pag-btn.disabled {
    opacity: .35;
    pointer-events: none;
    cursor: default;
}
.prod-pag-elipsis {
    font-size: .9rem;
    color: var(--gris);
    padding: 0 .2rem;
    line-height: 38px;
}

/* ══════════════════════════════════════════════
   DETALLE DE PRODUCTO
══════════════════════════════════════════════ */
.det-wrap {
    max-width: 1100px;
    margin: 3rem auto;
    padding: 0 1.5rem 4rem;
}
.det-breadcrumb {
    font-size: .8rem;
    color: var(--gris);
    margin-bottom: 2rem;
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
}
.det-breadcrumb a { color: var(--verde); text-decoration: none; }
.det-breadcrumb a:hover { text-decoration: underline; }
.det-breadcrumb span { color: var(--gris); }

.det-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    align-items: start;
}

/* Galería */
/* ── Galería Swiper ── */
.det-galeria { display: flex; flex-direction: column; gap: .75rem; min-width: 0; overflow: hidden; }

.det-swiper-main {
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1.5px solid #e8eef3;
    width: 100%;
    height: 420px;
}
@media (max-width: 600px) {
    .det-swiper-main { height: 300px; }
}
.det-slide {
    cursor: zoom-in;
    position: relative;
}
.det-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.det-zoom-icon {
    position: absolute;
    bottom: .6rem;
    right: .75rem;
    font-size: .85rem;
    background: rgba(0,0,0,.35);
    color: #fff;
    border-radius: 50px;
    padding: .2rem .5rem;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}
.det-slide:hover .det-zoom-icon { opacity: 1; }

/* Flechas del swiper principal */
.det-sw-prev, .det-sw-next {
    width: 34px !important;
    height: 34px !important;
    background: rgba(255,255,255,.85);
    border-radius: 50%;
    color: #333 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    margin-top: -17px !important;
}
.det-sw-prev, .det-sw-next {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    border: none;
    cursor: pointer;
    padding: 0;
}
.det-sw-prev::after, .det-sw-next::after { content: '' !important; display: none !important; }

/* Swiper thumbs */
.det-swiper-thumbs { padding: .25rem 0; }
.det-swiper-thumbs .swiper-wrapper { display: flex !important; align-items: center; }
.det-thumb-slide {
    width: 72px !important;
    height: 72px !important;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e8eef3;
    cursor: pointer;
    transition: border-color .15s;
    background: #f0fdf4;
}
.det-thumb-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.det-thumb-slide.swiper-slide-thumb-active { border-color: var(--verde); }

/* Placeholder sin foto */
.det-foto-main-placeholder {
    aspect-ratio: 1/1;
    border-radius: 20px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1.5px solid #e8eef3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.det-foto-main-placeholder svg { width: 80px; height: 80px; fill: #a7d3ab; }

/* ── Lightbox ── */
.det-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}
.det-lightbox.abierto { display: flex; }
.det-lb-img-wrap {
    max-width: min(90vw, 800px);
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.det-lb-img-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.det-lb-cerrar {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.det-lb-cerrar:hover { background: rgba(255,255,255,.3); }
.det-lb-prev, .det-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 1.6rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 1;
}
.det-lb-prev { left: 1rem; }
.det-lb-next { right: 1rem; }
.det-lb-prev:hover, .det-lb-next:hover { background: rgba(255,255,255,.3); }
.det-lb-counter {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.7);
    font-size: .85rem;
}

/* Info */
.det-info {}
.det-categoria {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--verde);
    margin-bottom: .5rem;
}
.det-nombre {
    font-family: var(--fuente-titulo);
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    color: var(--negro);
    line-height: 1.2;
    margin-bottom: 1.1rem;
}
.det-precios {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.det-precio-actual {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--negro);
}
.det-precio-tachado {
    font-size: 1.1rem;
    color: var(--gris);
    text-decoration: line-through;
}
.det-badge-oferta {
    background: #fef2f2;
    color: #dc2626;
    font-size: .75rem;
    font-weight: 700;
    padding: .25rem .65rem;
    border-radius: 50px;
    border: 1px solid #fecaca;
}
.det-stock {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    font-weight: 600;
    padding: .3rem .8rem;
    border-radius: 50px;
    margin-bottom: 1.5rem;
}
.det-stock-ok  { background: #dcfce7; color: #15803d; }
.det-stock-no  { background: #fef2f2; color: #dc2626; }

.det-cta {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.det-btn-wa {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: #25D366;
    color: #fff;
    border-radius: 12px;
    padding: .85rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .18s, transform .15s;
}
.det-btn-wa:hover { background: #128C7E; transform: translateY(-2px); }
.det-btn-wa svg { width: 22px; height: 22px; fill: #fff; flex-shrink: 0; }
.det-btn-volver {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #f3f4f6;
    color: var(--negro);
    border-radius: 12px;
    padding: .85rem 1.5rem;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.det-btn-volver:hover { background: #e5e7eb; }

.det-separador { border: none; border-top: 1px solid #e8eef3; margin: 1.75rem 0; }

.det-descripcion {
    font-size: .95rem;
    color: #374151;
    line-height: 1.75;
    transition: max-height .4s ease;
    position: relative;
}
.det-desc-fade {
    position: relative;
    height: 80px;
    margin-top: -80px;
    background: linear-gradient(to bottom, transparent, #fff);
    pointer-events: none;
}
.det-desc-toggle {
    display: block;
    margin: .75rem auto 0;
    background: none;
    border: 1.5px solid var(--verde);
    color: var(--verde);
    font-size: .9rem;
    font-weight: 600;
    padding: .5rem 1.75rem;
    border-radius: 50px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.det-desc-toggle:hover {
    background: var(--verde);
    color: #fff;
}
.det-descripcion p  { margin-bottom: .9rem; }
.det-descripcion ul { padding-left: 1.4rem; margin-bottom: .9rem; }
.det-descripcion li { margin-bottom: .35rem; }
.det-descripcion strong { color: var(--negro); }
.det-descripcion h2, .det-descripcion h3 { color: var(--negro); margin: 1.2rem 0 .5rem; }

/* Productos relacionados */
.det-relacionados {
    margin-top: 3.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid #e8eef3;
}
.det-relacionados h2 {
    font-family: var(--fuente-titulo);
    font-size: 1.4rem;
    color: var(--negro);
    margin-bottom: 1.5rem;
}

/* ── Buscador ── */
.prod-buscador {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    border: 1.5px solid #e8eef3;
    border-radius: 10px;
    padding: .45rem .9rem;
    transition: border-color .2s, box-shadow .2s;
    flex: 1;
    max-width: 340px;
}
.prod-buscador:focus-within {
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(60,176,67,.1);
}
.prod-buscador svg { width: 17px; height: 17px; fill: var(--gris); flex-shrink: 0; }
.prod-buscador input {
    border: none;
    outline: none;
    font-size: .9rem;
    color: var(--negro);
    background: transparent;
    width: 100%;
}
.prod-buscador input::placeholder { color: #b0bec5; }
.prod-buscador-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gris);
    padding: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.prod-buscador-clear.visible { opacity: 1; pointer-events: auto; }
.prod-buscador-clear:hover { color: #ef4444; }

/* ── Carrito flotante (FAB) — estilos en global.css ── */

/* ── Overlay ── */
.cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 10060;
}
.cart-overlay.abierto { display: block; }

/* ── Panel slide-in ── */
.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    background: #fff;
    z-index: 10061;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -8px 0 40px rgba(0,0,0,.14);
}
.cart-panel.abierto { transform: translateX(0); }

.cart-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.cart-panel-head h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--negro);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.cart-panel-head h2 svg { width: 20px; height: 20px; fill: var(--negro); }
.cart-cerrar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    color: var(--gris);
    transition: background .15s;
}
.cart-cerrar:hover { background: #e5e7eb; color: var(--negro); }

.cart-lista {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.cart-vacio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 3rem 0;
    color: var(--gris);
    text-align: center;
}
.cart-vacio svg { width: 56px; height: 56px; fill: #dde5ea; margin-bottom: 1rem; }
.cart-vacio p { font-size: .9rem; }

.cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: .75rem;
    align-items: center;
    padding: .85rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
    width: 64px; height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0fdf4;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-img svg { width: 28px; height: 28px; fill: #a7d3ab; }
.cart-item-nombre {
    font-size: .83rem;
    font-weight: 600;
    color: var(--negro);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .25rem;
}
.cart-item-precio { font-size: .82rem; color: var(--gris); margin-bottom: .4rem; }
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: .3rem;
}
.cart-item-qty button {
    width: 24px; height: 24px;
    border-radius: 6px;
    border: 1.5px solid #e8eef3;
    background: #fff;
    font-size: .95rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--negro);
    transition: background .12s;
    line-height: 1;
}
.cart-item-qty button:hover { background: #f0fdf4; border-color: var(--verde); }
.cart-item-qty span { font-size: .85rem; font-weight: 700; min-width: 20px; text-align: center; }
.cart-item-del {
    background: none;
    border: none;
    cursor: pointer;
    color: #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .3rem;
    border-radius: 6px;
    transition: color .15s, background .15s;
    align-self: flex-start;
}
.cart-item-del:hover { color: #ef4444; background: #fef2f2; }

.cart-footer {
    border-top: 1px solid #f0f0f0;
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
    display: none;
}
.cart-footer-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: .95rem;
}
.cart-footer-total span { color: var(--gris); }
.cart-footer-total strong { font-size: 1.2rem; font-weight: 800; color: var(--negro); }
.cart-footer-acciones {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.cart-btn-pagar {
    display: block;
    width: 100%;
    background: var(--verde);
    color: #fff;
    border-radius: 12px;
    padding: .85rem;
    font-size: .95rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    transition: background .18s;
}
.cart-btn-pagar:hover { background: #2a9e38; color: #fff; }
.cart-btn-seguir {
    display: block;
    width: 100%;
    background: none;
    border: 1.5px solid #d1d5db;
    color: #374151;
    border-radius: 12px;
    padding: .75rem;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.cart-btn-seguir:hover { border-color: var(--verde); color: var(--verde); }

/* Sin stock en detalle */
.det-sin-stock-msg {
    display: inline-block;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: .6rem 1.2rem;
    font-size: .9rem;
    font-weight: 600;
}

/* Botón agregar al carrito en cards */
.prod-card-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-top: .6rem;
    padding: .5rem;
    background: var(--verde);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: background .15s, transform .1s;
}
.prod-card-add:hover { background: var(--verde-dark); }
.prod-card-add:active { transform: scale(.97); }
.prod-card-add svg { width: 14px; height: 14px; fill: #fff; flex-shrink: 0; }

/* Botón agregar en detalle */
.det-btn-carrito {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: var(--verde);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: .85rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s, transform .15s;
}
.det-btn-carrito:hover { background: var(--verde-dark); transform: translateY(-2px); }
.det-btn-carrito svg { width: 20px; height: 20px; fill: #fff; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .prod-layout { grid-template-columns: 1fr; }
    .prod-sidebar { position: static; }
    .prod-cat-list { display: flex; flex-wrap: wrap; gap: .4rem; }
    .prod-cat-list li a { font-size: .78rem; padding: .35rem .7rem; }
    .det-grid { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 600px) {
    .prod-hero { padding: 3rem 0 2rem; }
    .prod-layout { padding: 1.5rem 1rem 3rem; }
    .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .prod-card-body { padding: .75rem .85rem; }
    .det-wrap { margin: 1.5rem auto; padding: 0 1rem 3rem; }
    .det-nombre { font-size: 1.5rem; }
    .det-precio-actual { font-size: 1.5rem; }
}
