/* --- 1. Variables Globales (Identidad El Oasis) --- */
:root {
    /* Reemplazo inspirado en el 4.º círculo */
    --ocre-oasis: #d4a373; 
    
    /* Usamos el 1.º círculo (el más oscuro) para textos y headers de alto contraste */
    --texto-dark: #0b132b; 
    
    /* Mantenemos tus verdes pero ajustados para que "peguen" con el nuevo ocre */
    --verde-principal: #2d5a27;
    --verde-oscuro: #1b3a18;
    
    --hueso: #fefae0;
    --blanco: #ffffff;
    --gris-fondo: #f8f9fa;
    
    --danger: #dc3546;
    --success: #28a745;
    
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 8px;
    --header-height: 70px; /* Crucial para el layout fixed */
}

/* --- 2. Reseteo y Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
a {
    text-decoration: none;
}

body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gris-fondo);
    color: var(--texto);
    padding-top: var(--header-height); /* Evita que el header tape el contenido */
    overflow: hidden; /* El scroll lo manejaremos por secciones */
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] { -moz-appearance:textfield; }

/* --- 3. Navbar Fixed --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--verde-principal);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 1000;
    border-bottom: 4px solid var(--ocre-oasis);
    box-shadow: var(--shadow);
}

.nav-menu {
    display: flex;
    gap: 30px;
    margin-left: 40px;
}

.nav-link {
    color: var(--hueso) !important; /* Forzamos que no sea violeta */
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: 0.3s;
    opacity: 0.8;
}

.nav-link:hover {
    color: var(--blanco) !important;
    opacity: 1;
    transform: translateY(-1px);
}

.brand {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--blanco);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.user-status {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 50px;
    color: var(--hueso);
    font-size: 0.85rem;
}

/* --- 4. Componentes Comunes --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: 0.2s ease;
    text-align: center;
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(90%); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; opacity: 0.5; }
.btn-danger:hover {opacity: 1;}

.tabla-oasis {
    width: 100%;
    border-collapse: collapse;
    background: var(--blanco);
    /* border-radius: var(--border-radius); */
    overflow: hidden;
    box-shadow: var(--shadow);
    overflow-y: scroll;
}

.tabla-oasis th {
    background: var(--verde-principal);
    color: var(--hueso);
    padding: 15px;
    text-align: left;
    position: sticky; /* Los encabezados se quedan arriba al scrollear */
    top: 0;
}

.tabla-oasis td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

/* Modal registro gastos */
.modal-oasis {
    display: none; /* Oculta por defecto */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    animation: fadeInBackground 0.2s ease-out forwards;
}

@keyframes fadeInBackground {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: modalPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

@keyframes modalPulse {
    0% {
        opacity: 0;
        /* Empieza un poco más chico (80% de su tamaño) */
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        /* Termina en su tamaño normal y posición original */
        transform: scale(1) translateY(0);
    }
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 10px;
}

.modal-actions .btn { flex: 1; }


/* Contenedor para centrar formularios de gestión */
.container-centrado {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - var(--header-height));
    padding: 20px;
}

.card-formulario {
    /* background: white; */
    padding: 30px;
    border-radius: 12px;
    /* box-shadow: 0 10px 30px rgba(0,0,0,0.08); */
    /* width: 100%; */
    max-height: calc(90vh - var(--header-height));
    max-width: 500px; /* Ancho máximo controlado */
    border-left: 4px solid rgba(3, 58, 3, 0.5);
    margin: 20px auto; /* Centrado vertical y horizontal */
    /* overflow: hidden; */
    box-sizing: border-box; /* Asegura que el padding no aumente el ancho total */
    overflow-y: scroll;
}
.form-header { text-align: center; margin-bottom: 20px; }

/* Encabezados */
.form-header h2 {
    color: var(--verde-oscuro); /* Usamos el verde más serio */
    font-weight: 800;
    margin-bottom: 10px;
}

.form-header p {
    color: #777;
    font-size: 1rem;
}

.form-group-oasis {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group-oasis label {
    color: var(--verde-oscuro);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 8px;
    display: block;
}

.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: 600;
}
.helptext, .help-block, .form-text {
    font-size: 0.8rem;
    color: #666;
    margin-top: 6px;
    line-height: 1.4;
    background-color: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #ccc;
    word-wrap: break-word; /* Rompe palabras largas si es necesario */
    width: 100%; /* Se adapta al ancho del contenedor */
    box-sizing: border-box;
}

.helptext ul {
    margin: 5px 0 0 15px;
    padding: 0;
}

.form-actions-flex {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.form-actions-flex .btn { flex: 1; padding: 15px; }

.form-group-oasis input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #333;
    background-color: #fdfdfd;
    transition: all 0.3s ease-in-out;
    box-sizing: border-box; /* Importantísimo para que el padding no rompa el layout */
}

.input-oasis:focus {
    border-color: var(--verde-principal); /* Foco color marca */
    background-color: white;
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.15); /* Resplandor verde suave */
    outline: none;
}

