/* === DISEÑO "DARK MEDICAL FUTURE" === */
:root {
    --bg-dark: #131517;       /* Fondo casi negro */
    --card-dark: #1E2226;     /* Fondo de tarjetas */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    
    /* Degradados de la imagen */
    --gradient-teal: linear-gradient(135deg, #2dd4bf 0%, #0ea5e9 100%); /* Verde a Azul */
    --gradient-blue: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); /* Azul a Morado */
    --gradient-green: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    
    --radius-xl: 20px;
    --radius-md: 12px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
}

/* === NAVBAR === */
.navbar-custom {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1030 !important;
    background-color: #0f172a !important;  /* dark slate */
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff !important;
}
.navbar-custom .nav-link {
    color: rgba(255,255,255,0.85) !important;
    transition: background-color 0.25s ease, color 0.25s ease;
    border-radius: 8px;
    padding: 0.45rem 0.9rem !important;
    margin: 0 2px;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus {
    background-color: rgba(59, 130, 246, 0.25) !important;  /* azul translúcido al pasar el mouse */
    color: #fff !important;
}
.navbar-custom form button.nav-link:hover {
    background-color: rgba(220, 53, 69, 0.3) !important;  /* rojo translúcido en "Cerrar sesión" */
}

/* === TOAST MESSAGES (notificaciones flotantes) === */
.toast-stack {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100% - 40px);
}
.toast-message {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 12px;
    background: #1e293b;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.2);
    border-left: 6px solid #3b82f6;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.toast-success { border-left-color: #22c55e; background: linear-gradient(135deg, #1e293b 0%, #14532d 100%); }
.toast-error   { border-left-color: #ef4444; background: linear-gradient(135deg, #1e293b 0%, #7f1d1d 100%); }
.toast-warning { border-left-color: #f59e0b; background: linear-gradient(135deg, #1e293b 0%, #78350f 100%); }
.toast-info    { border-left-color: #3b82f6; background: linear-gradient(135deg, #1e293b 0%, #1e3a8a 100%); }

.toast-icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
}
.toast-success .toast-icon { color: #4ade80; }
.toast-error   .toast-icon { color: #f87171; }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-info    .toast-icon { color: #60a5fa; }

.toast-body { flex-grow: 1; }
.toast-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.toast-text {
    font-size: 0.92rem;
    color: rgba(255,255,255,0.92);
    line-height: 1.4;
}
.toast-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    transition: color 0.2s;
}
.toast-close:hover { color: #fff; }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255,255,255,0.4);
    transform-origin: left;
    animation: toastProgress 6s linear forwards;
}

.toast-fadeout {
    animation: toastSlideOut 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastSlideOut {
    to { transform: translateX(120%); opacity: 0; }
}
@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* === BOTONES ACCIONES RÁPIDAS === */
.btn-quick-action {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.85));
    color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;          /* píldora */
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
    text-align: center;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.btn-quick-action:hover {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.7), rgba(30, 64, 175, 0.7));
    color: #fff !important;
    border-color: rgba(94, 234, 212, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.4);
}
.btn-quick-action i {
    margin-right: 0.4rem;
}

/* === TARJETAS GENERALES === */
.card {
    background-color: var(--card-dark);
    border: 1px solid rgba(255,255,255,0.05); /* Borde sutil */
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    color: white;
    margin-bottom: 20px;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 1.5rem;
}

/* === TARJETAS DEL DASHBOARD (KPIs) === */
/* Estilo para las tarjetas pequeñas de arriba */
.dashboard-widget {
    border-radius: var(--radius-xl);
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: none;
}

/* Aplicamos los degradados a las tarjetas específicas */
.bg-primary.dashboard-widget { background: var(--gradient-teal) !important; }
.bg-success.dashboard-widget { background: var(--gradient-green) !important; }
.bg-info.dashboard-widget { background: var(--gradient-blue) !important; }

.dashboard-widget h2 {
    font-size: 3rem;
    font-weight: 700;
}
.dashboard-widget h6 {
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    font-size: 0.8rem;
}

/* === BOTONES REDONDOS === */
.btn {
    border-radius: 50px; /* Estilo píldora */
    padding: 10px 25px;
    font-weight: 600;
    text-transform: none;
    border: none;
}

.btn-primary {
    background: var(--gradient-teal);
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.4); /* Resplandor */
}
.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-secondary, .btn-outline-secondary {
    background-color: #2D3339;
    color: white;
    border: none;
}

/* === TABLAS EN MODO OSCURO === */
.table {
    color: var(--text-secondary);
}
.table thead th {
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.table td {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.table-hover tbody tr:hover {
    color: white;
    background-color: rgba(255,255,255,0.05);
}

/* === FORMULARIOS OSCUROS === */
.form-control, .form-select {
    background-color: #0d0f11;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: var(--radius-md);
    padding: 12px;
}
.form-control:focus {
    background-color: #0d0f11;
    color: white;
    border-color: #2dd4bf; /* Color Teal al enfocar */
    box-shadow: 0 0 0 0.25rem rgba(45, 212, 191, 0.2);
}

textarea[name="signos_alarma"] {
    resize: none;
    border-left: 5px solid #dc3545; /* Un borde rojo para resaltar importancia */
    font-style: italic;
}

input[name="proxima_cita"] {
    border-left: 5px solid #0d6efd;
}

/* Mejora la apariencia del botón de salida */
#logout-form button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* === SECCIONES CON FONDO CLARO (formularios) === */
.bg-light, .bg-light label, .bg-light p, .bg-light span, .bg-light small {
    color: #212529 !important;
}
.bg-light .form-control, .bg-light .form-select {
    background-color: #ffffff;
    color: #212529;
    border-color: #dee2e6;
}
.bg-light .form-control:focus, .bg-light .form-select:focus {
    background-color: #ffffff;
    color: #212529;
}