/* ============================================
   Sistema de Préstamos Pro - Estilos Responsivos Completos
   Optimizado para Móvil y PC
   ============================================ */

/* Variables CSS */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 56px;
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #17a2b8;
    --font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset y Base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: #f4f6f9;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

body.login-body {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body.login-body main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
}

.login-card .card-body {
    padding: 2.5rem;
}

@media (max-width: 575.98px) {
    .login-card .card-body {
        padding: 1.5rem;
    }
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    z-index: 1040;
    transition: all 0.3s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar .sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.15rem 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

#sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.1);
    transform: translateX(3px);
}

#sidebar .nav-link.active {
    color: #fff;
    background-color: var(--secondary-color);
}

#sidebar .nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    text-align: center;
}

/* Sidebar Scrollbar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

main.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease-in-out;
    padding: 1.5rem;
}

/* ============================================
   MOBILE NAVBAR
   ============================================ */

.mobile-navbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #212529;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-navbar .navbar-brand {
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-navbar .navbar-toggler {
    padding: 0.5rem;
    font-size: 1.25rem;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 0.375rem;
    cursor: pointer;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
}

/* Card Box - Estilo mejorado */
.card-box {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-header {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
    padding: 1rem 1.25rem;
    background-color: #fff;
}

/* ============================================
   PAGE HEADER - Header de Página Responsive
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header h2 {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }
    
    .page-header-actions {
        justify-content: flex-end;
    }
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background-color: #fafafa;
    padding: 0.75rem 1.25rem;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card.primary { border-left-color: var(--primary-color); }
.stat-card.success { border-left-color: var(--success-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.danger { border-left-color: var(--danger-color); }
.stat-card.info { border-left-color: var(--info-color); }

/* Dashboard Cards */
.stat-card .card-body {
    padding: 1rem;
}

.stat-card h6 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.stat-card h3, .stat-card h4, .stat-card h5 {
    margin-bottom: 0;
    font-weight: 700;
}

/* ============================================
   TABLES
   ============================================ */

.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Table Responsive Custom */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-group-sm > .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-control,
.form-select {
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    border: 1px solid #dee2e6;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: #495057;
}

.input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    background-color: #f8f9fa;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.page-link {
    color: var(--primary-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
}

.page-item.active .page-link {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}

.alert-dismissible .btn-close {
    padding: 1.1rem;
}

/* ============================================
   AVATARS
   ============================================ */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

.avatar-xl {
    width: 120px;
    height: 120px;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .card-body {
    padding: 2.5rem;
}

@media (max-width: 575.98px) {
    .login-card .card-body {
        padding: 1.5rem;
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

/* ============================================
   PROGRESS
   ============================================ */

.progress {
    height: 0.5rem;
    border-radius: 0.25rem;
    background-color: #e9ecef;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    gap: 1rem;
}

.page-header h1,
.page-header .h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    font-weight: 600;
}

/* ============================================
   CHARTS
   ============================================ */

.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================
   STATUS INDICATORS
   ============================================ */

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-indicator.online { background-color: var(--success-color); }
.status-indicator.offline { background-color: #6c757d; }
.status-indicator.warning { background-color: var(--warning-color); }
.status-indicator.danger { background-color: var(--danger-color); }

/* ============================================
   ANIMATIONS
   ============================================ */

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet Landscape (992px - 1199px) */
@media (max-width: 1199.98px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    .stat-card h5 {
        font-size: 1rem;
    }
}

/* Tablet Portrait (768px - 991px) */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        top: 0;
        height: 100%;
        z-index: 1045;
    }
    
    #sidebar.show {
        left: 0;
    }
    
    .mobile-navbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    main.main-content {
        margin-left: 0;
        width: 100%;
        padding-top: calc(var(--header-height) + 1rem);
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Chart container */
    .chart-container {
        height: 250px;
    }
}

/* Mobile (576px - 767px) */
@media (max-width: 767.98px) {
    main.main-content {
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
    }
    
    .stat-card .card-body {
        padding: 0.75rem;
    }
    
    .stat-card h6 {
        font-size: 0.65rem;
    }
    
    .stat-card h3 {
        font-size: 1.25rem;
    }
    
    .stat-card h4, .stat-card h5 {
        font-size: 0.9rem;
    }
    
    .stat-card i {
        font-size: 1.5rem !important;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Table adjustments */
    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Button group in tables */
    .table .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table .btn-group .btn {
        width: 100%;
        border-radius: 0.25rem !important;
    }
    
    /* Form adjustments */
    .row.g-3 > [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Button groups responsive */
    .btn-group-responsive {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .btn-group-responsive .btn {
        width: 100%;
    }
    
    /* Page header */
    .page-header,
    .d-flex.justify-content-between.flex-wrap {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    .page-header h1,
    .page-header .h2,
    .h2 {
        font-size: 1.25rem;
    }
    
    .page-header .btn,
    .page-header .btn-group {
        width: 100%;
    }
    
    .page-header .btn-group .btn {
        flex: 1;
    }
    
    /* Chart container */
    .chart-container {
        height: 200px;
    }
}

/* Small Mobile (< 576px) */
@media (max-width: 575.98px) {
    main.main-content {
        padding: 0.75rem;
        padding-top: calc(var(--header-height) + 0.75rem);
    }
    
    .card {
        border-radius: 0.5rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .page-header h1,
    .page-header .h2,
    .h2 {
        font-size: 1.15rem;
    }
    
    /* Dashboard stats grid */
    .row.g-3 .col-6 {
        padding: 0.25rem;
    }
    
    .stat-card .card-body {
        padding: 0.65rem;
    }
    
    .stat-card h6 {
        font-size: 0.55rem;
        margin-bottom: 0.15rem;
    }
    
    .stat-card h3 {
        font-size: 1rem;
    }
    
    .stat-card h4, .stat-card h5 {
        font-size: 0.75rem;
    }
    
    .stat-card i {
        font-size: 1.1rem !important;
    }
    
    .stat-card small {
        font-size: 0.6rem;
    }
    
    /* Form elements */
    .form-control,
    .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.85rem;
    }
    
    /* Search forms */
    .card .row.g-3 {
        gap: 0.5rem;
    }
    
    /* Pagination */
    .page-link {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.3em 0.5em;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Empty state */
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state i {
        font-size: 3rem;
    }
    
    /* Table hide columns */
    .table .hide-mobile {
        display: none !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    #sidebar,
    .mobile-navbar,
    .sidebar-overlay,
    .btn,
    .pagination,
    .alert,
    form,
    .no-print {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .table th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide on mobile */
@media (max-width: 767.98px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
@media (max-width: 991.98px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Show only on mobile */
@media (min-width: 768px) {
    .show-mobile-only {
        display: none !important;
    }
}

/* Touch-friendly sizes */
@media (max-width: 767.98px) {
    .btn-touch {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control-touch,
    .form-select-touch {
        min-height: 44px;
    }
}

/* ============================================
   SIDEBAR USER SECTION
   ============================================ */

#sidebar .user-section {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

#sidebar .user-info {
    display: flex;
    align-items: center;
    color: #fff;
    margin-bottom: 0.75rem;
}

#sidebar .user-info i {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

/* ============================================
   SIDEBAR HEADING
   ============================================ */

.sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5) !important;
    padding: 0.5rem 1rem;
}

/* ============================================
   FILTER CARDS
   ============================================ */

.filter-card .card-body {
    padding: 1rem;
}

@media (max-width: 575.98px) {
    .filter-card .row {
        flex-direction: column;
    }
    
    .filter-card .col-md-4,
    .filter-card .col-md-5,
    .filter-card .col-md-3,
    .filter-card .col-md-8 {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .filter-card .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ============================================
   ACTION BUTTONS IN CARDS
   ============================================ */

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 575.98px) {
    .action-buttons {
        width: 100%;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }
}

/* ============================================
   CRONOGRAMA TABLE
   ============================================ */

.cronograma-table {
    font-size: 0.85rem;
}

@media (max-width: 767.98px) {
    .cronograma-table {
        font-size: 0.75rem;
    }
    
    .cronograma-table th,
    .cronograma-table td {
        padding: 0.4rem 0.5rem;
    }
}

/* ============================================
   CLIENT PROFILE
   ============================================ */

.client-profile .avatar-xl {
    width: 100px;
    height: 100px;
}

@media (max-width: 575.98px) {
    .client-profile .avatar-xl {
        width: 80px;
        height: 80px;
    }
    
    .client-profile h4 {
        font-size: 1.1rem;
    }
}

/* ============================================
   DASHBOARD SPECIFIC STYLES
   ============================================ */

.dashboard-row {
    margin-bottom: 1.5rem;
}

@media (max-width: 767.98px) {
    .dashboard-row {
        margin-bottom: 1rem;
    }
}

/* Quick Stats Cards */
.quick-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-stat .stat-info {
    flex: 1;
}

.quick-stat .stat-icon {
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .quick-stat .stat-icon i {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   MOBILE-FIRST IMPROVEMENTS
   ============================================ */

/* Touch-friendly tap targets */
@media (max-width: 767.98px) {
    /* Minimum tap target size (44px) */
    .btn, 
    .nav-link,
    .page-link,
    .form-control,
    .form-select,
    .dropdown-item {
        min-height: 44px;
    }
    
    /* Better spacing for touch */
    .btn {
        padding: 0.6rem 1rem;
    }
    
    /* Floating Action Button */
    .fab {
        position: fixed;
        bottom: calc(20px + var(--safe-area-inset-bottom));
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        z-index: 1000;
        font-size: 1.5rem;
    }
    
    .fab:hover {
        transform: scale(1.1);
    }
}

/* ============================================
   MOBILE TABLE CARDS
   ============================================ */

@media (max-width: 767.98px) {
    /* Transform table to cards on mobile */
    .table-mobile-cards thead {
        display: none;
    }
    
    .table-mobile-cards tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
        padding-top: 12px;
    }
    
    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 0.8rem;
        text-transform: uppercase;
    }
    
    .table-mobile-cards .actions-cell {
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .table-mobile-cards .actions-cell::before {
        display: none;
    }
}

/* ============================================
   MOBILE FORM IMPROVEMENTS
   ============================================ */

@media (max-width: 767.98px) {
    /* Stack form columns */
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4,
    .row.g-3 > .col-md-6,
    .row.g-4 > .col-md-3,
    .row.g-4 > .col-md-4,
    .row.g-4 > .col-md-6 {
        margin-bottom: 0.75rem;
    }
    
    /* Better form labels */
    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    /* Input groups */
    .input-group {
        flex-wrap: nowrap;
    }
    
    .input-group .form-control {
        min-height: 44px;
    }
    
    /* Textarea */
    textarea.form-control {
        min-height: 100px;
    }
}

/* ============================================
   MOBILE SEARCH BAR
   ============================================ */

@media (max-width: 767.98px) {
    .search-form .row {
        gap: 0.5rem;
    }
    
    .search-form .input-group {
        width: 100%;
    }
    
    .search-form .btn {
        flex: 1;
    }
}

/* ============================================
   MOBILE MODAL IMPROVEMENTS
   ============================================ */

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }
    
    .modal-content {
        border-radius: 0;
        min-height: 100vh;
        border: none;
    }
    
    .modal-header {
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 10;
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        padding-bottom: calc(1rem + var(--safe-area-inset-bottom));
    }
    
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 1rem;
        padding-bottom: calc(1rem + var(--safe-area-inset-bottom));
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        flex: 1;
    }
    
    /* Non-fullscreen modals */
    .modal-dialog.modal-dialog-centered {
        min-height: auto;
        margin: 1rem;
    }
    
    .modal-dialog.modal-dialog-centered .modal-content {
        min-height: auto;
        border-radius: 1rem;
    }
}

/* ============================================
   MOBILE CARD IMPROVEMENTS
   ============================================ */

@media (max-width: 575.98px) {
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .card-header {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-footer {
        padding: 0.875rem 1rem;
    }
}

/* ============================================
   MOBILE STAT CARDS
   ============================================ */

@media (max-width: 575.98px) {
    .stat-card .card-body {
        padding: 0.75rem;
    }
    
    .stat-card h6 {
        font-size: 0.65rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }
    
    .stat-card h3,
    .stat-card h4,
    .stat-card h5 {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .stat-card i {
        font-size: 1.25rem !important;
    }
    
    /* 2-column grid for stats */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stats-grid .col-6,
    .stats-grid .col-md-4,
    .stats-grid .col-xl-2 {
        width: 100%;
        padding: 0;
    }
}

/* ============================================
   MOBILE NAVIGATION IMPROVEMENTS
   ============================================ */

.mobile-navbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: linear-gradient(135deg, #212529 0%, #343a40 100%);
    padding: 0;
    height: var(--header-height);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-navbar .navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
}

.mobile-navbar .navbar-brand {
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.mobile-navbar .navbar-toggler {
    padding: 0.5rem;
    font-size: 1.5rem;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-navbar .navbar-toggler:hover,
.mobile-navbar .navbar-toggler:active {
    background: rgba(255,255,255,0.1);
}

@media (max-width: 991.98px) {
    .mobile-navbar {
        display: block;
    }
}

/* ============================================
   MOBILE SIDEBAR
   ============================================ */

@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        height: 100vh;
        width: 280px;
        z-index: 1055;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #sidebar.show {
        transform: translateX(0);
    }
    
    #sidebar .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    #sidebar .sidebar-close {
        color: #fff;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }
    
    #sidebar .sidebar-close:hover {
        background: rgba(255,255,255,0.1);
    }
    
    #sidebar .nav-link {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    #sidebar .nav-link i {
        font-size: 1.25rem;
        width: 28px;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1045;
        opacity: 0;
        transition: opacity 0.3s ease;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    main.main-content {
        margin-left: 0;
        padding-top: calc(var(--header-height) + 1rem);
    }
}

/* ============================================
   MOBILE PAGINATION
   ============================================ */

@media (max-width: 575.98px) {
    .pagination {
        justify-content: center;
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        border-radius: 8px !important;
        min-width: 40px;
        text-align: center;
    }
    
    .page-item:first-child .page-link,
    .page-item:last-child .page-link {
        border-radius: 8px !important;
    }
}

/* ============================================
   MOBILE BUTTONS
   ============================================ */

@media (max-width: 575.98px) {
    /* Button group horizontal scroll */
    .btn-group-scroll {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .btn-group-scroll .btn {
        flex-shrink: 0;
    }
    
    .btn-group-scroll::-webkit-scrollbar {
        height: 4px;
    }
    
    /* Stack buttons vertically */
    .btn-stack {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-stack .btn {
        width: 100%;
    }
    
    /* Action buttons in cards/tables */
    .btn-group-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn-group-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }
}

/* ============================================
   MOBILE ALERTS
   ============================================ */

@media (max-width: 575.98px) {
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        border-radius: 10px;
        margin-bottom: 1rem;
    }
    
    .alert-dismissible {
        padding-right: 3rem;
    }
    
    .alert-dismissible .btn-close {
        padding: 1rem;
    }
}

/* ============================================
   MOBILE PROFILE PAGE
   ============================================ */

@media (max-width: 575.98px) {
    .profile-header {
        text-align: center;
    }
    
    .profile-header .avatar-xl {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    .profile-header h4 {
        font-size: 1.1rem;
    }
    
    .profile-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* ============================================
   MOBILE CHARTS
   ============================================ */

@media (max-width: 575.98px) {
    .chart-container {
        height: 200px;
        margin: 0 -0.5rem;
    }
}

/* ============================================
   SWIPE HINT ANIMATION
   ============================================ */

@media (max-width: 767.98px) {
    .table-responsive::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    .table-responsive.has-scroll::after {
        opacity: 1;
    }
}

/* ============================================
   BOTTOM SAFE AREA (iOS)
   ============================================ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    main.main-content {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    .fab {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   PULL TO REFRESH INDICATOR
   ============================================ */

.pull-indicator {
    position: fixed;
    top: var(--header-height);
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--secondary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 10px 10px;
    font-size: 0.85rem;
    z-index: 100;
    transition: transform 0.3s;
}

.pull-indicator.show {
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   EMPTY STATE MOBILE
   ============================================ */

@media (max-width: 575.98px) {
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state i {
        font-size: 3rem;
    }
    
    .empty-state h5 {
        font-size: 1rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }
}

/* ============================================
   QUICK ACTIONS MOBILE
   ============================================ */

@media (max-width: 767.98px) {
    .quick-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .quick-action-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 1rem;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 12px;
        text-decoration: none;
        color: #333;
        transition: all 0.2s;
    }
    
    .quick-action-btn:hover,
    .quick-action-btn:active {
        background: #f8f9fa;
        transform: scale(0.98);
    }
    
    .quick-action-btn i {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .quick-action-btn span {
        font-size: 0.8rem;
        font-weight: 500;
    }
}

/* ============================================
   LANDSCAPE MOBILE FIXES
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        min-height: auto;
    }
    
    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    #sidebar {
        padding-top: 0;
        padding-bottom: 1rem;
    }
}

/* ============================================
   DARK MODE SUPPORT (Future)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Preparado para dark mode futuro */
}

/* ============================================
   ACTION BUTTONS - Botones de acciones mejorados
   ============================================ */

/* Nuevo diseño de botones de acción */
.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-action:hover::before {
    opacity: 1;
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-action:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

/* Botón Ver - Azul */
.btn-action-view {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-action-view:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Botón Editar - Amarillo/Naranja */
.btn-action-edit {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-action-edit:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* Botón Eliminar - Rojo */
.btn-action-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-action-delete:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Botón WhatsApp */
.btn-action-whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
}

.btn-action-whatsapp:hover {
    background: linear-gradient(135deg, #34eb7a 0%, #25D366 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* Botón Cronograma/Calendario - Púrpura */
.btn-action-calendar {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.btn-action-calendar:hover {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* Botón PDF - Rojo oscuro */
.btn-action-pdf {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
}

.btn-action-pdf:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

/* Botón Pagar - Verde */
.btn-action-pay {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-action-pay:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Botón Cartilla - Verde esmeralda */
.btn-action-cartilla {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
}

.btn-action-cartilla:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

/* Botón secundario/neutro */
.btn-action-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-action-secondary:hover {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

/* Tamaño pequeño */
.btn-action-sm {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Botón WhatsApp circular pequeño (para junto al teléfono) */
.btn-whatsapp-mini {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-whatsapp-mini:hover {
    transform: scale(1.15);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.5);
}

/* Grupo de botones de acciones */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: nowrap;
}

/* Badge para DNI mejorado */
.badge-dni {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.35em 0.65em;
}