/* Inputs Deshabilitados (ej: username en perfil) */
.input-oasis:disabled {
    background-color: #f0f2f5;
    color: #999;
    border-color: #dce0e4;
    cursor: not-allowed;
}

/* Botón secundario */
.btn-danger-outline {
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
}
.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
}
/* --- Botones y Enlaces del Formulario --- */
.form-actions-stack {
    display: flex;
    flex-direction: column; /* Apilados en pantallas chicas */
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

@media (min-width: 480px) {
    .form-actions-stack {
        flex-direction: row; /* En línea en pantallas más grandes */
        align-items: center;
        justify-content: space-between;
    }
}

/* El botón principal (verde) */
.btn-success.btn-full {
    flex: 2; /* Toma más espacio */
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px rgba(45, 90, 39, 0.2);
}
.btn-success.btn-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(45, 90, 39, 0.3);
}

/* EL ARREGLO DEL "Volver" (Link estilizado) */
.btn-volver-link {
    flex: 1;
    text-align: center;
    color: #999; /* Gris neutro inicial */
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-volver-link:hover {
    color: var(--verde-principal); /* Se pone verde al pasar el mouse */
    background-color: #f0f7f1; /* Un fondo verde muy clarito */
}

/* Checkbox personalizado (para el "Es Administrador") */
.checkbox-oasis {
    width: 22px;
    height: 22px;
    accent-color: var(--verde-principal); /* Color de marca nativo */
    cursor: pointer;
    margin-right: 10px;
    vertical-align: middle;
}
.checkbox-wrapper {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
}
.checkbox-wrapper label {
    margin-bottom: 0 !important; /* Reset del margen del label normal */
    cursor: pointer;
}


/* Dashboard */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card-stats {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-top: 5px solid var(--verde-principal);
}

.card-stats h3 {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.card-stats .dato {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--verde-oscuro);
}

.card-danger { border-top-color: var(--danger); }
.card-success { border-top-color: var(--success); }

/* Sección de Usuario y Acciones */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Botón de Gasto en el Header */
.btn-gasto-header {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-gasto-header:hover {
    background-color: var(--danger);
    border-color: var(--danger);
}

/* Contenedor principal */
.usuario-dropdown {
    position: relative;
    display: inline-block;
}

/* Botón que dispara el menú */
.dropdown-trigger {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--blanco);
    padding: 8px 15px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.dropdown-trigger:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--ocre-oasis);
}

.arrow { font-size: 0.7rem; opacity: 0.7; }

/* El Menú Flotante */
.dropdown-content {
    display: none; /* Se oculta por defecto */
    position: absolute;
    right: 0;
    top: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(30px);
    min-width: 220px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

/* Mostrar al hacer hover */
.usuario-dropdown:hover .dropdown-content {
    display: block;
}

/* Títulos de sección dentro del menú */
.dropdown-header {
    padding: 10px 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #999;
    font-weight: 800;
    /* background: #f8f9fa; */
}

/* Enlaces del menú */
.dropdown-content a, .btn-logout-dropdown {
    color: #333 !important;
    padding: 12px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    text-align: left;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    transition: 0.2s;
}

.dropdown-content a:hover, .btn-logout-dropdown:hover {
    background-color: rgba(0, 0, 0, 0.1);
    /* color: var(--verde-principal) !important; */
    padding-left: 20px; /* Efecto de desplazamiento */
}

.dropdown-content hr {
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 5px 0;
}

/* Botón de logout específico */
.btn-logout-dropdown {
    color: var(--danger) !important;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* VENTAS */

.contenedor-busqueda { position: relative; }

#lista-sugerencias {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none; /* Se muestra solo cuando hay resultados */
}

.sugerencia-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.sugerencia-item:hover, .sugerencia-item.selected {
    background-color: var(--verde-claro); /* El verde de tu paleta */
    color: var(--verde-oscuro);
}

.sugerencia-item span { font-weight: bold; color: var(--verde-principal); }

/* Contenedor de sugerencias (ajuste de bordes) */
#lista-sugerencias {
    border-radius: 0 0 12px 12px;
    border: 2px solid var(--verde-principal);
    border-top: none;
    background: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* Item base */
.sugerencia-item {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease; /* Para que el cambio de color sea suave */
    color: #333;
}

/* --- ESTADOS DE SELECCIÓN --- */

/* Hover con el mouse Y selección con teclado */
.sugerencia-item:hover, 
.sugerencia-item.selected {
    background-color: var(--verde-claro, #eef7ee); /* Un verde muy clarito de fondo */
    color: var(--verde-oscuro);
    padding-left: 25px; /* Efecto de desplazamiento hacia la derecha */
    border-left: 5px solid var(--ocre-oasis); /* Barra dorada a la izquierda */
}

/* El precio dentro del item seleccionado */
.sugerencia-item:hover span,
.sugerencia-item.selected span {
    color: var(--verde-oscuro);
    transform: scale(1.1);
    font-weight: 800;
}

/* Quitar el borde al último item */
.sugerencia-item:last-child {
    border-bottom: none;
}

/* --- MENSAJES DEL SISTEMA --- */
.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-oasis {
    background: rgba(0, 128, 0, 0.2);
    backdrop-filter: blur(20px);
    color: white;
    padding: 35px 45px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    font-weight: 600;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    border-left: 5px solid var(--ocre-oasis);
    animation: slideIn 0.3s ease-out, fadeOut 0.5s ease-in 2.5s forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { transform: translateX(20px); opacity: 0; }
}

/* CONFIGURACION */

/* Escondemos el input de archivo por defecto */
.input-file-hidden {
    display: none;
}

/* Contenedor para alinear el botón y el texto */
.file-upload-wrapper {
    display: flex;
    align-items: center;
}

/* El estilo del botón "falso" */
.btn-oasis-outline {
    background-color: transparent;
    border: 2px solid var(--verde-principal);
    color: var(--verde-principal);
    padding: 8px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Espacio entre icono y texto */
}

.btn-oasis-outline:hover {
    background-color: var(--verde-principal);
    color: white;
}

.logo-ticket {
    text-align: center;
    margin-bottom: 10px;
}

.logo-ticket img {
    max-width: 120px; /* Tamaño ideal para impresoras térmicas */
    height: auto;
    /* Un pequeño truco para impresoras blanco y negro: */
    filter: grayscale(100%); 
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 1.4rem;
    margin: 5px 0;
}

.ticket-header {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px dashed #000;
    padding-bottom: 10px;
}

/* Manejo del Logo */
.logo-wrapper {
    margin-bottom: 8px;
}

.ticket-logo {
    max-width: 120px; /* Ajuste para papel de 80mm */
    height: auto;
    /* Forzamos blanco y negro para mejor contraste en la térmica */
    filter: grayscale(100%) contrast(1.5); 
}

/* El nombre del negocio dinámico */
.business-name {
    font-size: 1.4rem;
    margin: 5px 0;
    line-height: 1.2;
    /* Si el nombre es muy largo, que baje de línea prolijo */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    padding: 0 5px;
}

.business-data p {
    font-size: 0.85rem;
    margin: 2px 0;
}

/* Active links */

.nav-link {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.75); /* Blanco un poco opaco para los inactivos */
    padding: 8px 0;
    margin: 0 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative; /* Necesario para el subrayado absoluto */
}

.nav-link:hover {
    color: #fff;
}

/* Estilo para el link de la sección actual */
.nav-link.active {
    color: #fff;
    font-weight: bold;
}

/* El subrayado ocre que marca la posición */
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -3px; /* Justo debajo del texto */
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #d4a373; /* Tono ocre que combina con el verde de El Oasis */
    border-radius: 2px;
}

