/* =========================================================
   SISTEMA DE DISEÑO UNIFICADO MEDEX 2025
   Unificación de Cards, Pills, Fuentes y Formularios
   ========================================================= */

:root {
    --medex-primary: #0466b1;
    --medex-danger: #ef4444;
    --medex-success: #10b981;
    --medex-border: #e2e8f0;
    --medex-bg-light: #f8fafc;
    --medex-text-main: #334155;
    --medex-text-muted: #94a3b8;
}

/* 1. TARJETAS MODERNAS (CARDS) */
.modern-card { 
    background: #fff; 
    border-radius: 12px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); 
    border: 1px solid var(--medex-border); 
    overflow: hidden; 
    margin-bottom: 25px; 
}

.modern-header { 
    padding: 12px 20px; 
    background: #fff; 
    border-bottom: 1px solid #f1f5f9; 
    display: flex; 
    align-items: center; 
}

.header-icon-box { 
    width: 32px; 
    height: 32px; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-right: 12px; 
    font-size: 1rem; 
}

.modern-title { 
    margin: 0; 
    font-weight: 700; 
    color: var(--medex-text-main); 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* 2. TIPOGRAFÍAS Y CUESTIONARIOS */
.q-text { 
    font-weight: 600; 
    color: #475569; 
    font-size: 0.85rem; 
    line-height: 1.2; 
}

.form-control-modern { 
    background: var(--medex-bg-light); 
    border: 1px solid var(--medex-border); 
    border-radius: 8px; 
    font-size: 0.85rem; 
    padding: 8px 12px; 
    width: 100%; 
    transition: border-color 0.2s;
}

.form-control-modern:focus {
    border-color: var(--medex-primary);
    outline: none;
}

/* =========================================================
   SISTEMA DE PILLS MEDEX - VERSIÓN MEJORADA
   Resuelve legibilidad y estética de image_010242.png
   ========================================================= */

.radio-group-modern { 
    display: flex; 
    gap: 2px; 
    background: #eef2f6; /* Fondo ligeramente más oscuro para contraste */
    padding: 2px; 
    border-radius: 50px; 
    border: 1px solid #dfe6ed; 
    width: fit-content; 
}

.btn-check-modern { 
    display: none; 
} 

.label-modern { 
    padding: 6px 16px; 
    border-radius: 50px; 
    font-size: 0.75rem; 
    font-weight: 800; 
    cursor: pointer; 
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
    color: #64748b; /* Gris azulado para mejor lectura */
    text-align: center; 
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    text-transform: uppercase;
}

/* Efecto al pasar el mouse por encima */
.label-modern:hover {
    color: #1e293b;
    background: rgba(255,255,255,0.5);
}

/* ESTADOS ACTIVOS (Sin bordes extraños, color sólido) */
.btn-check-modern:checked + .label-red { 
    background: #ef4444; 
    color: #ffffff !important; 
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.4); 
}

.btn-check-modern:checked + .label-green { 
    background: #10b981; 
    color: #ffffff !important; 
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.4); 
}

/* HELPER PARA FILAS INLINE (Nombre a la izquierda, Pills a la derecha) */
.item-inline { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 8px 0; 
    border-bottom: 1px solid #f1f5f9; 
}

/* =========================================================
   SISTEMA DE BADGES MEDEX (CUSTOME CLASSES)
   ========================================================= */

.medex-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

