/* Reset y variables globales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --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;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-800);
}

/* Página de Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-container {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 40px 30px;
    text-align: center;
}

.logo i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.login-form {
    padding: 40px 30px;
}

.login-form h2 {
    text-align: left;
    margin-bottom: 30px;
    color: var(--gray-800);
    font-weight: 600;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    z-index: 2;
    pointer-events: none;
    width: 24px;
    text-align: center;
}

.input-group input {
    width: 100%;
    padding: 12px 15px 12px 52px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    background: var(--white);
}

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

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

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



.error-message {
    background: #fef2f2;
    color: var(--error-color);
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #fecaca;
    text-align: center;
}

/* Dashboard */
.dashboard {
    display: flex;
    min-height: 100vh;
    background: var(--gray-50);
}

.sidebar {
    width: 280px;
    background: var(--white);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.logo-small {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

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

.logo-small span {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info i {
    font-size: 1.2rem;
    color: var(--gray-500);
}

.user-info span {
    font-weight: 500;
    color: var(--gray-700);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--gray-600);
}

.menu-item:hover {
    background: var(--gray-50);
    color: var(--primary-color);
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    position: relative;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--white);
}

.menu-item i {
    font-size: 1.1rem;
    width: 20px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-header {
    background: var(--white);
    padding: 25px 30px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--gray-800);
}

.current-date {
    color: var(--gray-500);
    font-weight: 500;
}

.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content-section {
    display: none;
}

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

/* Sección de carga de archivos */
.upload-section {
    margin-bottom: 30px;
}

.upload-card {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.upload-card h3 {
    color: var(--gray-800);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.upload-card p {
    color: var(--gray-600);
    margin-bottom: 25px;
}

.file-upload {
    margin-bottom: 20px;
}

.upload-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.upload-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.file-name {
    margin-top: 15px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 6px;
    color: var(--gray-700);
    font-weight: 500;
}

.process-btn {
    background: var(--success-color);
    color: var(--white);
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.process-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Sección de análisis */
.analytics-section {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

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

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
}

.kpi-card:nth-child(1) .kpi-icon,
.kpi-card:nth-child(5) .kpi-icon {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.kpi-card:nth-child(2) .kpi-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.kpi-card:nth-child(3) .kpi-icon {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
}

.kpi-card:nth-child(4) .kpi-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.kpi-content h3 {
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.kpi-value {
    color: var(--gray-800);
    font-size: 1.8rem;
    font-weight: 700;
}

/* Sección de gráficos */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.chart-card h3 {
    color: var(--gray-800);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-container {
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: 8px;
    color: var(--gray-500);
}

/* Tabla de datos */
.data-table-section {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.data-table-section h3 {
    color: var(--gray-800);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-600);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

/* ===== CONTROLES DE PAGINACIÓN ===== */
.pagination-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.pagination-info {
    color: var(--gray-600);
    font-size: 14px;
}

.pagination-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-size: 14px;
}

.pagination-size-selector select {
    padding: 5px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    color: var(--gray-700);
    font-size: 14px;
    cursor: pointer;
}

.pagination-size-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pagination-controls-bottom {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
}

.pagination-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--gray-100);
}

.pagination-numbers {
    display: flex;
    gap: 3px;
    margin: 0 10px;
}

.pagination-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.pagination-number:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.pagination-number.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination-number.active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--gray-400);
    font-size: 14px;
    font-weight: bold;
}

/* ===== PERFIL DE USUARIO ===== */
.profile-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
}

.profile-info-card,
.password-change-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecef;
}

.profile-info-card h3,
.password-change-card h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}

.profile-info-card .user-info-table {
    display: table;
    width: 100%;
    border-spacing: 0;
}

.info-row {
    display: table-row;
}

.info-label,
.info-value {
    display: table-cell;
    padding: 12px 20px 12px 0;
    vertical-align: top;
    text-align: left;
}

.info-label {
    font-weight: 600;
    color: #2c3e50;
    width: 180px;
    min-width: 180px;
}

