/* ===== SISTEMA DE GESTIÓN - DISEÑO MODERNO AZUL Y BLANCO - RESPONSIVE MEJORADO ===== */

/* ===== VARIABLES CSS ===== */
:root {
    /* Colores principales - Azul moderno */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --primary-lighter: #60a5fa;
    
    /* Colores de acento */
    --accent-color: #0ea5e9;
    --accent-dark: #0284c7;
    
    /* Colores de estado */
    --success-color: #10b981;
    --success-dark: #059669;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --warning-color: #f59e0b;
    --warning-dark: #d97706;
    --info-color: #06b6d4;
    --info-dark: #0891b2;
    
    /* Colores neutros */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Sombras */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Sombras de color */
    --shadow-primary: 0 10px 15px -3px rgba(37, 99, 235, 0.2);
    --shadow-success: 0 10px 15px -3px rgba(16, 185, 129, 0.2);
    --shadow-danger: 0 10px 15px -3px rgba(239, 68, 68, 0.2);
    
    /* Radios de borde */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transiciones */
    --transition-fast: all 0.15s ease;
    --transition-base: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

/* ===== FUENTES ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--gray-50);
    color: var(--gray-900);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ===== NAVBAR MODERNA ===== */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    border-bottom: 3px solid var(--primary-dark);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.navbar-text {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
}

/* ===== TARJETAS DE ESTADÍSTICAS ===== */
.stats-container {
    margin-bottom: 2rem;
}

.card-stats {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    overflow: hidden;
    position: relative;
    background: white;
}

.card-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.card-stats:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-stats.total::before {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.card-stats.activos::before {
    background: linear-gradient(90deg, var(--success-color), var(--success-dark));
}

.card-stats.bloqueados::before {
    background: linear-gradient(90deg, var(--danger-color), var(--danger-dark));
}

.card-stats.vencimiento::before {
    background: linear-gradient(90deg, var(--warning-color), var(--warning-dark));
}

.card-stats .card-body {
    padding: 1.5rem;
}

.card-stats .card-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-stats .card-category {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-stats .icon-big {
    color: var(--primary-color);
    opacity: 0.15;
}

/* ===== FILTROS MODERNOS ===== */
.filters-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.filters-section h6 {
    color: var(--gray-700);
    font-weight: 600;
    margin: 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0.25rem;
    transition: var(--transition-fast);
    cursor: pointer;
    border: 2px solid transparent;
    white-space: nowrap;
}

.filter-chip:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
    border-color: var(--primary-dark);
}

.filter-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-primary);
}

.filter-chip.danger {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-dark);
}

.filter-chip.danger:hover {
    background: var(--danger-dark);
    box-shadow: var(--shadow-danger);
}

.filter-chip.warning {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-dark);
}

.filter-chip i {
    font-size: 0.75rem;
}

/* ===== SECCIÓN DE BÚSQUEDA ===== */
.search-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.search-section h5 {
    color: var(--gray-800);
    font-weight: 600;
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
}

/* ===== TARJETAS ===== */
.card {
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: white;
}

.card-header {
    background: white;
    border-bottom: 2px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

.card-header h5 {
    color: var(--gray-800);
    margin: 0;
    font-weight: 600;
    font-size: 1.125rem;
}

/* ===== TABLA MODERNA - MEJORA RESPONSIVE ===== */
.table-responsive {
    border-radius: var(--radius-lg);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    /* Forzar scrollbar visible en móviles */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--gray-200);
}

/* Asegurar que la tabla tenga scroll horizontal en móviles */
.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: var(--radius-sm);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-sm);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.table {
    margin-bottom: 0;
    min-width: 100%;
    width: 100%;
}

.table thead th {
    background: var(--gray-800);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
}

.table thead th.sortable:hover {
    background: var(--gray-700);
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.875rem;
    white-space: nowrap;
}

