/* ==========================================================================
   VARIABLES Y ESTILOS BASE (Mantenemos tus colores e identidad)
   ========================================================================== */
:root {
    --main: #0a6b28;
    --secun: #f1e70b;
    --tercer: #aa0010;
    --borderGris: #acacac;
    --naranja: #ff9600;
    --gris: #afafaf;
    --rojo: #df4545;
    --azul: #03afe7;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-weight: 300;
    font-family: "Roboto", sans-serif;
    background-color: #f5f5f5;
}

/* ==========================================================================
   ESTRUCTURA MAESTRA (100% Pantalla / Anti-Scroll General)
   ========================================================================== */
.new_tabla_principal {
    display: flex;
    width: 100%;
    height: 90dvh;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

/* Botón Hamburguesa Flotante */
.new_menu_toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 20px;
    border-radius: 4px;
    cursor: pointer;
}

/* Menú Lateral Oculto */
.new_sidebar {
    position: absolute;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: #2c3e50;
    color: white;
    z-index: 90;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    padding: 10px 15px 20px 15px;
    box-sizing: border-box;
}

.new_sidebar.active {
    left: 0;
}

.new_sidebar_header {
    display: flex;
    justify-content: space-between; /* Separa la info a la izq y el logo a la der */
    align-items: center; /* Centra los elementos verticalmente */
    text-align: left; /* Alinea el texto a la izquierda */
    border-bottom: 1px solid #34495e;
    padding-bottom: 15px;
    margin-bottom: 15px;
    gap: 15px; /* Da un poco de respiro entre el texto y el logo */
}

.new_info_user {
    flex-grow: 1; /* Permite que el texto ocupe el espacio disponible */
    text-align: right; /* <--- Esto alinea el texto a la derecha */
}

.new_info_user b {
    font-size: 16px;
    color: #ecf0f1;
}

.new_logoTop {
    max-width: 70px;
    height: auto;
    border-radius: 15px;
    flex-shrink: 0; /* Evita que el logo se haga pequeño si el texto es muy largo */
}