.nav-link-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.badge-stock {
    background-color: #ff4757; /* Un rojo vibrante */
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 2px;
    /* Un pequeño brillo para que resalte más */
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.4);
}

/* Contenedor principal para alinear lo rojo y lo azul */

/* Alineación interna de los filtros */
.form-filtros-inline {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.form-group-oasis-inline {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


.badge-total-destacado {
    background: var(--verde-oscuro) !important; /* Un verde más profundo */
    color: #ffffff !important; /* Blanco puro para que "explote" el contraste */
    font-weight: 900; /* Lo más grueso posible */
    font-size: 1.1rem;
    padding: 6px 15px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Estilo para el link detalle */
.link-detalle {
    color: var(--verde-principal);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s;
}

.link-detalle:hover {
    border-bottom: 1px solid var(--verde-principal);
}

/* Alineación side-by-side de lo rojo y lo azul */
.header-reporte-master {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* EL CONTRASTE: Total con letra que resalte */
.badge-total-destacado {
    background: var(--verde-oscuro) !important;
    color: #ffffff !important;
    font-weight: 900;
    font-size: 1.1rem;
    padding: 8px 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* SCROLL DE LA TABLA */
.tabla-scroll-container {
    height: calc(100vh - 200px); /* Se ajusta al 65% del alto de la pantalla */
    overflow-y: auto; /* El scroll que pediste */
    /* border-radius: 8px; */
    border: 1px solid #eee;
}

/* Mantenemos el header de la tabla fijo mientras scrolleamos */
.tabla-oasis thead th {
    position: sticky;
    top: 0;
    background-color: var(--verde-principal);
    color: white;
    z-index: 10;
}

/* Estilo para los montos en la tabla */
.total-monto-fila {
    color: var(--verde-oscuro);
    font-weight: 700;
}

/* Fondo oscuro translúcido */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px); /* Efecto de desenfoque moderno */
}

/* La tarjeta del modal */
.modal-content-card {
    background: white;
    width: 90%;
    max-width: 450px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
}

.btn-cerrar-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    transition: background 0.2s;
}

.btn-cerrar-modal:hover { background: #e0e0e0; color: #333; }

/* Animación de entrada */
@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* base.css */
.header-reporte-master {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Alinea los filtros abajo con el título */
    gap: 20px;
    margin-bottom: 20px;
}

.tabla-scroll-container {
    max-height: 500px;
    overflow-y: auto; /* El scroll que buscabas */
    border: 1px solid #ddd;
    border-radius: 8px;
}