.table tbody tr {
    animation: fadeInRow 0.3s ease-in-out backwards;
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== BADGES MODERNOS ===== */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.bg-secondary {
    background-color: var(--gray-400) !important;
}

.bg-light {
    background-color: var(--gray-100) !important;
    color: var(--gray-700) !important;
    border: 1px solid var(--gray-300);
}

/* ===== BOTONES MODERNOS ===== */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition-fast);
    border: none;
    font-size: 0.875rem;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
    color: white;
}

.btn-secondary {
    background-color: var(--gray-600);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--gray-700);
    transform: translateY(-2px);
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: var(--info-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-outline-success {
    color: var(--success-color);
    border: 1.5px solid var(--success-color);
}

.btn-outline-success:hover {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-outline-danger {
    color: var(--danger-color);
    border: 1.5px solid var(--danger-color);
}

.btn-outline-danger:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.btn-outline-info {
    color: var(--info-color);
    border: 1.5px solid var(--info-color);
}

.btn-outline-info:hover {
    background-color: var(--info-color);
    border-color: var(--info-color);
    color: white;
}

.btn-outline-warning {
    color: var(--warning-color);
    border: 1.5px solid var(--warning-color);
}

.btn-outline-warning:hover {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.btn-outline-light {
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
    color: white;
}

.btn-group .btn {
    margin: 0;
    padding: 0.375rem 0.75rem;
}

.btn-group-sm .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ===== FORMULARIOS ===== */
.form-control,
.form-select {
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-text {
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* ===== MODALES MODERNOS ===== */
.modal-content {
    border: none;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

/* ===== ALERTAS PREMIUM ===== */
.alert {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem 1.5rem;
    border-left: 4px solid;
    font-weight: 500;
    font-size: 0.9375rem;
}

.alert .fas {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.alert-success {
    background-color: #d1fae5;
    color: var(--success-dark);
    border-left-color: var(--success-color);
}

.alert-danger {
    background-color: #fee2e2;
    color: var(--danger-dark);
    border-left-color: var(--danger-color);
}

.alert-warning {
    background-color: #fef3c7;
    color: var(--warning-dark);
    border-left-color: var(--warning-color);
}

.alert-info {
    background-color: #cffafe;
    color: var(--info-dark);
    border-left-color: var(--info-color);
}

.alert.position-fixed {
    top: 20px;
    right: 20px;
    min-width: 350px;
    max-width: 450px;
    z-index: 9999;
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert.fade-out {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

.alert .btn-close {
    opacity: 0.6;
}

.alert .btn-close:hover {
    opacity: 1;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== UTILIDADES ===== */
.text-primary {
    color: var(--primary-color) !important;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ===== RESPONSIVE DESIGN MEJORADO ===== */

/* Tablets grandes (992px - 1199px) */
@media (max-width: 1199px) {
    .table {
        min-width: 1200px;
    }
    
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Tablets (768px - 991px) */
@media (max-width: 991px) {
    .card-stats .card-title {
        font-size: 2rem;
    }
    
    .navbar-custom {
        padding: 0.75rem 0;
    }
    
    .filter-chip {
        font-size: 0.8125rem;
        padding: 0.4rem 0.875rem;
    }
    
    .search-section {
        padding: 1.25rem;
    }
    
    .table {
        min-width: 1200px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .btn-group .btn {
        padding: 0.3rem 0.5rem;
    }
    
    /* Asegurar scroll visible */
    .table-responsive {
        overflow-x: scroll !important;
        display: block;
        width: 100%;
    }
}

/* Móviles grandes (576px - 767px) */
@media (max-width: 767px) {
    /* Contenedor principal */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Estadísticas */
    .stats-container {
        margin-bottom: 1rem;
    }
    
    .card-stats {
        margin-bottom: 0.75rem;
    }
    
    .card-stats .card-body {
        padding: 1rem;
    }
    
    .card-stats .card-title {
        font-size: 1.75rem;
    }
    
    .card-stats .card-category {
        font-size: 0.75rem;
    }
    
    .card-stats .icon-big i {
        font-size: 1.5rem !important;
    }
    
    /* Filtros */
    .filters-section {
        padding: 1rem;
    }
    
    .filters-section .row {
        flex-direction: column;
    }
    
    .filters-section .col-md-3 {
        margin-bottom: 0.75rem;
        text-align: center;
    }
    
    .filter-chip {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        margin: 0.2rem;
    }
    
    /* Búsqueda */
    .search-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .search-section h5 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .search-section .btn {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Tabla - CRÍTICO PARA MÓVILES */
    .card {
        border-radius: var(--radius-lg);
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .card-header h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .card-header .d-flex {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
    }
    
    /* Forzar scroll horizontal en tabla */
    .table-responsive {
        overflow-x: auto !important;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
        scrollbar-width: auto;
    }
    
    .table {
        font-size: 0.75rem;
        min-width: 1100px !important;
        width: auto;
        display: table;
    }
    
    .table thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.7rem;
        min-width: 80px;
    }
    
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
        min-width: 80px;
    }
    
    /* Columna de acciones más grande */
    .table tbody td:last-child,
    .table thead th:last-child {
        min-width: 140px;
        position: sticky;
        right: 0;
        background: white;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
        z-index: 5;
    }
    
    .table thead th:last-child {
        background: var(--gray-800);
        z-index: 15;
    }
    
    /* Botones en móvil */
    .btn-group {
        display: flex;
        gap: 2px;
    }
    
    .btn-group .btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
        flex: 1;
        min-width: 32px;
    }
    
    .btn-group .btn i {
        font-size: 0.75rem;
    }
    
    /* Badges en móvil */
    .badge {
        font-size: 0.65rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Modales en móvil */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    /* Navbar en móvil */
    .navbar-custom .container-fluid {
        padding: 0 0.75rem;
    }
    
    .navbar-brand {
        font-size: 0.9rem;
    }
    
    .navbar-text {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Alertas en móvil */
    .alert.position-fixed {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
        font-size: 0.8125rem;
        padding: 1rem;
    }
}

/* Móviles pequeños (menos de 576px) */
@media (max-width: 575px) {
    /* Espaciado general */
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Estadísticas compactas */
    .card-stats .card-body {
        padding: 0.875rem;
    }
    
    .card-stats .card-title {
        font-size: 1.5rem;
    }
    
    .card-stats .card-category {
        font-size: 0.7rem;
    }
    
    .card-stats .icon-big i {
        font-size: 1.25rem !important;
    }
    
    /* Filtros compactos */
    .filters-section {
        padding: 0.75rem;
    }
    
    .filter-chip {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
        margin: 0.15rem;
    }
    
    /* Búsqueda muy compacta */
    .search-section {
        padding: 0.75rem;
    }
    
    .search-section h5 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .search-section .form-control {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
    
    .search-section .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
    
    .search-section .btn i {
        font-size: 0.7rem;
    }
    
    /* Tabla muy compacta */
    .card-header {
        padding: 0.75rem;
    }
    
    .card-header h5 {
        font-size: 0.9rem;
    }
    
    .table {
        font-size: 0.7rem;
        min-width: 1000px !important;
    }
    
    .table thead th {
        padding: 0.625rem 0.4rem;
        font-size: 0.65rem;
        min-width: 70px;
    }
    
    .table tbody td {
        padding: 0.625rem 0.4rem;
        font-size: 0.7rem;
        min-width: 70px;
    }
    
    /* Columna de acciones fija en móvil pequeño */
    .table tbody td:last-child,
    .table thead th:last-child {
        min-width: 130px;
    }
    
    .btn-group .btn {
        padding: 0.35rem 0.4rem;
        font-size: 0.65rem;
        min-width: 28px;
    }
    
    .btn-group .btn i {
        font-size: 0.7rem;
    }
    
    /* Badges muy pequeños */
    .badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.45rem;
    }
    
    /* Navbar compacto */
    .navbar-brand {
        font-size: 0.8rem;
    }
    
    .navbar-text {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
    
    .navbar-custom .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    
    /* Modales en pantallas muy pequeñas */
    .modal-dialog {
        margin: 0.25rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.875rem;
    }
    
    .modal-title {
        font-size: 0.9rem;
    }
    
    .modal-body .form-label {
        font-size: 0.8125rem;
    }
    
    .modal-body .form-control,
    .modal-body .form-select {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Botones de modales */
    .modal-footer .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.875rem;
    }
}

/* Móviles muy pequeños (menos de 400px) */
@media (max-width: 399px) {
    /* Ajustes extremos para pantallas muy pequeñas */
    .container-fluid {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    .card-stats .card-body {
        padding: 0.75rem;
    }
    
    .card-stats .card-title {
        font-size: 1.25rem;
    }
    
    .card-stats .card-category {
        font-size: 0.65rem;
    }
    
    .filters-section,
    .search-section {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .filter-chip {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
    
    .table {
        min-width: 900px !important;
        font-size: 0.65rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.3rem;
        font-size: 0.625rem;
        min-width: 60px;
    }
    
    .table tbody td:last-child,
    .table thead th:last-child {
        min-width: 120px;
    }
    
    .btn-group .btn {
        padding: 0.3rem 0.35rem;
        font-size: 0.625rem;
        min-width: 26px;
    }
    
    .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    .navbar-brand {
        font-size: 0.75rem;
    }
    
    .navbar-text {
        display: none;
    }
    
    .navbar-custom .btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }
    
    .alert.position-fixed {
        font-size: 0.75rem;
        padding: 0.75rem;
    }
}

/* ===== MEJORAS DE ACCESIBILIDAD TÁCTIL ===== */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivos táctiles */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-group .btn {
        min-height: 40px;
        min-width: 40px;
    }
    
    .filter-chip {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    /* Aumentar área táctil de acciones */
    .table tbody td:last-child {
        min-width: 160px;
    }
}

/* ===== MEJORAS DE SCROLL EN MÓVILES ===== */

/* Indicador visual de scroll horizontal */
.table-responsive::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

@media (max-width: 991px) {
    .table-responsive::after {
        opacity: 1;
    }
    
    .table-responsive.scrolled-left::after {
        opacity: 0;
    }
}

/* ===== MEJORAS DE RENDIMIENTO EN MÓVILES ===== */
@media (max-width: 767px) {
    /* Reducir animaciones en móviles para mejor rendimiento */
    .card-stats {
        animation: none;
    }
    
    .table tbody tr {
        animation: none;
    }
    
    /* Desactivar hover effects en móviles */
    .card-stats:hover {
        transform: none;
    }
    
    .filter-chip:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* ===== ORIENTACIÓN HORIZONTAL EN MÓVILES ===== */
@media (max-width: 767px) and (orientation: landscape) {
    .stats-container {
        margin-bottom: 0.75rem;
    }
    
    .card-stats {
        margin-bottom: 0.5rem;
    }
    
    .card-stats .card-body {
        padding: 0.75rem;
    }
    
    .filters-section,
    .search-section {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .navbar-custom {
        padding: 0.5rem 0;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.4rem;
    }
}

/* ===== ESTADOS DE HOVER MEJORADOS (SOLO DESKTOP) ===== */
@media (hover: hover) and (pointer: fine) {
    .card-stats:hover .card-title {
        transform: scale(1.05);
        transition: var(--transition-base);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .filter-chip:hover {
        transform: translateY(-2px);
    }
}

/* ===== MEJORAS DE CONTRASTE ===== */
.text-muted {
    color: var(--gray-600) !important;
}

/* ===== EFECTOS GLASSMORPHISM ===== */
.navbar-text {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ===== ESPACIADO CONSISTENTE ===== */
.mb-custom {
    margin-bottom: 1.5rem;
}

.mt-custom {
    margin-top: 1.5rem;
}

/* ===== ESTILOS PARA CONTADOR DE RESULTADOS ===== */
#contadorResultados {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
}

#filtroActivo {
    background: var(--accent-color);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
}

/* ===== MEJORAS DE TOOLTIPS ===== */
.tooltip {
    font-size: 0.75rem;
}

.tooltip-inner {
    background-color: var(--gray-900);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
}

/* ===== ESTADOS DE CARGA ===== */
.loading-cursor,
.loading-cursor * {
    cursor: wait !important;
}

/* ===== ANIMACIÓN DE ENTRADA PARA CARDS ===== */
.card-stats {
    animation: fadeInUp 0.5s ease-out backwards;
}

.card-stats:nth-child(1) { animation-delay: 0.1s; }
.card-stats:nth-child(2) { animation-delay: 0.2s; }
.card-stats:nth-child(3) { animation-delay: 0.3s; }
.card-stats:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MEJORAS DE ICONOS ===== */
.fas,
.far,
.fab {
    vertical-align: middle;
}

/* ===== ESTADOS ACTIVOS ===== */
.btn:active,
.btn.active {
    transform: scale(0.98);
    box-shadow: inset var(--shadow-sm);
}

/* ===== MEJORAS DE ESPACIADO EN TABLAS ===== */
.table-responsive {
    position: relative;
}

/* ===== IMPRESIÓN ===== */
@media print {
    .navbar,
    .search-section,
    .filters-section,
    .btn-group,
    .modal,
    .alert {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        page-break-inside: avoid;
    }
    
    .table {
        min-width: 100% !important;
    }
    
    .table thead th {
        background-color: var(--gray-200) !important;
        color: var(--gray-900) !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    .card-stats {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid var(--gray-300) !important;
        page-break-inside: avoid;
    }
    
    .card-stats::before {
        display: none;
    }
    
    .badge {
        border: 1px solid currentColor;
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.filter-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== ANIMACIONES ADICIONALES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MEJORAS VISUALES ===== */
.fw-medium {
    font-weight: 500;
}

.fw-semibold {
    font-weight: 600;
}

.opacity-75 {
    opacity: 0.75;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-25 {
    opacity: 0.25;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Scrollbar personalizada para navegadores webkit */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Scrollbar para Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

/* ===== SOPORTE PARA MODO OSCURO (PREPARADO) ===== */
@media (prefers-color-scheme: dark) {
    /* Descomentado para activar modo oscuro automático */
    /*
    :root {
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
        --gray-300: #4b5563;
    }
    
    body {
        background-color: var(--gray-900);
        color: var(--gray-100);
    }
    
    .card,
    .card-stats,
    .filters-section,
    .search-section {
        background: var(--gray-800);
        border-color: var(--gray-700);
    }
    
    .table tbody td:last-child {
        background: var(--gray-800);
    }
    */
}

/* ===== MEJORAS ESPECÍFICAS PARA iOS ===== */
@supports (-webkit-touch-callout: none) {
    /* Estilos específicos para iOS */
    .form-control,
    .form-select,
    .btn {
        -webkit-appearance: none;
        appearance: none;
    }
    
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevenir zoom en inputs en iOS */
    @media (max-width: 767px) {
        .form-control,
        .form-select,
        input,
        select,
        textarea {
            font-size: 16px !important;
        }
    }
}

/* ===== MEJORAS PARA ANDROID ===== */
@media (max-width: 767px) {
    /* Mejorar rendimiento de scroll en Android */
    .table-responsive {
        transform: translate3d(0, 0, 0);
        will-change: scroll-position;
    }
    
    .table {
        transform: translate3d(0, 0, 0);
    }
}

/* ===== INDICADOR VISUAL DE SCROLL HORIZONTAL ===== */
@media (max-width: 991px) {
    .card-body::before {
        content: '← Desliza para ver más →';
        position: sticky;
        left: 0;
        display: block;
        background: var(--primary-color);
        color: white;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.75rem;
        font-weight: 600;
        z-index: 20;
        margin: -1rem -1rem 1rem -1rem;
    }
    
    .card-body.scrolled::before {
        content: '';
        display: none;
    }
}

/* ===== FIN DE ESTILOS ===== */