.new_botonera {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mrginbot20{margin-bottom:20px;}

.new_btn {
    display: block;
    padding: 12px;
    text-align: center;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    font-family: "Roboto", sans-serif;
}

.new_btnEnviar { background-color: var(--main); color: white; border: 1px solid var(--main); }
.new_btnRojo { background-color: var(--rojo); color: white; border: 1px solid var(--rojo); margin-top: auto; }

/* Área de Trabajo Dividida */
.new_contenedor_app {
    display: flex;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   COLUMNA IZQUIERDA: TICKET BOX
   ========================================================================== */
.new_ticketBox {
    width: 32%;
    min-width: 320px;
    height: 100%;
    background-color: #f7f7f7;
    border-right: 2px solid #ddd;
    display: flex;
    flex-direction: column;
}

.new_ticketHeader {
    padding: 15px;
    background: var(--main);
    color: white;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
}

.new_ticketBody {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.new_ticketTabla {
    width: 100%;
    border-collapse: collapse;
}

.new_ticketTabla th, 
.new_ticketTabla td {
    padding: 6px 4px;
    font-size: 18px;
    font-weight: 500;
}

.new_ticketTabla th {
    background-color: #e9e9e9;
    text-align: left;
}






/* Footer del ticket fijo abajo */
.new_ticketFooter {
    padding: 15px;
    border-top: 1px solid #ddd;
    background: #fff;
    margin-top: auto;
}

/* Creamos un contenedor flex para el historial y el total */
.new_ticketFooter_row {
    display: flex;
    justify-content: space-between; /* Manda el historial a la izquierda y el total a la derecha */
    align-items: center;            /* Los centra verticalmente para que se vean simétricos */
    margin-bottom: 15px;            /* El margen que antes tenía el total, ahora lo lleva la fila */
}

.new_ticketHistorial {
    font-size: 32px;                 /* Ajusta el tamaño del emoji si lo necesitas */
    cursor: pointer;
}

.new_ticketTotal {
    font-size: 26px;
    font-weight: bold;
    text-align: right;              /* Mantiene el texto alineado a la derecha */
    margin-bottom: 0;               /* Le quitamos el margen de abajo para que no desfase la fila */
}

.new_btnCobrar {
    width: 100%;
    padding: 20px;
    background: var(--tercer);
    color: white;
    border: none;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    box-sizing: border-box;
}

/* ==========================================================================
   COLUMNA DERECHA: GRID DE PRODUCTOS
   ========================================================================== */
.new_productosList {
    width: 68%;
    height: 100%;
    overflow-y: auto;
    display: grid;
    /* Ajusta automáticamente las columnas según el tamaño de la tablet */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 15px 15px 15px 15px; /* Margen superior para no tapar con el botón hamburguesa */
    box-sizing: border-box;
    align-content: start;
}

.new_productoBox {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    height: 220px; /* Alto óptimo para pantallas touch */
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
    transition: transform 0.1s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border: 1px solid #eee;
}

.new_productoBox:active {
    transform: scale(0.97);
}

.new_img_box {
    height:140px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.new_img_box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.new_productoNombre {
    font-weight: 300;
    padding: 4px;
    text-align: center;
    font-size: 15px;
    line-height: 1.2;
    flex-grow: 1;
}

.new_productoPresentacion {
    font-weight: 600;
    font-size: 12px;
    color: #666;
}

.new_productoPrecio {
    background: var(--secun);
    text-align: center;
    font-weight: bold;
    padding: 6px;
    margin-top: auto;
    font-size: 18px;
    color: #000;
}

/* --- RESCATADO: Alerta Visual de Stock Bajo --- */
.new_stockbajo {
    border: 2px solid #e74c3c !important;
    background: #fff6f6 !important;
    position: relative;
}

.new_stockbajo::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
}


/* ==========================================================================
   RESCATADO Y ADAPTADO: MODAL DE PAGO (Lógica intacta)
   ========================================================================== */
#modalPrecio,
#modalPago {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index:9900;
}

.modalPagoBox {
    position: absolute;
    top: 0%;
    width: 500px;
    left: calc(50% - 250px);
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.modalTitulo {
    font-size: 26px;
    font-weight: 300;
    margin-bottom: 20px;
    text-align: center;
}

.pagoexacto {
    font-size: 30px; 
    float: right;
}

.pagoFila {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 18px;
    align-items: center;
}

#pagoRecibido {
    width: 140px;
    font-size: 22px;
    text-align: right;
    padding: 5px;
    border: 1px solid var(--borderGris);
    border-radius: 4px;
}

.cambio {
    font-weight: bold;
    color: var(--main);
    font-size: 24px;
}

.modalBtns {
    margin: 20px 0px 10px 0px;
    display: flex;
    gap: 10px;
}

.modalBtns button {
    flex: 1;
    padding: 15px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
}

.btnCancelarPago {
    background: #ccc;
    color: #333;
}

.btnConfirmarPago {
    background: var(--main);
    color: white;
}

/* Distribución Teclado + Atajos Rápidos */
.zonaPago {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 15px;
    margin-top:0px;
}

.pagoRapido {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.pagoRapido button {
    padding: 12px;
    font-size: 18px;
    border: none;
    background: var(--secun);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.pagoRapido button:hover {
    background: var(--main);
    color: white;
}

.pagoTeclado {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btnNumerico {
    padding: 15px;
    font-size: 22px;
    font-weight: bold;
    border: none;
    background: #eee;
    border-radius: 8px;
    cursor: pointer;
}

.btnNumerico:hover {
    background: var(--secun);
}


/* ==========================================================================
   RESCATADO Y ADAPTADO: TECLADO ALTERNATIVO (Lógica intacta)
   ========================================================================== */
.tecladoBox { display: flex; gap: 20px; }
.tecladoInput { width: 140px; }
.tecladoBotones { width: 140px; }
.tecladoBotones button { width: 100%; height: 58%; }
.tecladoBotones button:nth-child(2) { margin-top: 20px; height: 32%; }

.tecladoNumerico {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    gap: 10px;
}

.tecladoNumerico button {
    height: 50px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    background: #f3f3f3;
    border-radius: 6px;
    cursor: pointer;
}

.tecladoNumerico button:hover { background: #ddd; }


/* ==========================================================================
   RESCATADO Y ADAPTADO: SECCIÓN RECIBIR STOCK
   ========================================================================== */
.productoReciboList {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.productoRecibo {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    height: 280px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border: 1px solid #ddd;
}

.productoRecibo .img {
    height: 120px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.productoRecibo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.productoReciboNombre {
    font-weight: 400;
    text-align: center;
    font-size: 16px;
    padding: 4px;
}

.productoReciboPresen {
    font-weight: 300;
    font-size: 13px;
    color: #777;
    text-align: center;
}

.cantidadEnviada {
    font-weight: 600;
    text-align: center;
    font-size: 20px;
    margin: 5px 0;
}

/* Controles de más y menos en el inventario */
.inputRecibido {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    width: 80px;
    color: var(--main);
    border: 1px solid var(--borderGris);
    border-radius: 4px;
}

.btnMenos, .btnMas {
    width: 44px;
    height: 44px;
    font-size: 24px;
    border: none;
    border-radius: 8px;
    background: var(--azul);
    color: white;
    cursor: pointer;
}





/* Estilos Base del Modal HISTORIAL */
.custom-modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.custom-modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}
.custom-modal-content-gde {
    max-width: 900px;
}

@keyframes fadeIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.custom-modal-close {
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}
.custom-modal-close:hover { color: #000; }

/* Tabla dentro del Modal */
.tabla-historial {
    width: 100%;
    border-collapse: collapse;
}

.tabla-historial th, .tabla-historial td {
    border-bottom: 1px solid #ddd;
    padding: 12px 10px;
    text-align: left;
}

.tabla-historial th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.btn-cancelar {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}
.btn-cancelar:hover {
    transform: scale(1.2);
}






        /* Contenedor del botón en la esquina superior derecha */
        .window-controls {
            position: fixed;
            top: 5px;
            right: 5px;
            z-index: 9999; /* Asegura que esté por encima de todo */
            display: flex;
            background-color: transparent;
        }

        /* Estilo base del botón tipo Windows */
        .win-btn {
            width: 32px;
            height: 32px;
            background: var(--main);
            border: none;
            outline: none;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.1s ease;
        }

        /* Efecto Hover (pasar el mouse por encima) */
        .win-btn:hover {
            background-color: rgba(0, 0, 0, 0.1); /* Gris claro estilo Win10/11 */
        }

        /* El icono del cuadrado (Maximizar) */
        .icon-maximize img {width: 90%;}

        /* Opcional: Si tu fondo de página es oscuro, puedes cambiar el color del icono */
        @media (prefers-color-scheme: dark) {
            .icon-maximize { border-color: #fff; }
            .win-btn:hover { background-color: rgba(255, 255, 255, 0.1); }
        }








