/* (todo tu CSS previo aquí, lo mantuve igual) */


body{ background:var(--bg); }

/* ENCABEZADO */
.topbar{
    background:linear-gradient(135deg, var(--naranja), var(--naranja-dark));
    box-shadow:0 10px 30px rgba(0,0,0,.13);
    padding:15px 0 20px;
    margin-bottom:30px;
}
.logo-box{
    display:flex;
    align-items:center;
    gap:10px;
}
.logo-box img{
    height:100px;

    object-fit:contain;
    background:#fff;
    padding:10px 16px;
    border-radius:5px;
}
.brand-title{
    margin:0;
    font-weight:700;
    font-size:2.3rem;
    color:#fff;
    letter-spacing:1px;
    text-shadow:0 2px 6px rgba(0,0,0,.2);
}
.search-bar{
    display:flex;
    gap:10px;
    width:100%;
    max-width:540px;
}
.search-bar input{
    flex:1;
    border:none;
    border-radius:999px;
    padding:9px 18px;
}
.search-bar input:focus{
    outline:2px solid rgba(255,255,255,.5);
}
.search-bar button{
    border:none;
    background:#fff;
    color:var(--naranja-dark);
    border-radius:999px;
    padding:9px 18px;
    font-weight:600;
}

/* CATEGORÍAS */
.categorias-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 4px;
}

/* Estilo base de los chips */
.cat-chip{
    border-radius:999px;
    flex-shrink: 0;
    font-size:0.85rem;
    padding:6px 14px;
    border:1px solid rgba(0,0,0,.08);
    background:#ffffff;
    color:var(--text);
    box-shadow:0 2px 6px rgba(0,0,0,.04);
    transition:all .18s ease-in-out;
    white-space:nowrap;
}

/* Hover en escritorio */
.cat-chip:hover{
    border-color:var(--naranja);
    color:var(--naranja-dark);
    transform:translateY(-1px);
}

/* Activo (categoría seleccionada) */
.cat-chip-active{
    background:var(--naranja);
    color:#fff !important;
    border:1px solid var(--naranja-dark);
    box-shadow:0 6px 16px rgba(249,115,22,.35);
}

/* Dropdown específico para chips */
.dropdown .cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Ajustes menú dropdown para que parezca submenu de chip */
.dropdown-menu {
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    min-width: 180px;
}

.dropdown-item {
    font-size: 0.90rem;
    border-radius: 8px;
    padding: 8px 10px;
}

.dropdown-item:hover {
    background: #fff4eb;
    color: var(--naranja-dark);
    font-weight: 600;
}

/* PRODUCTOS (resto del CSS original) */
.producto-card{
    position:relative;
    border:none;
    border-radius:18px;
    background:#fff;
    box-shadow:0 10px 30px rgba(0,0,0,.04);
    transition:.2s;
    height:100%;
    display:flex;
    flex-direction:column;
}
.producto-card:hover{ transform:translateY(-4px); }
.producto-img{
    width:100%;
    aspect-ratio:4/3;
    object-fit:cover;
    border-top-left-radius:18px;
    border-top-right-radius:18px;
    background:#ffffff;
}

.producto-card{ overflow: visible; }

.tag-cat{
    font-size:.7rem;
    background:rgba(249,115,22,.08);
    color:var(--naranja);
    padding:2px 8px;
    border-radius:999px;
    margin-bottom:6px;
    display:inline-block;
}

/* Botón WhatsApp redondo */
.btn-wa-dropdown{
    background:#25D366;
    border:none;
    width:40px;
    height:40px;
    border-radius:50%;
    padding:0;
    display:flex;
    align-items:center;
    justify-content:center;
    text-decoration:none;
    position:relative;
}

/* Imagen del logo dentro del botón */
.btn-wa-dropdown img{
    width:24px;
    height:24px;
    border-radius:50%;
    display:block;
}

