/* 
   Sistema de Gestión de Cartera - Omnisalud S.A.
   Diseño de Interfaz Premium - CSS Nativo
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta de Colores HSL Tailored */
    --primary-h: 220;
    --primary-s: 85%;
    --primary-l: 45%;
    
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-hover: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 8%));
    --primary-light: hsl(var(--primary-h), var(--primary-s), 95%);
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.15);
    
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    
    /* Layout Variables */
    --sidebar-width: 260px;
    --navbar-height: 70px;
    --border-radius: 12px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--slate-50);
    color: var(--slate-800);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--slate-900);
    font-weight: 600;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout Estructura */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Estilo Premium */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--slate-900);
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--slate-400);
    transition: var(--transition-smooth);
}

.menu-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.04);
}

.menu-item.active {
    color: white;
    background-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.menu-item i {
    font-size: 1.2rem;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--slate-700);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: var(--slate-400);
}

/* Panel Principal de Contenido */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    background-color: white;
    border-bottom: 1px solid var(--slate-200);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--slate-900);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Contenedor de las vistas */
.content-body {
    padding: 32px;
    flex-grow: 1;
}

/* Tarjetas KPI Premium */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--slate-300);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary);
}

.kpi-card.danger::before { background-color: var(--danger); }
.kpi-card.warning::before { background-color: var(--warning); }
.kpi-card.success::before { background-color: var(--success); }

.kpi-info h3 {
    font-size: 0.88rem;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--slate-900);
    font-family: 'Outfit', sans-serif;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.kpi-card.danger .kpi-icon { background-color: var(--danger-light); color: var(--danger); }
.kpi-card.warning .kpi-icon { background-color: var(--warning-light); color: var(--warning); }
.kpi-card.success .kpi-icon { background-color: var(--success-light); color: var(--success); }

/* Dashboard Gráficos */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--slate-100);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--slate-900);
}

/* Tablas Premium */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background-color: var(--slate-50);
    color: var(--slate-500);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--slate-200);
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-100);
    font-size: 0.9rem;
    color: var(--slate-700);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition-smooth);
}

.custom-table tbody tr:hover {
    background-color: var(--slate-50);
}

/* Badges de Gestión */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

/* Botones Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary {
    background-color: white;
    color: var(--slate-700);
    border: 1px solid var(--slate-300);
}

.btn-secondary:hover {
    background-color: var(--slate-50);
    border-color: var(--slate-400);
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* Controles de Filtros */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--slate-200);
    padding: 16px 24px;
    margin-bottom: 24px;
}

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

.form-control {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--slate-300);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition-smooth);
    background-color: white;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--slate-500);
    text-transform: uppercase;
}

/* Vista de Login (Glassmorphism) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgb(0, 107, 240) 0%, rgb(0, 4, 38) 90%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    color: white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
}

.auth-header p {
    color: var(--slate-400);
    margin-top: 8px;
    font-size: 0.9rem;
}

.auth-form .form-label {
    color: var(--slate-300);
}

.auth-form .form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.auth-form .form-control::placeholder {
    color: var(--slate-500);
}

.auth-form .form-control:focus {
    border-color: #3b82f6;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Drop and Drop Uploader */
.upload-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 768px) {
    .upload-container {
        grid-template-columns: 1fr;
    }
}

.upload-box {
    border: 2px dashed var(--slate-300);
    border-radius: var(--border-radius);
    padding: 40px 24px;
    text-align: center;
    background-color: white;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.upload-box:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.upload-box i {
    font-size: 3rem;
    color: var(--slate-400);
    transition: var(--transition-smooth);
}

.upload-box:hover i {
    color: var(--primary);
    transform: translateY(-5px);
}

/* Línea de tiempo de gestiones */
.timeline {
    position: relative;
    padding-left: 24px;
    margin-top: 15px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    width: 2px;
    height: calc(100% - 20px);
    background-color: var(--slate-200);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    border: 2px solid white;
}

.timeline-content {
    background-color: var(--slate-50);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--slate-200);
}

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

.timeline-user {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--slate-900);
}

.timeline-date {
    font-size: 0.78rem;
    color: var(--slate-400);
}

/* Modales */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 32px;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--slate-400);
}

.modal-close:hover {
    color: var(--slate-700);
}

/* Alertas Flash */
.flash-container {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
