/* ============================================================
   ARCHIVO: menuiagd.css - ORDENAFACIL MENU IA (CSP SAFE)
   ============================================================ */
:root { 
    --orange: #FF8000; 
    --light-orange: #FFF5EC; 
    --gray: #757575; 
    --bg: #F8F8F8; 
}

* { 
    box-sizing: border-box; 
    font-family: 'Segoe UI', sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

html, body { 
    touch-action: manipulation; 
    margin: 0; 
    padding: 0;
}

body { 
    background: var(--bg); 
    padding-top: 80px; 
}

/* ESTATUS Y UTILIDADES */
.status-yellow { color: #b8860b; font-weight: bold; font-size: 11px; }
.status-green { color: green; font-weight: bold; font-size: 11px; }
.status-red { color: red; font-weight: bold; font-size: 11px; }
.no-scroll { overflow: hidden !important; height: 100dvh !important; }

/* ============================================================
   NAVEGACIÓN PRINCIPAL
   ============================================================ */
.nav { 
    position: fixed; 
    top: 0; 
    width: 100%; 
    height: 70px; 
    background: white; 
    display: flex; 
    align-items: center; 
    padding: 0 5%; 
    z-index: 997; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

.nav-img { height: 50px; width: 50px; object-fit: cover; border-radius: 8px; }
.search-box { flex: 1; display: flex; position: relative; margin: 0 15px; }
.search-box input { width: 100%; padding: 12px 120px 12px 15px; border-radius: 25px; border: 1px solid #ddd; outline: none; font-size: 16px; }

.btn-clear { 
    position: absolute; right: 5px; top: 5px; bottom: 5px; 
    background: var(--orange); color: white; border: none; 
    border-radius: 20px; padding: 0 15px; cursor: pointer; font-size: 10px; font-weight: bold;
}

.sidebar { 
    position: fixed; right: -280px; top: 0; width: 260px; height: 100dvh; 
    background: white; transition: 0.3s ease-in-out; z-index: 999; 
    padding: 40px 20px 20px 20px; box-shadow: -2px 0 15px rgba(0,0,0,0.1); 
    overflow-y: auto; display: flex; flex-direction: column;
}
.sidebar.open { right: 0; }
.sidebar button { 
    width: 100%; padding: 15px; margin-bottom: 10px; border: none; 
    background: var(--light-orange); color: var(--orange); border-radius: 10px; 
    font-weight: bold; cursor: pointer; text-align: left; font-size: 14px;
}
.sidebar-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100dvh; 
    background: rgba(0, 0, 0, 0.6); z-index: 998; display: none; 
    backdrop-filter: blur(3px); cursor: pointer;
}

/* ============================================================
   GRID DE PRODUCTOS
   ============================================================ */
.container { display: grid; gap: 8px; max-width: 1100px; margin: 0 auto; padding: 0 20px 100px 20px; }
.group-section { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; margin-bottom: 15px; }
@media (min-width: 768px) {
    .group-section { grid-template-columns: 1fr 1fr; gap: 15px; }
}
.group-header-sticky { 
    grid-column: 1 / -1; position: sticky; top: 70px; z-index: 90; 
    background: var(--bg); padding: 10px 0; 
}
.group-header-sticky h2 { 
    margin: 0; background: white; padding: 10px 15px; border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); color: var(--orange); 
    border-bottom: 2px solid var(--orange); text-transform: uppercase; font-size: 18px; 
}
.p-card { width: 100%; display: flex; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor: pointer; }
.p-info { padding: 15px; flex: 1; }
.p-img { width: 110px; height: 110px; object-fit: cover; }

/* ============================================================
   MODALES
   ============================================================ */
#zModal{ z-index:3001 }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100dvh; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: white; width: 95%; max-width: 550px; border-radius: 15px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
#pModal .modal-content, #cartModal .modal-content { height: 85dvh; }

.m-header { 
    background: var(--orange); 
    color: white; 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 999; 
    min-height: 65px;
}
#cartModal .m-header {
    min-height: 130px; 
    padding: 25px 20px;
}
.m-body { background: #fdfdfd; overflow-y: auto; flex-grow: 1; }
.m-img-banner { width: 100%; height: 140px; object-fit: cover; }

/* SUBGRUPOS - ESTA ES LA PARTE CLAVE QUE FALTABA */
.sub-group { 
    margin: 15px 15px; 
    background: white; 
    border-radius: 10px; 
    border: 5px solid #fce3d2; 
    overflow: hidden; 
}
.sub-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 15px; 
    background: #fce3d2; 
    cursor: pointer; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
}
.sub-items-container { 
    max-height: 2000px; 
    transition: max-height 0.3s ease-out; 
    background: #fff; 
    overflow: hidden; 
}
.sub-group.collapsed .sub-items-container { max-height: 0; }
.acc-icon { font-size: 10px; transition: 0.3s; color: var(--orange); }
.sub-group.collapsed .acc-icon { transform: rotate(-90deg); }

.sub-item { display: flex; justify-content: space-between; padding: 8px 15px; border-bottom: 1px solid #f2f2f2; align-items: center; font-size: 14px; }
.sub-item:last-child { border-bottom: none; }
.sub-item .qty { 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    background: #f0f0f0; 
    padding: 2px 8px; 
    border-radius: 20px; 
    height: 36px; 
}
.sub-item .qty button { 
    width: 28px; height: 28px; 
    border-radius: 50%; border: none; 
    background: white; color: var(--orange); 
    font-weight: bold; cursor: pointer; 
    font-size: 18px; line-height: 1;
}
.sub-item .qty input { width: 28px; text-align: center; border: none; background: transparent; font-weight: bold; font-size: 15px; }


.sub-item.selected {
    background: #FFF4E8;
    border-left: 4px solid var(--orange);
}
.sub-item {
    transition: background 0.2s ease, border-left 0.2s ease;
}


/* FOOTER MODAL PRODUCTO */
.m-footer { 
    padding: 12px 20px; 
    display: flex; 
    gap: 12px; 
    border-top: 1px solid #eee; 
    background: white; 
    height: 90px; 
    align-items: center;
}
.qty-main { 
    flex: 1; 
    background: #FFF4E8; 
    border-radius: 10px; 
    display: grid; 
    grid-template-columns: 1fr 1.5fr 1fr; 
    align-items: center;
    height: 55px; 
}
.qty-main button { background: var(--orange); color: white; height: 40px; border-radius: 8px; border: none; font-size: 24px; }
.qty-main input { width: 100%; font-size: 24px; font-weight: bold; text-align: center; border: none; background: transparent; }
.btn-main { 
    flex: 1.5; 
    background: var(--orange); 
    color: white; 
    border: none; 
    border-radius: 10px; 
    font-weight: bold; 
    font-size: 15px; 
    cursor: pointer; 
    height: 55px; 
    text-transform: uppercase;
}

/* CARRITO */
.cart-float { 
    position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); 
    background: var(--orange); color: white; 
    width: 110px; height: 110px;
    border-radius: 20px; z-index: 997; box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.cart-float:active { transform: translateX(-50%) scale(0.9); }
.cart-float img { width: 45px; height: 45px; object-fit: contain; margin-bottom: 5px; }
.cart-float span { font-weight: 900; font-size: 18px; letter-spacing: -0.5px; }

.m-footer-cart { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 12px; background: white; }
.btn-cart-square { height: 100px; border: none; border-radius: 8px; font-weight: 800; font-size: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: white; text-transform: uppercase; cursor: pointer; }
.btn-whatsapp { background-color: #25D366; }
.btn-call { background-color: #007AFF; }
.btn-waiter { background-color: #555555; }

/* CARRITO ITEMS */
.cartItem { border-bottom:1px solid #eee; padding:12px 10px; cursor:pointer; }
.cartRow { display:flex; gap:12px; }
.cartImg { width:55px; height:55px; object-fit:cover; border-radius:8px; }
.cartBody { flex:1; }
.cartTop { display:flex; justify-content:space-between; align-items:center; }
.cartActions { display:flex; align-items:center; gap:8px; }
.cartRemove { background:none; border:none; padding:0; }
.cartRemoveImg { width:30px; height:30px; object-fit:contain; cursor:pointer; }
.cartDetails { color:gray; font-size:11px; margin-top:3px; }

/* ANIMACIONES */
@keyframes pulseLogo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.skeleton { background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%); background-size: 200% 100%; animation: shine 1.5s linear infinite; }
@keyframes shine { to { background-position-x: -200%; } }
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0px rgba(255, 128, 0, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 128, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0px rgba(255, 128, 0, 0); }
}


/* Solo para el input de cantidad */
@keyframes pulseQty {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 0 rgba(255,128,0,0.9); 
    }
    50% { 
        transform: scale(1.3); /* más grande que el pulse normal */
        box-shadow: 0 0 0 54px rgba(255,128,0,0); /* onda más amplia */
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 rgba(255,128,0,0); 
    }
}

.qty-main input.pulse-animation {
    animation: pulseQty 1.9s ease-out forwards; /* usa el nuevo */
    border: 3px solid var(--orange);
    border-radius: 8px;
}



/* SWEETALERT2 */
.swal2-container { z-index: 100000 !important; }
.swal2-popup { z-index: 100001 !important; }

/* VENDEDOR */
.v-body-login { background: var(--bg); display: flex; justify-content: center; align-items: center; height: 100dvh; margin: 0; padding-top: 0; }
.login-card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 90%; max-width: 350px; text-align: center; }


@keyframes pulseHeader {
    0% { transform: scale(1); background: #fce3d2; }
    25% { transform: scale(1); background: #FF8000; color: white; }
    50% { transform: scale(1); background: #fce3d2; }
    75% { transform: scale(1); background: #FF8000; color: white; }
    100% { transform: scale(1); background: #fce3d2; }
}

.sub-group .pulse-header {
    animation: pulseHeader 1s ease-out forwards;
    border-radius: 8px;
}