/* Menú WhatsApp mejorado */
.wa-menu{
    position:absolute;
    bottom:110%;
    right:0;
    min-width:220px;
    background:#fff;
    border:1px solid rgba(0,0,0,.05);
    border-radius:14px;
    box-shadow:0 14px 30px rgba(0,0,0,.18);
    display:none;
    z-index:50;
    padding:8px;
}
.wa-menu-title{
    font-size:0.72rem;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:#6b7280;
    padding:4px 8px 6px;
    border-bottom:1px solid #e5e7eb;
    margin-bottom:6px;
}
.wa-option-btn{
    background:#fff;
    border:none;
    text-align:left;
    width:100%;
    padding:6px 8px;
    font-size:.8rem;
    display:flex;
    align-items:center;
    gap:8px;
    border-radius:10px;
    transition:background .15s ease, transform .1s ease;
}
.wa-option-btn:hover{
    background:#f3f4f6;
    transform:translateY(-1px);
}
.wa-avatar{
    width:26px;
    height:26px;
    border-radius:50%;
    background:#dcfce7;
    color:#15803d;
    font-size:.75rem;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:700;
}
.wa-text{
    display:flex;
    flex-direction:column;
}
.wa-label-main{
    font-weight:600;
    color:#111827;
    line-height:1.1;
}
.wa-label-sub{
    font-size:0.72rem;
    color:#6b7280;
}

/* Botonera de acciones al fondo de la tarjeta */
.botonera-acciones{
    margin-top:8px;
    display:flex;
    align-items:center;
    gap:8px;
    width:100%;
}

/* Botón "Ver detalle" ancho y adaptable */
.btn-detalle{
    flex: 1 1 auto;
    font-size: 0.85rem;
    padding: 7px 12px;
    white-space: nowrap;
    background-color: #F26611; /* color de fondo */
    color: #fff;              /* color del texto */
    border: none;
    border-radius: 4px;       /* bordes redondeados (opcional) */
    cursor: pointer;
}

.agotado-overlay{
    position:absolute;
    top:10px;
    right:10px;
    background:#dc2626;
    color:#fff;
    padding:4px 10px;
    border-radius:999px;
    font-size:.7rem;
    font-weight:600;
    z-index:10;
}
.opaco{ opacity:.45; }

/* ===== MODAL DETALLE DISEÑO ===== */
#productoModal .modal-content{
    border-radius:18px;
    border:none;
    box-shadow:0 24px 60px rgba(15,23,42,.35);
    overflow:hidden;
}
#productoModal .modal-header{
    background:linear-gradient(135deg, var(--naranja), var(--naranja-dark)) !important;
    color:#fff;
    border-bottom:none;
}
#productoModal .modal-title{
    font-weight:700;
    letter-spacing:.02em;
}
#productoModal .btn-close{
    filter:invert(1);
}
#productoModal .modal-body{
    background:#f9fafb;
}
.modal-product-wrapper{
    display:flex;
    flex-wrap:wrap;
    gap:16px;
}
.modal-product-img-box{
    flex:0 0 260px;
    max-width:260px;
    background:linear-gradient(135deg,#fed7aa,#fecaca);
    padding:4px;
    border-radius:16px;
}
.modal-product-img{
    width:100%;
    border-radius:12px;
    display:block;
    background:#fff;
}
.modal-product-info{
    flex:1 1 220px;
    display:flex;
    flex-direction:column;
    gap:6px;
}
.modal-cat-chip{
    display:inline-flex;
    align-items:center;
    gap:6px;
    font-size:0.8rem;
    padding:4px 10px;
    border-radius:999px;
    background:#ffedd5;
    color:#9a3412;
}
.modal-cat-dot{
    width:8px;
    height:8px;
    border-radius:50%;
    background:#f97316;
}
#modalDesc{
    font-size:0.9rem;
    color:#4b5563;
    margin-bottom:2px;
}
.modal-price-text{
    font-size:1.4rem;
    font-weight:700;
    color:var(--naranja);
    margin-bottom:2px;
}
.modal-meta{
    font-size:0.8rem;
    color:#6b7280;
}
.modal-meta strong{
    color:#374151;
}
#productoModal .modal-footer{
    background:#f3f4f6;
    border-top:1px solid #e5e7eb;
}

/* Responsive modal body */
@media(max-width:768px){
    .modal-product-img-box{
        flex:1 1 100%;
        max-width:100%;
    }
    .modal-product-info{
        flex:1 1 100%;
    }
}

