/* Reset y configuración básica */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0ea5e9;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --header-height: 70px;
    --sidebar-width: 260px;
    --footer-height: 60px;
}

body {
    font-family: 'Noto Sans', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f1f5f9;
    min-height: 100vh;
}

/* Página de login */
.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.login-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-header h1 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-header p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.login-form label i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-info {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.login-info small {
    color: var(--secondary-color);
}

.login-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.login-footer a.footer-link {
    color: white;
    text-decoration: none;
}

.login-footer a.footer-link:hover {
    text-decoration: underline;
}

/* Header */
.header {
    background: white;
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 1002;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: var(--light-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-info {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.user-menu {
    position: relative;
}

.user-button {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: var(--dark-color);
}

.user-button:hover {
    background-color: var(--light-color);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
    z-index: 1003;
}

.user-dropdown.show {
    display: block;
}

.user-info {
    padding: 1rem;
    text-align: center;
}

.user-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.user-info small {
    color: var(--secondary-color);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--light-color);
}

/* Sidebar */
.sidebar {
    background: white;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    position: fixed;
    top: var(--header-height);
    left: 0;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
}

.nav-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Container y contenido principal */
.container {
    display: flex;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    margin-top: var(--header-height);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header p {
    color: var(--secondary-color);
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background-color: #fecaca;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-info {
    background-color: #dbeafe;
    color: #0ea5e9;
    border: 1px solid #bfdbfe;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-1px);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #c2410c;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-group .btn {
    margin: 0 1px;
}

/* Tooltips para botones */
.btn-tooltip {
    position: relative;
}

.btn-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    margin-bottom: 5px;
}

.btn-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.btn-tooltip:hover::after,
.btn-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-color);
}

.card-header h3 {
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon.bg-blue { background-color: var(--primary-color); }
.stat-icon.bg-green { background-color: var(--success-color); }
.stat-icon.bg-orange { background-color: var(--warning-color); }
.stat-icon.bg-purple { background-color: #8b5cf6; }
.stat-icon.bg-teal { background-color: #0d9488; }
.stat-icon.bg-red { background-color: var(--danger-color); }

.stat-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--secondary-color);
    font-size: 0.875rem;
    margin: 0;
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:invalid {
    border-color: var(--danger-color);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Estilos especiales para formularios */
.form-check:has(#perm_eliminar_pagos:checked) {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
    margin: -1.5rem;
    padding: 1.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
}

.table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-striped tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-align: center;
    white-space: nowrap;
}

.badge-primary { background-color: var(--primary-color); color: white; }
.badge-success { background-color: var(--success-color); color: white; }
.badge-danger { background-color: var(--danger-color); color: white; }
.badge-warning { background-color: var(--warning-color); color: white; }
.badge-info { background-color: var(--info-color); color: white; }
.badge-secondary { background-color: var(--secondary-color); color: white; }

.badge-lg {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border-color);
    height: var(--footer-height);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
}

.modal-close:hover {
    background-color: var(--light-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Estilos para el sistema de cuotas */
.calculo-deuda-moderna {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #dee2e6;
    animation: fadeIn 0.3s ease-in;
}

.saldo-total-destacado .card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.saldo-total-destacado h5 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.saldo-total-destacado h3 {
    font-size: 1.5rem;
    font-weight: bold;
}

.desglose-montos {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
}

.estado-general .alert {
    border: none;
    font-size: 0.9rem;
}

.estado-general .alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.estado-general .alert-success {
    background-color: #d4edda;
    color: #155724;
}

/* Estados de cuotas */
.cuota-vencida {
    background-color: #f8d7da !important;
    border-left: 4px solid #dc3545 !important;
}

.cuota-pendiente {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
}

.cuota-pagada {
    background-color: #d4edda !important;
    border-left: 4px solid #28a745 !important;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utilidades */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--secondary-color); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* Responsive */
@media (max-width: 768px) {
    /* Sidebar móvil mejorado */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Botón hamburguesa móvil específico */
    .sidebar-toggle {
        z-index: 1003 !important;
        background-color: rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(4px);
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.2s ease;
    }
    
    .sidebar-toggle:active {
        transform: scale(0.95);
        background-color: var(--primary-color) !important;
        color: white !important;
    }
    
    /* Overlay para cerrar sidebar en móvil */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar.show ~ .sidebar-overlay,
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
    
    /* Main content móvil */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        overflow-x: hidden;
    }
    
    /* Prevenir scroll horizontal en móvil */
    body {
        overflow-x: hidden;
    }
    
    .container {
        overflow-x: hidden;
    }
    
    /* Grids responsivos */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Footer móvil */
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* Tablas responsivas mejoradas */
    .table-responsive {
        margin: -1rem;
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* User dropdown móvil */
    .user-dropdown {
        z-index: 1002;
    }
    
    /* Ocultar información del header en móvil */
    .header-info {
        display: none;
    }
    
    /* Cuotas responsive */
    .calculo-deuda-moderna {
        padding: 0.75rem;
    }
    
    .saldo-total-destacado h3 {
        font-size: 1.25rem;
    }
    
    .desglose-montos {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }
    
    .login-card {
        padding: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .card-body,
    .card-header {
        padding: 1rem;
    }
}

/* Mejoras para touch devices */
@media (hover: none) and (pointer: coarse) {
    .sidebar-toggle {
        min-width: 48px !important;
        min-height: 48px !important;
        padding: 0.75rem !important;
    }
    
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
    }
}

/* Print styles */
@media print {
    .header,
    .sidebar,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .container {
        margin-top: 0 !important;
    }
    
    body {
        background: white !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}










