/* CSS del Módulo de Exámenes - TKD Pro Manager */
@import './components/custom-select-grados.css';

.exam-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--bg-surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.exam-count-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

.exam-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.exam-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.exam-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md);
}

.exam-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.exam-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.25rem 0;
}

.exam-card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.exam-badge-borrador {
  background: #E2E8F0;
  color: #475569;
}

.exam-badge-abierto {
  background: #DCFCE7;
  color: #15803D;
}

.exam-badge-evaluacion {
  background: #FEF3C7;
  color: #B45309;
}

.exam-badge-finalizado {
  background: #DBEAFE;
  color: #1D4ED8;
}

.exam-card-info {
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.exam-card-info-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.instructores-checklist-container {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  background: var(--bg-main);
}

.instructor-check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  background: var(--bg-surface);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

/* Workspace modal tabs: Estilo Ficha de Archivero */
.workspace-tabs-header {
  display: flex;
  gap: 0.35rem;
  background: #F1F5F9;
  padding: 0.65rem 1.25rem 0 1.25rem;
  border-bottom: 2px solid #CBD5E1;
  overflow-x: auto;
  position: relative;
}

.workspace-tab-btn {
  position: relative;
  top: 2px;
  background: #E2E8F0;
  border: 1px solid #CBD5E1;
  border-bottom: 2px solid #CBD5E1;
  padding: 0.65rem 1.15rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748B;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  z-index: 1;
}

.workspace-tab-btn:hover {
  color: #1E293B;
  background: #EBF1F5;
}

.workspace-tab-btn.active {
  background: #FFFFFF;
  color: #2563EB;
  border-color: #CBD5E1;
  border-bottom: 2px solid #FFFFFF;
  border-top: 3px solid #2563EB;
  box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.05);
  font-weight: 600;
  z-index: 3;
}

.workspace-tab-btn.tab-highlight {
  background: #E2E8F0;
  color: #475569;
}

.workspace-tab-btn.tab-highlight.active {
  background: #FFFFFF;
  color: #2563EB;
  border-top: 3px solid #D97706;
  border-bottom: 2px solid #FFFFFF;
}

.workspace-tabs-content {
  background: #FFFFFF;
  padding: 1.25rem;
  border-radius: 0 0 12px 12px;
}

.tab-pane {
  display: none;
}

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

/* Table styles */
.exam-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.exam-table th,
.exam-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.exam-table th {
  background: var(--bg-main);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.estado-badge-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.73rem;
  font-weight: 700;
  text-align: center;
}

.pill-postulado {
  background: #FEF3C7;
  color: #B45309;
}

.pill-preinscripto {
  background: #E0E7FF;
  color: #4338CA;
}

.pill-inscripto {
  background: #DCFCE7;
  color: #15803D;
}

.pill-baja {
  background: #FEE2E2;
  color: #B91C1C;
}

.pill-ausente {
  background: #F3F4F6;
  color: #4B5563;
}

.pill-aprobado {
  background: #D1FAE5;
  color: #047857;
}

.pill-reprobado {
  background: #FEE2E2;
  color: #B91C1C;
}

/* Grilla Visual de Examen */
.grilla-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  background: var(--bg-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
}

.grilla-canvas-container {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #0F172A;
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.grilla-cell {
  background: #1E293B;
  border: 1px dashed #475569;
  border-radius: var(--radius-sm);
  min-height: 85px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-size: 0.75rem;
  position: relative;
}

.grilla-cell.occupied {
  background: #334155;
  border: 1px solid var(--accent-blue);
  color: #FFFFFF;
}

.grilla-student-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-blue);
  margin-bottom: 0.35rem;
}

.grilla-student-name {
  font-weight: 700;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.grilla-student-height {
  font-size: 0.7rem;
  color: #CBD5E1;
}

/* Planilla Oficial ITF (Imagen Adjunta) */
.planilla-itf-table-wrapper {
  border: 2px solid #0F172A;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.planilla-itf-table {
  width: 100%;
  border-collapse: collapse;
  background: #E0F2FE;
}

.planilla-itf-table th,
.planilla-itf-table td {
  border: 1px solid #0F172A;
  padding: 0.6rem 0.8rem;
  text-align: center;
  font-size: 0.85rem;
}

.planilla-itf-table th.th-detalle {
  background: #BAE6FD;
  font-weight: 800;
  color: #0F172A;
  width: 50%;
}

.planilla-itf-table th.th-notas {
  background: #BAE6FD;
  font-weight: 800;
  color: #0F172A;
}

.planilla-itf-table th.th-nota-col {
  background: #E0F2FE;
  font-weight: 700;
  color: #0F172A;
  width: 16.6%;
}

.planilla-itf-table td.td-item-title {
  text-align: left;
  font-weight: 700;
  color: #0F172A;
  background: #FFFFFF;
}

.planilla-itf-table td.td-radio-cell {
  background: #FFFFFF;
}

.planilla-itf-table td.td-radio-cell input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.tr-promedio-row td {
  background: #BAE6FD !important;
  font-weight: 800;
  font-size: 0.95rem;
  color: #0F172A;
}

/* Panel del Evaluador */
.evaluador-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.evaluador-alumno-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.evaluador-alumno-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.evaluador-alumno-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
  border: 2px solid var(--accent-blue);
}

