/* 🌍 Variables Globales de Diseño */
:root {
    --color-primario: #2563eb;    /* Azul moderno para botones principales */
    --color-primario-hover: #1d4ed8;
    --color-fondo: #f3f4f6;       /* Gris claro para el fondo */
    --color-tarjeta: #ffffff;     /* Blanco para los contenedores */
    --color-texto: #1f2937;       /* Gris oscuro para lectura cómoda */
    --color-texto-mutado: #6b7280;/* Gris suave para subtítulos */
    --color-error: #ef4444;       /* Rojo para alertas */
    --color-error-fondo: #fee2e2;
    --fuente: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 📱 Estilos Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--fuente);
}

body {
    background-color: var(--color-fondo);
    color: var(--color-texto);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* 📦 Tarjeta de Login */
.contenedor-login {
    background-color: var(--color-tarjeta);
    padding: 32px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

/* 🏷️ Encabezado */
.logo-app {
    background-color: var(--color-primario);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 14px;
    margin: 0 auto 12px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

.titulo-app {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitulo-app {
    text-align: center;
    color: var(--color-texto-mutado);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ⚠️ Alertas de Error */
.alerta-error {
    background-color: var(--color-error-fondo);
    border: 1px solid var(--color-error);
    color: var(--color-error);
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: 500;
}

/* 📝 Formulario Táctil */
.grupo-formulario {
    margin-bottom: 18px;
}

.etiqueta-formulario {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.control-formulario {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px; /* Evita que iOS haga zoom automático molesto */
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.control-formulario:focus {
    border-color: var(--color-primario);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 🚀 Botón Grande para el Dedo */
.boton-primario {
    width: 100%;
    background-color: var(--color-primario);
    color: white;
    border: none;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s, transform 0.1s;
}

.boton-primario:hover {
    background-color: var(--color-primario-hover);
}

.boton-primario:active {
    transform: scale(0.98); /* Efecto visual al presionarlo con el dedo */
}
/* 🧭 Estilos de la Barra de Navegación */
.navbar {
    background-color: var(--color-primario);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-marca {
    color: white;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 12px;
    align-items: center;
}

.navbar-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.navbar-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Enlace destacado para opciones exclusivas de Admin */
.navbar-link-admin {
    color: #fde047; /* Amarillo suave */
}
.navbar-link-admin:hover {
    background-color: rgba(253, 224, 71, 0.2);
    color: #fef08a;
}

.navbar-btn-salir {
    color: #fca5a5; /* Rojo suave */
}
.navbar-btn-salir:hover {
    background-color: rgba(252, 165, 165, 0.15);
    color: #fee2e2;
}

/* 💻 Contenedor de las Vistas Internas */
.contenedor-principal {
    width: 100%;
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 16px;
}

/* Estilo utilitario para cuando el cuerpo no deba centrar todo (vistas internas) */
.vista-interna {
    display: block;
    min-height: 100vh;
    padding: 0;
}
/* 📊 Contenedor de Tarjetas (Grid Adaptable para Celular/Tablet) */
.grid-reportes {
    display: grid;
    grid-template-columns: 1fr; /* Una columna en celulares */
    gap: 16px;
    margin-bottom: 24px;
}

/* Si la pantalla es más grande (como una Tablet), se divide en 3 columnas */
@media (min-width: 768px) {
    .grid-reportes {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Estilo Base de las Tarjetas */
.tarjeta-reporte {
    background-color: var(--color-tarjeta);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-left: 5px solid #d1d5db; /* Borde izquierdo por defecto */
}

/* Colores de Borde específicos para cada cuenta */
.tarjeta-verde { border-left-color: #10b981; }  /* Éxito / Total */
.tarjeta-azul { border-left-color: #3b82f6; }   /* Capital */
.tarjeta-naranja { border-left-color: #f97316; }/* Ganancia Interés */

.tarjeta-titulo {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-texto-mutado);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tarjeta-monto {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-texto);
}

/* 📋 Encabezado de Sección */
.seccion-titulo {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--color-texto);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* 📝 Diseño de Formularios en Bloque */
.tarjeta-formulario {
    background-color: var(--color-tarjeta);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.fila-formulario {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .fila-formulario {
        grid-template-columns: 1fr 1fr; /* Dos columnas en tablets */
    }
}

/* 📱 Tablas Responsivas (Scrolleables horizontalmente en móvil) */
.contenedor-tabla {
    background-color: var(--color-tarjeta);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow-x: auto; /* Permite deslizar con el dedo si la tabla es ancha */
    width: 100%;
}

.tabla-datos {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.tabla-datos th {
    background-color: #f9fafb;
    color: var(--color-texto-mutado);
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.tabla-datos td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    color: var(--color-texto);
    white-space: nowrap; /* Evita que el texto se rompa en varias líneas */
}

/* Etiquetas de Estado */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-activo {
    background-color: #d1fae5;
    color: #065f46;
}
/* 📱 Tarjetas de Clientes para el Cobrador */
.lista-clientes-movil {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.tarjeta-cliente-cobro {
    background-color: var(--color-tarjeta);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cliente-nombre {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-texto);
}

.cliente-detalles {
    font-size: 13px;
    color: var(--color-texto-mutado);
    line-height: 1.4;
}

.cliente-info-dinero {
    background-color: #f9fafb;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-top: 4px;
}

/* Botón de Cobro Táctil */
.boton-cobrar-tarjeta {
    background-color: #10b981; /* Verde éxito */
    color: white;
    text-align: center;
    text-decoration: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 6px;
    transition: background-color 0.2s;
}
.boton-cobrar-tarjeta:hover {
    background-color: #059669;
}
/* ℹ️ Tarjeta de Resumen Informativo */
.resumen-caja-pago {
    background-color: #eff6ff; /* Azul muy claro */
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}
/* 🪟 Estilos para el Modal de Confirmación Profesional */
.modal-capa {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Fondo oscuro transparente */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Clase utilitaria para activar el modal mediante JavaScript */
.modal-capa.mostrar {
    opacity: 1;
    pointer-events: auto;
}

.modal-tarjeta {
    background-color: var(--color-tarjeta);
    width: 100%;
    max-w: 360px;
    max-width: 360px;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.25s ease;
}

.modal-capa.mostrar .modal-tarjeta {
    transform: scale(1);
}

.modal-icono {
    font-size: 40px;
    margin-bottom: 12px;
}

.modal-titulo {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-texto);
    margin-bottom: 8px;
}

.modal-cuerpo {
    font-size: 15px;
    color: var(--color-texto-mutado);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-monto-destacado {
    font-size: 28px;
    font-weight: 800;
    color: #10b981; /* Verde éxito */
    margin: 12px 0;
    background-color: #f0fdf4;
    padding: 10px;
    border-radius: 10px;
    border: 1px dashed #bbf7d0;
}

/* Botonera dentro del modal */
.modal-botones {
    display: flex;
    gap: 12px;
}

.btn-modal {
    flex: 1;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-modal-confirmar {
    background-color: #10b981;
    color: white;
}
.btn-modal-confirmar:hover { background-color: #059669; }

.btn-modal-cancelar {
    background-color: #e5e7eb;
    color: #4b5563;
}
.btn-modal-cancelar:hover { background-color: #d1d5db; }

/* 🧾 Estilos para el Ticket Térmico de 58mm */
.caja-ticket {
    background-color: #fff;
    width: 100%;
    max-width: 280px; /* Tamaño ideal para simular papel de 58mm */
    margin: 20px auto;
    padding: 16px;
    border: 1px solid #d1d5db;
    font-family: 'Courier New', Courier, monospace; /* Tipografía clásica de ticket */
    font-size: 13px;
    color: #000;
}

.ticket-centrado {
    text-align: center;
    margin-bottom: 8px;
}

.ticket-linea {
    border-bottom: 1px dashed #000;
    margin: 8px 0;
}

.ticket-fila {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

/* 🖨️ Magia CSS: Cuando se imprima, SOLO saldrá el ticket en el papel */
@media print {
    body * {
        visibility: hidden;
    }
    .caja-ticket, .caja-ticket * {
        visibility: visible;
    }
    .caja-ticket {
        position: absolute;
        left: 0;
        top: 0;
        border: none;
        width: 100%;
    }
}
/* 🚨 Etiqueta de Alerta para Clientes Atrasados */
.badge-atrasado {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-top: 4px;
}
/* 🧭 Botones de Control para Paginación Móvil */
.contenedor-paginacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 10px 4px;
    font-size: 14px;
}

.btn-paginacion {
    background-color: var(--color-tarjeta);
    border: 1px solid #d1d5db;
    color: var(--color-texto);
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-paginacion:hover {
    background-color: #f3f4f6;
}

/* Estado deshabilitado para cuando no hay más páginas */
.btn-paginacion.bloqueado {
    color: #9ca3af;
    background-color: #f9fafb;
    pointer-events: none;
    border-color: #e5e7eb;
}
.btn-paginacion {
    background-color: var(--color-tarjeta);
    border: 1px solid #d1d5db;
    color: var(--color-texto);
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
    
    /* 🟢 NUEVO: Alineación interna perfecta para los iconos vectoriales */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* Deja solo esto al final de tu public/css/styles.css */
@media print {
    body * {
        visibility: hidden;
    }
    .caja-ticket, .caja-ticket * {
        visibility: visible;
    }
    .caja-ticket {
        position: absolute;
        left: 0;
        top: 0;
        border: none;
        width: 100%;
    }
}
/* ==========================================================================
   🖨️ CONTROL ESTRICTO DE IMPRESIÓN PARA MINI-IMPRESORAS (58MM)
   ========================================================================== */
@media print {
    /* 1. Escondemos menús, cabeceras y botones táctiles del celular */
    .navbar, 
    .navbar-menu, 
    .botonera-impresion, 
    .tarjeta-formulario,
    header, 
    footer {
        display: none !important;
    }

    /* 2. Forzamos a que la hoja del navegador adopte los 58mm fijos del rollo continuo */
    @page {
        size: 58mm auto; /* Ancho fijo de 58mm y alto automático según el largo del papel */
        margin: 0 !important; /* Quita los encabezados y pies de página grises del navegador */
    }

    body {
        background-color: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 58mm !important;
    }

    /* 3. Forzamos a que nuestra tira continua sea 100% visible en el papel térmico */
    .tira-continua-58mm {
        width: 58mm !important;
        max-width: 58mm !important;
        padding: 6px !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background-color: #ffffff !important;
        display: block !important;
        visibility: visible !important;
    }

    .tira-continua-58mm * {
        visibility: visible !important;
    }
}
/* 📱 BARRA DE NAVEGACIÓN INFERIOR PREMIUM PARA CELULARES */
.menu-inferior-movil {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: var(--color-tarjeta);
    border-top: 1px solid #e5e7eb;
    display: none; /* Se oculta en computadoras por defecto */
    justify-content: space-around;
    align-items: center;
    z-index: 999;
    box-shadow: 0 -4px 10px -1px rgba(0, 0, 0, 0.05), 0 -2px 4px -1px rgba(0, 0, 0, 0.03);
    padding-bottom: env(safe-area-inset-bottom); /* Soporte para el botón de inicio de iPhone */
}

/* Cada botón individual dentro de la barra */
.enlace-inferior {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-texto-mutado);
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
    flex: 1;
    height: 100%;
    transition: color 0.2s;
}

/* Estilo activo para cuando el cobrador está parado en esa pantalla */
.enlace-inferior.activo {
    color: var(--color-primario);
}

.enlace-inferior svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s;
}

.enlace-inferior:active svg {
    transform: scale(0.9); /* Efecto de rebote táctil al presionar con el dedo */
}

/* 📲 MAGIA RESPONSIVA: Ocultamos el menú viejo arriba y encendemos el nuevo abajo solo en smartphones */
@media (max-width: 768px) {
    /* Si es cobrador, escondemos la barra superior azul vieja */
    body.rol-cobrador .navbar {
        display: none !important;
    }
    
    /* Encendemos la barra de abajo */
    body.rol-cobrador .menu-inferior-movil {
        display: flex;
    }

    /* Le damos un margen inferior al contenedor principal para que las tarjetas no se tapen con el menú */
    body.rol-cobrador main,
    body.rol-cobrador .contenedor-principal {
        margin-bottom: 80px !important;
    }
}
/* 📱 BARRA LATERAL VERTICAL DESPLEGABLE */
.navbar-lateral {
    position: fixed;
    top: 0;
    left: -280px; /* Escondido por defecto a la izquierda */
    width: 280px;
    height: 100%;
    background-color: #005a66; /* El color verde azulado que tienes en tu captura */
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-sizing: border-box;
}

/* Clase utilitaria que inyectaremos con JS para mostrar el menú */
.navbar-lateral.abierto {
    left: 0;
}

/* Cabecera del Menú */
.navbar-lateral-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-lateral-titulo {
    color: #ffffff;
    font-size: 22px;
    font-weight: bold;
    margin: 0;
}

.btn-cerrar-menu {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
}

/* Enlaces Verticales */
.menu-lateral-enlaces {
    display: flex;
    flex-direction: column;
    margin-top: 15px;
}

.enlace-lateral {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s;
}

.enlace-lateral:hover, .enlace-lateral.activo {
    background-color: rgba(255, 255, 255, 0.1);
}

.enlace-lateral svg {
    width: 18px;
    height: 18px;
}

/* Capa oscura de fondo cuando el menú esté abierto */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.mostrar {
    display: block;
    opacity: 1;
}

/* 📲 REGLAS RESPONSIVAS: La barra lateral SOLO actúa en celulares */
@media (max-width: 768px) {
    .navbar {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }
    .navbar-menu {
        display: none !important; /* Esconde el menú horizontal amontonado */
    }
    .btn-hamburguesa {
        display: block !important;
    }
}

/* En computadoras escondemos el botón de tres rayas */
.btn-hamburguesa {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
}