/* Badge de Alerta (Patológicos) */
.badge-danger-soft {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Badge Informativo (Familiares o Antecedentes Menores) */
.badge-info-soft {
    background-color: rgba(4, 102, 177, 0.1);
    color: #0466b1;
    border-color: rgba(4, 102, 177, 0.2);
}

/* Badge de Éxito (Estados Normales) */
.badge-success-soft {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

/* PESTAÑAS (TABS) MODERNAS MEDEX */
.custom-nav-tabs {
    border-bottom: 2px solid #f1f5f9;
}
.custom-nav-tabs .nav-link {
    border: none;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding: 12px 20px;
    transition: all 0.3s;
}
.custom-nav-tabs .nav-link:hover {
    color: var(--medex-primary);
    background: rgba(4, 102, 177, 0.05);
}
.custom-nav-tabs .nav-link.active {
    color: var(--medex-primary);
    background: transparent;
    border-bottom: 3px solid var(--medex-primary);
}

/* SISTEMA DE BADGES (SOFT COLORS) */
.medex-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 6px;
    text-transform: uppercase;
    border: 1px solid transparent;
}
.badge-danger-soft { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.badge-info-soft { background: rgba(4, 102, 177, 0.1); color: #0466b1; border-color: rgba(4, 102, 177, 0.2); }
.badge-success-soft { background: rgba(16, 185, 129, 0.1); color: #10b981; border-color: rgba(16, 185, 129, 0.2); }

/* --- ESTILOS PARA REPORTES DE AUDITORÍA --- */
.glass-panel { background: #fff; border: 1px solid #ced4da; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border-radius: 8px; margin-bottom: 20px; overflow: hidden; }
.glass-header { background: #e9ecef; padding: 10px 15px; border-bottom: 1px solid #dee2e6; color: #334155; font-weight: 800; font-size: 0.75rem; text-transform: uppercase; display: flex; align-items: center; }

.data-card { background: #fff; border: 1px solid #e2e8f0; border-left-width: 5px !important; border-radius: 6px; padding: 10px; height: 100%; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.acc-blue { border-left-color: #3b82f6 !important; }
.acc-red { border-left-color: #ef4444 !important; background-color: #fef2f2; }
.acc-green { border-left-color: #10b981 !important; }

.observation-row { background: #fff1f2; color: #b91c1c; font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 4px; margin-top: 4px; width: 100%; display: block; border-left: 3px solid #ef4444; }
.lbl-title { display: block; color: #64748b; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.val-text { color: #0f172a; font-weight: 700; font-size: 0.9rem; }

/* Tableros de Frecuencia */
.tbl-board th { background: #1e293b; color: #fff; font-size: 0.6rem; padding: 5px; text-align: center; }
.tbl-board td { border: 1px solid #e2e8f0; text-align: center; vertical-align: middle; height: 28px; background: #fff; font-size: 0.8rem; }

/* Bordes superiores de tarjetas */
.border-top-primary { border-top: 4px solid #0d6efd !important; }
.border-top-success { border-top: 4px solid #10b981 !important; }
.border-top-info { border-top: 4px solid #3b82f6 !important; }
.border-top-warning { border-top: 4px solid #f59e0b !important; }

/* Estilo para el tablero de frecuencias del auditor */
.tbl-render-audio { width: 100%; border-collapse: separate; border-spacing: 1px; table-layout: fixed; background: #cbd5e1; }
.tbl-render-audio th { background: #0f172a; color: #fff; font-size: 0.55rem; padding: 3px; text-align: center; }
.tbl-render-audio td { width: 38px; height: 22px; background: #fff; border: 1px solid #f1f5f9; position: relative; padding: 0 !important; }

/* Contenedores de iconos para evitar superposición */
.slot-container { display: flex; flex-direction: column; width: 100%; height: 100%; pointer-events: none; }
.slot-row { display: flex; flex: 1; width: 100%; align-items: center; justify-content: center; }
.slot-s { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 900; }
.s-od { color: #ef4444; } .s-oi { color: #3b82f6; }

/* Bloques de texto tipo input del formulario */
.obs-content-mimic { background: #fff; border: 1px solid #e2e8f0; padding: 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 700; color: #1e293b; margin-top: 4px; min-height: 38px; border-left: 4px solid #cbd5e1; }


/* Sidebar Header / Secciones */
.sidebar-wrapper .nav-section-title {
    padding: 25px 20px 10px 25px;
    display: flex;
    align-items: center;
}

.sidebar-wrapper .nav-section-title span {
    font-size: 0.65rem;
    font-weight: 700;
    color: #8795a1;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    width: 100%;
}

/* Línea sutil después del título */
.sidebar-wrapper .nav-section-title span::after {
    content: "";
    height: 1px;
    background: rgba(0,0,0,0.05);
    flex-grow: 1;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

/* Panel de Perfil Flat */
.sidebar-user-panel {
    padding: 20px;
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.02);
    margin-bottom: 10px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    margin-right: 12px;
}

.user-info .user-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2e3133;
}

.user-info .user-role {
    font-size: 0.75rem;
    color: #8795a1;
}

/* Clases de Colores por Rol */
.role-admin { background: #475569; }
.role-admission { background: #3b82f6; }
.role-specialist { background: #10b981; }
.role-client { background: #f59e0b; }

/* Submenús */
.treeview-menu li a.active-sub {
    color: #3b82f6 !important;
    font-weight: 600;
    border-left: 3px solid #3b82f6;
    padding-left: 17px;
}

.sidebar-footer {
    padding: 20px;
    margin-top: 30px;
}

.btn-logout {
    display: flex;
    align-items: center;
    color: #ef4444;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.cropper-container-wrapper {
    max-height: 65vh; /* Limita el alto al 65% de la pantalla */
    width: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Evita que la imagen cruda desborde antes de que Cropper cargue */
}

#imgParaRecortar {
    display: block;
    max-width: 100%;
    /* Muy importante: limitar el alto de la imagen para no empujar el modal */
    max-height: 65vh !important; 
}

/* Hacer que el modal permita scroll interno si la pantalla es muy pequeña */
.modal-dialog-scrollable .modal-content {
    max-height: 95vh;
}

/* Asegurar que el modal no se pierda en móviles */
@media (max-height: 600px) {
    .cropper-container-wrapper {
        max-height: 50vh;
    }
}