
/* Estilos completos de la aplicación Paga Diario Pro */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: #f3f4f6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 12px;
}

#app {
    max-width: 400px;
    width: 100%;
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Pantallas */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Pantalla de Inicio */
.inicio-screen {
    text-align: center;
}

.inicio-screen h1 {
    font-size: 32px;
    color: #1f2937;
    margin-bottom: 8px;
}

.inicio-screen .subtitle {
    color: #6b7280;
    margin-bottom: 20px;
    font-size: 16px;
}

.opcion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.opcion-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.opcion-card:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.opcion-card .icono {
    font-size: 48px;
    margin-bottom: 12px;
}

.opcion-card h3 {
    font-size: 18px;
    color: #1f2937;
    margin-bottom: 4px;
}

.opcion-card p {
    font-size: 14px;
    color: #6b7280;
}

/* Login Screen */
.login-screen {
    text-align: center;
}

.login-screen h1 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 8px;
}

.login-screen .subtitle {
    color: #6b7280;
    margin-bottom: 32px;
    font-size: 16px;
}

.input-group {
    margin-bottom: 16px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    background: #f9fafb;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-secondary {
    background: transparent;
    color: #3b82f6;
    border: 1.5px solid #3b82f6;
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
    width: auto;
    margin: 0;
}

/* Header Admin */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.header h2 {
    font-size: 20px;
    color: #1f2937;
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-email {
    color: #6b7280;
    font-size: 14px;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 20px;
}

.btn-logout {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.btn-volver-inicio {
    background: #6b7280;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 16px;
}

/* Tabs Admin */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    overflow-x: auto;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
}

.tab.active {
    background: #3b82f6;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

.resumen-card {
    background: #f8fafc;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.resumen-card .label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.resumen-card .value {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.buscador {
    position: relative;
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.buscador input {
    flex: 1;
    padding: 14px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    background: #f9fafb;
}

.btn-scanner {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    width: 52px;
    height: 52px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resultados-busqueda {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.resultado-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.resultado-item:hover {
    background: #f9fafb;
}

.resultado-item .nombre {
    font-weight: 600;
    color: #1f2937;
}

.resultado-item .detalle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.acciones-rapidas {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn-accion {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
}

.btn-verde {
    background: #10b981;
    color: white;
}

.btn-azul {
    background: #3b82f6;
    color: white;
}

.btn-naranja {
    background: #f59e0b;
    color: white;
}

/* Lista de Clientes */
.lista-clientes {
    max-height: 500px;
    overflow-y: auto;
}

.cliente-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
}

.cliente-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cliente-nombre {
    font-weight: 600;
    font-size: 16px;
    color: #1f2937;
}

.cliente-estado {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    background: #10b981;
    color: white;
}

.cliente-estado.inactivo {
    background: #6b7280;
}

.cliente-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
}

/* Pendientes */
.lista-pendientes h3 {
    font-size: 16px;
    color: #374151;
    margin-bottom: 12px;
}

.cliente-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.cliente-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cliente-nombre {
    font-weight: 600;
    font-size: 16px;
    color: #1f2937;
}

.tipo-prestamo {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    background: #f59e0b;
    color: white;
    margin-left: 8px;
}

.tipo-prestamo.diario {
    background: #3b82f6;
}

.cliente-monto {
    font-weight: 700;
    color: #059669;
}

.cliente-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

.btn-pagar {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

/* Formularios */
.formulario {
    display: none;
}

.formulario.active {
    display: block;
}

.form-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.btn-volver {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}

.form-titulo {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.seccion-prestamo {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    border: 1px solid #e5e7eb;
}

.seccion-prestamo h4 {
    margin-bottom: 16px;
    color: #1f2937;
    font-size: 16px;
}

/* Perfil Cliente */
.perfil-cliente {
    display: none;
}

.perfil-cliente.active {
    display: block;
}

.info-cliente {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    position: relative;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.btn-qr {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 8px 12px;
    border-radius: 30px;
}

.switch-label {
    font-size: 14px;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 4px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #f59e0b;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.info-row {
    display: flex;
    margin-bottom: 8px;
}

.info-label {
    width: 80px;
    color: #6b7280;
    font-size: 14px;
}

.info-value {
    color: #1f2937;
    font-weight: 500;
    font-size: 14px;
}

/* Tarjeta de Consulta Pública */
.consulta-container {
    padding: 16px 0;
}

.consulta-header {
    text-align: center;
    margin-bottom: 24px;
}

.consulta-header h2 {
    font-size: 24px;
    color: #1f2937;
    margin-bottom: 8px;
}

.consulta-header p {
    color: #6b7280;
    font-size: 14px;
}

.qr-cliente {
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.qr-cliente canvas {
    margin: 10px auto;
    width: 200px;
    height: 200px;
}

.qr-acciones {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.qr-acciones button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

.progreso-container {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.progreso-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.progreso-label {
    color: #6b7280;
    font-size: 14px;
}

.progreso-value {
    font-weight: 600;
    color: #1f2937;
}

.progreso-barra {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
    margin: 12px 0;
}

.progreso-lleno {
    height: 100%;
    background: #10b981;
    width: 0%;
}

.historial-lista {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.historial-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.prestamo-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.progreso-prestamo {
    margin: 16px 0;
}

.barra-progreso {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progreso {
    height: 100%;
    background: #10b981;
    width: 0%;
}

.historial-pagos {
    list-style: none;
}

.acciones-cliente {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.config-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.config-section h4 {
    margin-bottom: 12px;
    color: #1f2937;
}

.config-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.config-select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Toast de notificaciones */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 20px 30px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    min-width: 300px;
    text-align: center;
    border: 2px solid #3b82f6;
}

.toast.show {
    display: block;
    animation: slideUp 0.3s ease;
}

.toast.success {
    background: #10b981;
    border-color: #059669;
}

.toast.error {
    background: #ef4444;
    border-color: #dc2626;
}

.toast.info {
    background: #3b82f6;
    border-color: #2563eb;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.total-general {
    background: #3b82f6;
    color: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.backup-info {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    text-align: center;
}

.resumen-profesional {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.resumen-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.resumen-header h3 {
    font-size: 24px;
    color: #1f2937;
    margin-bottom: 8px;
}

.resumen-header .fecha {
    color: #6b7280;
    font-size: 14px;
}

.resumen-tabla {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.resumen-tabla th {
    background: #f3f4f6;
    padding: 12px;
    text-align: left;
    font-size: 14px;
    color: #374151;
}

.resumen-tabla td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.resumen-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
    text-align: right;
}

.resumen-footer .gran-total {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

/* Modal QR */
.modal-qr {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-qr.active {
    display: flex;
}

.modal-contenido {
    background: white;
    border-radius: 24px;
    padding: 24px;
    width: 300px;
    text-align: center;
}

.modal-contenido h3 {
    margin-bottom: 16px;
    color: #1f2937;
}

#qrCanvas {
    margin: 16px auto;
    width: 200px;
    height: 200px;
}

.modal-botones {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.modal-botones button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

.btn-cerrar {
    background: #6b7280;
    color: white;
}

/* Escáner QR */
.scanner-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: black;
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scanner-modal.active {
    display: flex;
}

#qr-reader {
    width: 100%;
    max-width: 400px;
    height: auto;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}

#qr-reader video {
    width: 100%;
    height: auto;
    object-fit: cover;
}

#qr-reader__dashboard_section_csr span {
    color: white !important;
}

#qr-reader__dashboard_section_csr button {
    background: #3b82f6 !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    margin: 10px !important;
    cursor: pointer !important;
}

.btn-cerrar-scanner {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 30px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.offline-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ef4444;
    color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 20px;
    z-index: 3000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 2px solid white;
    display: none;
}

.offline-message.show {
    display: block;
}

/* Indicador de escaneo */
.scan-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    border-radius: 50px;
    font-size: 24px;
    z-index: 2002;
    display: none;
    align-items: center;
    gap: 10px;
}

.scan-animation.show {
    display: flex;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Validación de formularios */
.validation-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.error-message {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

/* PDF Spinner */
.pdf-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 4000;
    align-items: center;
    gap: 10px;
}

.pdf-spinner.show {
    display: flex;
}