/* Modales & Contenedores Generales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
}

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

.modal-card {
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
  box-sizing: border-box;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  box-sizing: border-box;
}

.modal-card.modal-lg {
  max-width: 800px;
}

.modal-card.modal-xl {
  max-width: 1100px;
}

.modal-header {
  padding: 1rem 1.25rem;
  background-color: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-sizing: border-box;
}

.modal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-icon {
  font-size: 1.4rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  color: #64748B;
  cursor: pointer;
  padding: 0 0.5rem;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #EF4444;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  box-sizing: border-box;
}

.modal-body.p-0 {
  padding: 0;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  background-color: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Grillas de Formulario */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}

.form-group {
  margin-bottom: 0.85rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  color: #0F172A;
  font-size: 0.88rem;
  font-weight: 600;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #2563EB;
}

/* Botones */
.btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: #2563EB;
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: #1D4ED8;
}

.btn-secondary {
  background-color: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.btn-secondary:hover {
  background-color: #E2E8F0;
  color: #0F172A;
}

.btn-success {
  background-color: #16A34A;
  color: #FFFFFF;
}

.btn-success:hover {
  background-color: #15803D;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

/* Pills de Filtro de Estado de Inscripción */
.estado-filter-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.btn-filter-pill {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #64748B;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filter-pill:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.btn-filter-pill.active {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #2563EB;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.badge-pago-completo {
  background: #DCFCE7;
  color: #15803D;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-pago-pendiente {
  background: #FEF3C7;
  color: #B45309;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-pago-parcial {
  background: #E0E7FF;
  color: #4338CA;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

button[disabled] {
  cursor: wait !important;
  opacity: 0.75 !important;
  pointer-events: none !important;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.btn-spinner-icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* Turnos Pills & Selector Inline */
.btn-turno-pill {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-turno-pill:hover {
  background: #E2E8F0;
  border-color: #94A3B8;
}

.btn-turno-pill.active {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.btn-turno-pill .badge-count {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 12px;
}

.btn-turno-pill.active .badge-count {
  background: rgba(255, 255, 255, 0.25);
}

.select-turno-inline {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  color: #0F172A;
  cursor: pointer;
}

/* Árbol Jerárquico de Linaje (Instructores Habilitados) */
.instructores-checklist-container,
#instructoresHabilitadosList {
  width: 100%;
  display: block;
  box-sizing: border-box;
}

.instructor-tree-wrapper {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  padding: 0.65rem;
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

.instructor-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 0.35rem;
  width: 100%;
}

.instructor-tree-node {
  margin: 0.15rem 0;
  width: 100%;
  box-sizing: border-box;
}

.instructor-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  min-height: 28px;
  width: 100%;
  box-sizing: border-box;
  gap: 0.5rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.instructor-tree-row:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
}

.instructor-tree-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  flex: 1;
  margin: 0;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instructor-tree-children {
  margin-left: 0.9rem;
  padding-left: 0.5rem;
  border-left: 1.5px dashed #CBD5E1;
  margin-top: 0.1rem;
}

.instructor-tree-badge {
  font-size: 0.68rem;
  font-weight: 800;
  background: #F1F5F9;
  color: #475569;
  padding: 0.08rem 0.4rem;
  border-radius: 10px;
  border: 1px solid #CBD5E1;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-tree-toggle {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #475569;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-tree-toggle:hover {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
}

/* Planilla de Evaluación Compacta (Pills 3 Columnas) */
.eval-pill-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.25rem;
  width: 250px;
  margin: 0 auto;
}

.eval-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.3rem;
  border-radius: 5px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #64748B;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-align: center;
  user-select: none;
  line-height: 1.2;
}

.eval-pill:hover {
  border-color: #94A3B8;
  background: #F8FAFC;
}

.eval-pill.active.btn-pill-naop {
  background: #FEE2E2 !important;
  color: #991B1B !important;
  border-color: #FCA5A5 !important;
  box-shadow: 0 0 0 1.5px #EF4444 !important;
}

.eval-pill.active.btn-pill-aop {
  background: #E0F2FE !important;
  color: #0369A1 !important;
  border-color: #7DD3FC !important;
  box-shadow: 0 0 0 1.5px #0284C7 !important;
}

.eval-pill.active.btn-pill-sop {
  background: #DCFCE7 !important;
  color: #15803D !important;
  border-color: #86EFAC !important;
  box-shadow: 0 0 0 1.5px #16A34A !important;
}