@media(max-width:768px){
    .topbar .container{ gap:10px; }
    .search-bar{ 
        max-width:100%; 
        flex-direction:row;
    }
    .logo-box img{
        height:110px;
        object-fit:contain;
        background:#fff;
        padding:5px 8px;
        border-radius:14px;
    }
    .brand-title{ font-size:1.4rem; }
}
.search-bar span {
    font-weight: 600;
    color: #fff;
}

/* BOTÓN VOLVER ARRIBA */
#btnBackTop{
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--naranja);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 8px 20px rgba(0,0,0,.25);
    cursor: pointer;
    display: none;
    z-index: 999;
}
#btnBackTop:hover{
    background: var(--naranja-dark);
}

/* Vista móvil: 1 o 2 tarjetas por fila según clase del body */
@media (max-width: 575.98px) {
    body.view-1-col #productosGrid .producto-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
    body.view-2-col #productosGrid .producto-item {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .btn-wa-dropdown{
        width:36px;
        height:36px;
    }
    .btn-wa-dropdown img{
        width:22px;
        height:22px;
    }

    .categorias-container {
        gap: 4px;
        margin-bottom: 6px;
    }
    .cat-chip{
        font-size:0.75rem;
        padding:4px 10px;
        box-shadow:none;
    }
}

.producto-img {
    cursor: zoom-in;
    position: relative;
    z-index: 1;
}

.producto-img.imagen-agrandada {
    transform: scale(1.7);
    transition: transform 0.3s ease-in-out;
    position: relative;
    z-index: 9999 !important;
}



.producto-card {
    height: 300px;
    display: flex;
    flex-direction: column;
}

.producto-card .contenido {
    flex-grow: 1;
}


/* CONTENEDOR */
.descripcion-corta {
    max-height: 2000px;
    overflow-y: auto;
    font-size: 0.95rem;
    padding-right: 4px;
    position: relative;

    /* ocultar scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.descripcion-corta::-webkit-scrollbar {
    display: none;
}

/* 🔥 FLECHA */
.descripcion-corta::after {
    content: "▼";
    position: absolute;
    bottom: 2px;
    right: 6px;
    font-size: 10px;
    color: #999;
    opacity: 0;
    transition: all 0.2s ease;
}

/* mostrar al pasar mouse */
.descripcion-corta:hover::after {
    opacity: 1;
    transform: translateY(2px);
}
/* quitar espacios del editor */
.descripcion-corta p {
    margin: 0;
}



.producto-card .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.producto-card .descripcion-corta {
    flex-grow: 1,8;



}



.producto-card > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/*.descripcion-corta p:first-of-type {
    display: none;
}*/

/* =====================================
   CORREGIR ESPACIO EN TARJETAS
===================================== */

/* Reducir espacio reservado para la imagen */
.producto-card .img-container {
    height: 250px !important;
    flex: 0 0 250px !important;
    position: relative;
    overflow: hidden;
}

/* Conservar tamaño visual de la fotografía */
.producto-card .img-container .producto-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin-top: 20px;
}

/* Evitar que el contenido se expanda */
.producto-card > .p-3 {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 4px 12px 10px !important;
    margin: 0 !important;
}

/* Compactar ID y PN */
.producto-card .prod-id {
    margin: 0 0 3px !important;
}

/* Compactar categoría */
.producto-card .tag-cat {
    margin-top: 0 !important;
    margin-bottom: 4px !important;
}

/* =========================================
   SUBMENU FLOTANTE DE CATEGORIAS
========================================= */

#submenuDesplegable {
    position: fixed !important;
    display: block !important;

    width: 280px;
    max-width: calc(100vw - 16px);

    margin: 0 !important;
    padding: 0 12px;

    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;

    box-shadow: 0 10px 30px rgba(0,0,0,.22);

    z-index: 1000000 !important;

    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;

    transition:
        max-height .25s ease,
        opacity .2s ease,
        padding .2s ease;
}

#submenuDesplegable.abierto {
    max-height: 380px;
    padding: 12px;
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#submenuDesplegable .submenu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 700;
    color: #333;
}

#submenuDesplegable .submenu-item {
    display: block;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    color: #333;
}

#submenuDesplegable .submenu-item:hover {
    background: #fff4eb;
    color: #ea580c;
}

#submenuDesplegable .submenu-close {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
}