.info-value {
    color: #4a90e2;
    font-weight: 500;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item label {
    font-weight: 600;
    color: var(--text-color);
    min-width: 0;
    justify-self: start;
    text-align: left;
    display: block;
}

.info-item span {
    color: var(--secondary-color);
    font-weight: 500;
    text-align: left;
    display: block;
    justify-self: start;
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafbfc;
}

/* Asegurar espacio para los iconos dentro de input-group */
.form-group .input-group input {
    padding-left: 52px !important;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Evitar fondo o borde en los iconos dentro de los inputs */
.input-group i {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

.form-help {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

.form-actions {
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* User Management Styles */
.section-header {
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.section-header h2 {
    margin: 0 0 8px 0;
    color: var(--gray-800);
    font-size: 28px;
    font-weight: 700;
}

.section-header p {
    margin: 0;
    color: var(--gray-600);
    font-size: 16px;
}

.user-management-container {
    max-width: 1200px;
    margin: 0 auto;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

/* Users Table */
.users-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.users-table th,
.users-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.users-table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Column widths for users table */
.users-table th:nth-child(1),
.users-table td:nth-child(1) {
    width: 8%;
    min-width: 60px;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
    width: 30%;
    min-width: 200px;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
    width: 25%;
    min-width: 180px;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
    width: 15%;
    min-width: 120px;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
    width: 10%;
    min-width: 80px;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
    width: 12%;
    min-width: 160px;
}

.users-table .status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.action-buttons-cell,
.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}





.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
}

.user-form .form-group {
    margin-bottom: 20px;
}

.user-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.user-form input,
.user-form select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.user-form input:focus,
.user-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.warning-text {
    color: #dc3545;
    font-weight: 600;
    margin: 15px 0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .content-body {
        padding: 20px;
    }
    
    .login-card {
        margin: 10px;
    }
    
    .profile-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .profile-info-card,
    .password-change-card {
        padding: 20px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-item span {
        text-align: left;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .users-table-container {
        overflow-x: auto;
    }
    
    .users-table {
        min-width: 800px;
    }
    
    .modal-content {
        width: calc(100% - 40px);
        max-width: 90%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        justify-content: center;
    }
}

/* Utilidades */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== TABLA RESUMEN DE FARMACIAS ===== */
#pharmacySummaryTable th:nth-child(1),
#pharmacySummaryTable td:nth-child(1) {
    text-align: left;
    min-width: 200px;
}

#pharmacySummaryTable th:nth-child(2),
#pharmacySummaryTable td:nth-child(2) {
    text-align: left;
    min-width: 120px;
}

#pharmacySummaryTable th:nth-child(3),
#pharmacySummaryTable td:nth-child(3) {
    text-align: right;
    min-width: 100px;
}

#pharmacySummaryTable th:nth-child(4),
#pharmacySummaryTable td:nth-child(4) {
    text-align: right;
    min-width: 100px;
}

#pharmacySummaryTable th:nth-child(5),
#pharmacySummaryTable td:nth-child(5) {
    text-align: right;
    min-width: 80px;
}

#pharmacySummaryTable th:nth-child(6),
#pharmacySummaryTable td:nth-child(6) {
    text-align: right;
    min-width: 100px;
}

/* Estilos para Filtros de Farmacias */
.filters-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-with-button {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-with-button .form-select {
    flex: 1;
    min-width: 200px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
    min-width: auto;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.form-input {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select:hover {
    border-color: #c1c7cd;
}

/* Selector de entidades en importaciones - ancho reducido y centrado */
#importEntitySelect {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    display: block;
}

/* Estilos mejorados para Paginación */
.pagination-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-top: 25px;
}

.pagination-info {
    text-align: center;
    margin-bottom: 15px;
    color: var(--gray-600);
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.page-number {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.page-number.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--primary-color);
}

.page-ellipsis {
    padding: 8px 4px;
    color: var(--gray-500);
    font-size: 14px;
}

/* Responsive para filtros y paginación */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-numbers {
        justify-content: center;
    }
}

/* Estilos para Gestión de Entidades */
.entities-section {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.entities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f2f5;
}

.entities-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.entities-header h2 i {
    color: var(--accent-color);
    font-size: 1.6rem;
}

.entities-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.entities-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.entities-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.entities-table th,
.entities-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.entities-table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entities-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Column widths for entities table */
.entities-table th:nth-child(1),
.entities-table td:nth-child(1) {
    width: 8%;
    min-width: 60px;
}

.entities-table th:nth-child(2),
.entities-table td:nth-child(2) {
    width: 50%;
    min-width: 250px;
}

.entities-table th:nth-child(3),
.entities-table td:nth-child(3) {
    width: 25%;
    min-width: 180px;
}

.entities-table th:nth-child(4),
.entities-table td:nth-child(4) {
    width: 17%;
    min-width: 140px;
}

.entity-color-display {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #e8ecef;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.entity-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-edit, .btn-delete {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-edit {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: var(--white);
}

.btn-edit:hover {
    background: linear-gradient(135deg, #218838, #1ba085);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-delete {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: var(--white);
}

.btn-delete:hover {
    background: linear-gradient(135deg, #c82333, #dc2626);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Estilos para Gestión de Farmacias */
.pharmacies-section {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.pharmacies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f2f5;
}

.pharmacies-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pharmacies-header h2 i {
    color: var(--accent-color);
    font-size: 1.6rem;
}

.pharmacies-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.pharmacies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.pharmacies-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.pharmacies-table th,
.pharmacies-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.pharmacies-table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pharmacies-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Column widths for pharmacies table */
.pharmacies-table th:nth-child(1),
.pharmacies-table td:nth-child(1) {
    width: 8%;
    min-width: 60px;
}

.pharmacies-table th:nth-child(2),
.pharmacies-table td:nth-child(2) {
    width: 40%;
    min-width: 200px;
}

.pharmacies-table th:nth-child(3),
.pharmacies-table td:nth-child(3) {
    width: 20%;
    min-width: 140px;
}

.pharmacies-table th:nth-child(4),
.pharmacies-table td:nth-child(4) {
    width: 30%;
    min-width: 180px;
}

.pharmacies-table th:nth-child(5),
.pharmacies-table td:nth-child(5) {
    width: 17%;
    min-width: 140px;
}

/* Estilos para nombres de entidades con color */
.entity-name-colored {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    text-align: center;
    min-width: 80px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.entity-name-colored:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.pharmacy-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Estilos para el formulario de entidades */
.entity-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    width: 50px;
    height: 40px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
    overflow: hidden;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-preview {
    width: 50px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e8ecef;
    cursor: pointer;
    background: #3B82F6;
    transition: all 0.2s ease;
    position: relative;
}

.color-preview:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.color-preview:active {
    transform: scale(0.95);
}

.color-hex-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.color-hex-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Responsive para entidades */
@media (max-width: 768px) {
    .entities-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .entities-table-container {
        overflow-x: auto;
    }
    
    .entities-table {
        min-width: 600px;
    }
    
    .entity-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-edit, .btn-delete {
        width: 100%;
        justify-content: center;
    }
    
    .color-input-container {
        flex-direction: column;
        align-items: stretch;
    }
}
/* Regras específicas para el formulario de Login */
#loginForm .input-group i {
    position: absolute !important;
    left: 18px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
    pointer-events: none;
    color: var(--gray-400) !important;
    font-size: 16px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#loginForm #email,
#loginForm #password {
    padding-left: 60px !important;
}

.form-group .input-group input {
    padding-left: 52px !important;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Evitar fondo o borde en los iconos dentro de los inputs */
.input-group i {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

.form-help {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

.form-actions {
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* User Management Styles */
.user-management-container {
    max-width: 1200px;
    margin: 0 auto;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

/* Users Table */
.users-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.users-table th,
.users-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.users-table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr:hover {
    background-color: #f8f9fa;
}

.users-table .status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.action-buttons-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
}

.user-form .form-group {
    margin-bottom: 20px;
}

.user-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.user-form input,
.user-form select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.user-form input:focus,
.user-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.warning-text {
    color: #dc3545;
    font-weight: 600;
    margin: 15px 0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .content-body {
        padding: 20px;
    }
    
    .login-card {
        margin: 10px;
    }
    
    .profile-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .profile-info-card,
    .password-change-card {
        padding: 20px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-item span {
        text-align: left;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .users-table-container {
        overflow-x: auto;
    }
    
    .users-table {
        min-width: 800px;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        justify-content: center;
    }
}

/* Utilidades */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}