/* ==========================================================================
   ORIENTALFS_TEAMS — FICHA EXPEDIENTE DEL ALUMNO
   Vista Principal Completa: Expediente Clínico-Pedagógico con máxima serenidad
   ========================================================================== */

/* Vista Principal de la Ficha (Ocupa el Viewport Central) */
.ficha-main-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: var(--bg-app);
  overflow: hidden;
}

/* Barra Superior de Navegación del Expediente */
.ficha-nav-bar {
  padding: 12px 28px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ficha-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--slate-700);
  background: var(--slate-100);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300);
  cursor: pointer;
  transition: var(--transition-fast);
}

.ficha-back-btn:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.ficha-nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cabecera Editorial del Expediente */
.ficha-header {
  padding: 20px 28px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
}

.ficha-profile-summary {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex: 1;
}

.ficha-photo-wrapper {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  background-color: #f1f5f9;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ficha-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ficha-photo-wrapper:hover .photo-edit-badge {
  opacity: 1;
}

.photo-edit-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  padding: 3px 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.photo-placeholder {
  font-size: 2rem;
  line-height: 72px;
  color: #64748b;
  text-align: center;
}

.ficha-names {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ficha-names h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.2;
  margin: 0;
}

.ficha-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-group {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-age {
  background-color: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-idoneo {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-desfase {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-tutores {
  background-color: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 480px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ficha-header-neae-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}

.ficha-header-neae-container:empty {
  display: none;
}

.ficha-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  background-color: var(--surface);
  gap: 8px;
}

.tab-btn {
  padding: 14px 18px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--slate-800);
}

.tab-btn.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
  font-weight: 700;
}

/* Contenido de la Ficha con Scroll */
.ficha-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background-color: var(--bg-app);
}

.ficha-tab-pane {
  display: none;
}
.ficha-tab-pane.active {
  display: block;
}

/* Tarjetas Informativas dentro de la Ficha */
.doc-card {
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

.doc-card-header {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Parrilla de Tutores y Teléfonos */
.tutors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.tutor-box {
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.tutor-name {
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.tutor-contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--slate-600);
}

/* ==========================================================================
   Parrilla de Datos Personales y Expediente Académico LOMLOE
   ========================================================================== */

.personal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px 20px;
  font-size: 0.875rem;
}

.personal-col-span-2 {
  grid-column: span 2;
  min-width: 0;
}

@media (max-width: 768px) {
  .personal-col-span-2 {
    grid-column: span 1;
  }
}

.personal-label {
  color: var(--slate-500);
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.badge-age-soft {
  display: inline-flex;
  align-items: center;
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #dbeafe;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  line-height: 1.2;
}

.personal-value-email {
  display: inline-block;
  color: var(--primary-700);
  font-weight: 600;
  word-break: break-all;
  overflow-wrap: anywhere;
  text-decoration: none;
  min-width: 0;
  transition: color 0.15s ease;
}

.personal-value-email:hover {
  text-decoration: underline;
  color: var(--primary-900);
}

/* Pastillas de la Tarjeta Académica */
.badge-idoneidad-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-idoneidad-pill.ok {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-idoneidad-pill.warn {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 0.78rem;
  background-color: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
}

.badge-sub-pill.warn {
  background-color: #fff7ed;
  border: 1px solid #ffedd5;
  color: #c2410c;
}

.academic-alert-box {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
}

/* Píldoras NEAE Interactivas */
.neae-catalog-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.neae-selectable-pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid;
  transition: var(--transition-fast);
  user-select: none;
}

.neae-selectable-pill:not(.selected) {
  opacity: 0.45;
  filter: grayscale(0.6);
}
.neae-selectable-pill.selected {
  opacity: 1;
  transform: scale(1.02);
  box-shadow: var(--shadow-xs);
}

/* Línea de Tiempo de Intervenciones */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-entry {
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-600);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--slate-400);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.timeline-title {
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 4px;
}

.timeline-text {
  font-size: 0.875rem;
  color: var(--slate-600);
  line-height: 1.45;
}

/* Rich Text Editor Minimalista & Nativo */
.rich-editor-wrapper {
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rich-editor-wrapper:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-50);
}

.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background-color: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  user-select: none;
}

.editor-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  font-size: 0.85rem;
  color: var(--slate-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.editor-btn:hover {
  background-color: var(--slate-200);
  color: var(--slate-900);
}

.editor-btn:active {
  background-color: var(--slate-300);
}

.editor-btn.is-active {
  background-color: var(--primary-100);
  color: var(--primary-800);
  border-color: var(--primary-300);
  font-weight: 700;
}

.editor-separator {
  width: 1px;
  height: 18px;
  background-color: var(--slate-200);
  margin: 0 4px;
}

.rich-editor-content {
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--slate-800);
  outline: none;
  min-height: 120px;
  overflow-y: auto;
  word-break: break-word;
}

.rich-editor-content[data-placeholder]:empty:before {
  content: attr(data-placeholder);
  color: var(--slate-400);
  cursor: text;
  pointer-events: none;
}

.rich-editor-content b,
.rich-editor-content strong {
  font-weight: 700;
  color: var(--slate-900);
}

.rich-editor-content i,
.rich-editor-content em {
  font-style: italic;
}

.rich-editor-content u {
  text-decoration: underline;
}

.rich-editor-content ul {
  padding-left: 20px;
  margin: 6px 0;
}

.rich-editor-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

