/* Reset básico para velocidad y limpieza */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body {
    background-color: #f4f4f5;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* Cabecera con el Azul Noche de tu Landing */
.header { display: flex; justify-content: space-between; padding: 15px; background: #0B0F19; color: white; font-weight: bold; font-size: 18px; }

/* Barra de Pestañas Deslizable */
.categories { display: flex; overflow-x: auto; padding: 10px; background: white; gap: 10px; border-bottom: 1px solid #e4e4e7; }
.cat-btn { padding: 12px 20px; border: none; background: #e4e4e7; border-radius: 8px; font-weight: bold; white-space: nowrap; font-size: 16px; }
.cat-btn.active { background: #3B82F6; color: white; }

/* --- REQ 1: Lista compacta de productos --- */
.lista-productos {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 8px 15px 90px 15px; /* espacio para el footer */
}

.fila-producto {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
    background: white;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.fila-info h3 { font-size: 16px; color: #18181b; }
.fila-info .precio { font-size: 13px; color: #71717a; font-weight: 600; }

.fila-controles { display: flex; align-items: center; gap: 10px; }
.btn-qty {
    width: 32px; height: 32px;
    border: none; border-radius: 8px;
    background: #e4e4e7; color: #18181b;
    font-size: 18px; font-weight: bold;
    cursor: pointer;
}
.btn-qty.btn-mas { background: #3B82F6; color: white; }
.btn-qty:active { transform: scale(0.92); }

.cantidad { min-width: 18px; text-align: center; font-weight: bold; font-size: 16px; color: #18181b; }

.fila-subtotal { min-width: 64px; text-align: right; font-weight: bold; color: #18181b; font-size: 14px; }

/* Botón inferior estático */
.sticky-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: white;
    padding: 15px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.resumen { font-size: 18px; font-weight: bold; color: #18181b; }
.btn-enviar { padding: 15px 25px; font-size: 16px; font-weight: bold; border: none; border-radius: 8px; background: #2563eb; color: white; transition: background 0.2s; }
.btn-enviar:disabled { background: #a1a1aa; color: #e4e4e7; }

/* --- ESTILOS DEL MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
    z-index: 1000;
}
.modal-overlay.oculto { display: none; }

.modal-content {
    background: white;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    padding-bottom: 30px;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-content h2 { margin-bottom: 15px; color: #18181b; font-size: 20px; }

#lista-resumen { max-height: 35vh; overflow-y: auto; margin-bottom: 15px; }
.resumen-item { display: flex; justify-content: space-between; font-size: 16px; border-bottom: 1px solid #e4e4e7; padding: 10px 0; color: #3f3f46; font-weight: 500;}

#notas-cocina {
    width: 100%; height: 70px; padding: 10px;
    border-radius: 8px; border: 1px solid #d4d4d8;
    margin-bottom: 15px; resize: none; font-size: 16px;
}

.modal-botones { display: flex; gap: 10px; }
.btn-secundario, .btn-primario { flex: 1; padding: 15px; font-size: 16px; font-weight: bold; border: none; border-radius: 8px; transition: 0.2s; }
.btn-secundario { background: #e4e4e7; color: #3f3f46; }
.btn-primario { background: #2563eb; color: white; }
.btn-primario:disabled { background: #60a5fa; opacity: 0.7; }

/* --- VISTAS Y MAPA DE MESAS --- */
.oculto { display: none !important; }

/* FIX: header/nav/main/footer viven DENTRO de #vista-menu, no directo en
   body, así que #vista-menu necesita su propio flex+altura real para que
   .lista-productos (flex:1) tenga un alto del cual hacer overflow-y:auto.
   Sin esto, el contenido se recorta contra el overflow:hidden del body
   y nunca se puede hacer scroll. */
#vista-mesas, #vista-menu {
    height: 100vh;
}
#vista-mesas { overflow-y: auto; }
#vista-menu {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* el scroll real ocurre dentro de .lista-productos */
}

.topbar-mesas {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid #e4e4e7; background: white;
}
.topbar-mesas h2 { color: #18181b; font-size: 18px; }
.topbar-links { display: flex; gap: 10px; }
.link-panel {
    text-decoration: none; font-size: 14px; font-weight: bold;
    background: #e4e4e7; color: #18181b; padding: 8px 14px; border-radius: 8px;
}

.grid-mesas {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
}

.btn-mesa {
    border: 2px solid #3f3f46;
    padding: 24px 0;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.6;
}
.btn-mesa:active { transform: scale(0.95); }

/* REQ 2: Semáforo dinámico — verde libre, rojo ocupada */
.btn-mesa.mesa-libre { background: #16a34a; border-color: #15803d; color: white; }
.btn-mesa.mesa-ocupada { background: #dc2626; border-color: #b91c1c; color: white; }
.mesa-monto { font-size: 0.85rem; font-weight: 600; opacity: 0.9; }

.btn-volver {
    background: transparent;
    border: none;
    color: #a1a1aa;
    font-size: 1.5rem;
    margin-right: 15px;
    cursor: pointer;
}

/* --- ALMECSY FOOTER BRANDING: píldora centrada ---
   Fijo (no en el flujo normal): body tiene overflow:hidden y las vistas
   ya ocupan 100vh, así que cualquier elemento en flujo normal después de
   ellas queda recortado y nunca se ve. "bottom" fijo evita el problema y
   además nos deja compensar la altura del sticky-footer.
   bottom:78px flota arriba del sticky-footer para no tapar "ENVIAR ORDEN". */
.almecsy-footer {
    position: fixed;
    left: 50%;
    bottom: 78px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(0,0,0,0.045); /* fondo claro (#f4f4f5): píldora oscura translúcida */
    border: 1px solid rgba(0,0,0,0.06);
    font-size: 11px;
    color: #71717a;
    font-weight: 600;
    letter-spacing: 0.4px;
    pointer-events: none; /* nunca debe robarle un tap al mesero */
    z-index: 400; /* debajo del modal (1000) y del sticky-footer */
}

.almecsy-footer img {
    width: 16px;
    height: auto;
    opacity: 0.75;
}