@media (max-width: 600px) {
    #submenuDesplegable {
        width: 260px;
        max-width: calc(100vw - 16px);
    }

    #submenuDesplegable.abierto {
        max-height: 340px;
    }
}


/* =====================================
   VISOR DE IMÁGENES DE PRODUCTOS
===================================== */

#visorImagenProducto {
    position: fixed !important;
    inset: 0 !important;

    width: 100vw;
    height: 100vh;

    background: rgba(0, 0, 0, 0.88);

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 9999999 !important;

    padding: 20px;
    box-sizing: border-box;

    cursor: zoom-out;
}

#visorImagenProducto img {
    max-width: 95vw;
    max-height: 90vh;

    width: auto;
    height: auto;

    object-fit: contain;

    border-radius: 10px;

    box-shadow: 0 10px 40px rgba(0,0,0,.5);

    cursor: default;
}

.visor-imagen-cerrar {
    position: absolute;
    top: 15px;
    right: 20px;

    width: 42px;
    height: 42px;

    border: none;
    border-radius: 50%;

    background: #f97316;
    color: white;

    font-size: 30px;
    line-height: 1;

    cursor: pointer;
    z-index: 10000000;
}

.visor-imagen-cerrar:hover {
    background: #ea580c;
}

@media (max-width: 600px) {

    #visorImagenProducto {
        padding: 10px;
    }

    #visorImagenProducto img {
        max-width: 98vw;
        max-height: 85vh;
    }

}

/* =========================================
   MODOS DE EXHIBICIÓN DEL CATÁLOGO
========================================= */

.btn-escaparate {
    background: var(--naranja);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}

.btn-escaparate:hover {
    background: var(--naranja-dark);
    color: white;
    transform: translateY(-2px);
}

/* CONTENEDOR PRINCIPAL */

#escaparateCatalogo {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 99999999;
    background: #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* BARRA SUPERIOR */

.escaparate-toolbar {
    flex-shrink: 0;
    min-height: 58px;
    background: #171717;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 16px;
    z-index: 20;
}

.escaparate-toolbar strong {
    font-size: 15px;
}

.escaparate-toolbar button {
    border: none;
    border-radius: 7px;
    padding: 8px 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-salir-escaparate {
    background: #f97316;
    color: white;
}

/* ÁREA DE PRODUCTOS */

.escaparate-stage {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
}

/* MODO PANTALLA COMPLETA */

.escaparate-stage.modo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    align-content: start;
    gap: 18px;
    background: var(--bg);
}

.escaparate-stage .escaparate-clone {
    min-width: 0;
}

.escaparate-stage.modo-grid .escaparate-clone {
    position: relative;
    width: 100%;
}

.escaparate-stage .producto-card {
    height: 100%;
    background: var(--card-bg);
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 5px 18px rgba(0,0,0,.14);
}

.escaparate-stage .img-container {
    height: clamp(180px, 32vh, 350px);
    overflow: hidden;
}

.escaparate-stage .producto-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin-top: 0;
}

.escaparate-stage .botonera-acciones {
    display: none !important;
}

/* MODO PROTECTOR 3D */

.escaparate-stage.modo-flotante {
    background:
        radial-gradient(circle at center, #374151 0%, #111827 65%, #030712 100%);
    overflow: hidden;
}

.escaparate-stage.modo-flotante .escaparate-clone {
    position: absolute;
    width: clamp(210px, 27vw, 310px);
    animation: tarjetaFlotante 13s ease-in-out infinite alternate;
    animation-delay: var(--delay, 0s);
    z-index: 2;
}

.escaparate-stage.modo-flotante .producto-card {
    border-radius: 15px;
    box-shadow: 0 20px 45px rgba(0,0,0,.4);
}

.escaparate-stage.modo-flotante .img-container {
    height: 180px;
}

.escaparate-stage.modo-flotante .producto-img {
    object-fit: contain;
    margin-top: 0;
}

.escaparate-stage.modo-flotante .descripcion-corta {
    display: none;
}

.escaparate-stage.modo-flotante .tag-cat {
    font-size: 10px;
}

.escaparate-stage.modo-flotante .botonera-acciones,
.escaparate-stage.modo-flotante .oferta-sticker {
    display: none !important;
}

@keyframes tarjetaFlotante {
    0% {
        transform: translate3d(0, 0, 0) rotate(-5deg) scale(.92);
    }

    50% {
        transform: translate3d(var(--mov-x), var(--mov-y), 0)
                   rotate(var(--rotacion)) scale(1.04);
    }

    100% {
        transform: translate3d(0, 0, 0) rotate(5deg) scale(.95);
    }
}

/* CELULARES */

@media (max-width: 600px) {

    .controles-escaparate {
        justify-content: center !important;
    }

    .btn-escaparate {
        font-size: 11px;
        padding: 7px 9px;
    }

    .escaparate-toolbar {
        min-height: 52px;
        padding: 7px 10px;
    }

    .escaparate-toolbar strong {
        font-size: 12px;
    }

    .escaparate-toolbar button {
        font-size: 12px;
        padding: 7px 9px;
    }

    .escaparate-stage.modo-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .escaparate-stage.modo-flotante .escaparate-clone {
        width: min(68vw, 250px);
    }

    .escaparate-stage.modo-flotante .img-container {
        height: 130px;
    }

}

/* =====================================
   BOTÓN DE PRODUCTO INDIVIDUAL
===================================== */

.btn-producto-pantalla {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    border: none;
    border-radius: 8px;
    background: var(--naranja);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.btn-producto-pantalla:hover {
    background: var(--naranja-dark);
}

/* =====================================
   MODO PRODUCTO INDIVIDUAL
===================================== */

.escaparate-stage.modo-individual {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    background: var(--bg);
}

.escaparate-stage.modo-individual .escaparate-clone {
    width: min(850px, 95%);
    max-height: 100%;
    margin: auto;
}

.escaparate-stage.modo-individual .producto-card {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 20px;
    gap: 20px;
}

.escaparate-stage.modo-individual .img-container {
    height: min(65vh, 550px);
    background: white;
    border-radius: 12px;
}

.escaparate-stage.modo-individual .producto-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.escaparate-stage.modo-individual .btn-producto-pantalla,
.escaparate-stage.modo-individual .botonera-acciones {
    display: none !important;
}

@media (max-width: 600px) {

    .escaparate-stage.modo-individual {
        padding: 10px;
    }

    .escaparate-stage.modo-individual .escaparate-clone {
        width: 100%;
    }

    .escaparate-stage.modo-individual .producto-card {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 10px;
    }

    .escaparate-stage.modo-individual .img-container {
        height: 38vh;
    }

}

/* Botón discreto de pantalla completa */
.btn-producto-pantalla {
    position: absolute;
    top: 7px;
    right: 7px;

    width: 27px;
    height: 27px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.35);
    color: rgba(50, 50, 50, 0.45);

    border: 1px solid rgba(100, 100, 100, 0.12);
    border-radius: 7px;

    font-size: 17px;
    line-height: 1;

    opacity: 0.35;
    cursor: pointer;
    z-index: 5;

    transition: all 0.2s ease;
}

/* Aparece un poco más al pasar el mouse */
.btn-producto-pantalla:hover {
    opacity: 1;
    color: #f97316;
    background: rgba(255, 255, 255, 0.95);
    border-color: #f97316;
}

/* La tarjeta debe permitir posicionar el botón */
.producto-card {
    position: relative;
}

/* En celulares: siempre ligeramente visible */
@media (max-width: 768px) {
    .btn-producto-pantalla {
        opacity: 0.55;
        background: rgba(255, 255, 255, 0.55);
    }
}

/* =====================================
   BARRA ÚNICA DE CONTROLES DEL CATÁLOGO
===================================== */

.barra-controles-catalogo {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 10px;
}

.controles-vista,
.controles-escaparate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Evitar márgenes adicionales */
.controles-escaparate {
    margin: 0;
}

/* PC */
@media (min-width: 576px) {
    .barra-controles-catalogo {
        flex-wrap: nowrap;
    }
}

/* MÓVIL */
@media (max-width: 575px) {

    .barra-controles-catalogo {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 4px;
    }

    .controles-vista,
    .controles-escaparate {
        flex-wrap: nowrap;
        gap: 4px;
    }

    .barra-controles-catalogo button {
        white-space: nowrap;
        font-size: 11px;
        padding: 5px 7px;
    }

    .controles-escaparate .btn-escaparate {
        font-size: 11px;
        padding: 5px 7px;
    }
}