/* ===================================
    VARIABLES Y RESET BASE
=================================== */
* {
  box-sizing: border-box;
}

/* ===================================
    CONTENEDORES PRINCIPALES
=================================== */
.crud-box,
.registro-estudiante,
.consulta-diplomas-wrapper {
  max-width: 700px;
  margin: 40px auto;
  padding: 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  font-family: system-ui;
}

.consulta-diplomas-wrapper,
#listado-matriculas,
#listado-diplomas,
#listado-estudiantes {
  max-width: 100%;
  margin-top: 2rem;
  padding: 0;
}

/* ===================================
    CAMPOS DE FORMULARIO
=================================== */
.campo {
  margin-bottom: 16px;
}

.campo label,
.consulta-diplomas-form label {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
  color: #1e293b;
  font-size: 14px;
}

.campo input,
.campo select,
.consulta-diplomas-form input {
  width: 100%;
  padding: 0.5rem 1rem;
  border-radius: 10px !important;
  border: 1px solid #cbd5e1;
  font-size: 15px;
  transition: all 0.2s ease;
}

.campo input:focus,
.campo select:focus,
.consulta-diplomas-form input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primario,
.btn-primary {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #2563eb, #1e40af) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
  transition: all 0.25s ease;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.btn-primario:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.35);
  transition: all 0.25s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(16, 185, 129, 0.45);
}

.btn-editar-matricula,
.btn-editar-acta,
.btn-editar-diploma {
  padding: 8px 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
  text-decoration: none;
  display: inline-block;
}

.btn-editar-matricula:hover,
.btn-editar-acta:hover,
.btn-editar-diploma:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(245, 158, 11, 0.4);
}

.btn-pdf-matricula,
.btn-pdf-acta,
.btn-pdf-diploma {
  padding: 8px 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
  text-decoration: none;
  display: inline-block;
}

.btn-pdf-matricula:hover,
.btn-pdf-acta:hover,
.btn-pdf-diploma:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.btn-seleccionar-matricula {
  padding: 8px 16px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
  text-decoration: none;
  display: inline-block;
}

.btn-seleccionar-matricula:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4);
}

.btn-whatsapp {
  padding: 8px 24px 8px 8px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
  text-decoration: none;
  display: inline-block;
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(37, 211, 102, 0.4);
}

.resultado {
  margin-top: 16px;
  text-align: center;
}

.resultado.ok {
  color: #16a34a;
}

.resultado.error {
  color: #dc2626;
}

.login-error {
  background: rgba(255, 80, 80, 0.15);
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 5px;
  font-size: 14px;
}

.info-estudiante,
.consulta-diplomas-estudiante {
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.4;
}

.consulta-diplomas-estudiante {
  padding: 20px;
  border-radius: 12px;
  margin: 1.5rem 1rem;
  line-height: 1.8;
}

.info-estudiante strong,
.consulta-diplomas-estudiante strong {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  color: #0f172a;
}

.info-estudiante span {
  color: #475569;
}

.filtros-matriculas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: center;
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.consulta-diplomas-form {
  margin-bottom: 24px;
  padding: 1.5rem 1rem;
}

.consulta-diplomas-form button {
  margin-top: 0.5rem;
}

.tabla-diplomas-consulta-wrapper {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
  max-height: 220px;
  margin-bottom: 1.5rem;
  font-size: 12px;
}
.consulta-diplomas-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(135deg, #1e40af, #2563eb);
}
.consulta-diplomas-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
  transition:
    backgraund 0.2s ease,
    box-shadow 0.2s ease;
}
.consulta-diplomas-table tbody tr:hover {
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tabla-matriculas-wrapper,
.tabla-estudiantes-wrapper {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.tabla-matriculas,
.tabla-estudiantes,
.tabla-actas,
.consulta-diplomas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tabla-matriculas thead,
.tabla-estudiantes thead,
.tabla-actas thead,
.consulta-diplomas-table thead {
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: white;
}
.tabla-matriculas th,
.tabla-estudiantes th,
.tabla-actas th,
.consulta-diplomas-table th {
  padding: 16px 12px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  color: white;
}
.tabla-matriculas tbody tr,
.tabla-estudiantes tbody tr,
.tabla-actas tbody tr {
  border-bottom: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}
.tabla-matriculas tbody tr:hover,
.tabla-estudiantes tbody tr:hover,
.tabla-actas tbody tr:hover {
  background: #f8fafc;
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.tabla-matriculas tbody tr:last-child,
.tabla-estudiantes tbody tr:last-child,
.tabla-actas tbody tr:last-child,
.consulta-diplomas-table tbody tr:last-child {
  border-bottom: none;
}
.tabla-matriculas td,
.tabla-estudiantes td,
.tabla-actas td,
.consulta-diplomas-table td {
  padding: 14px 12px;
  color: #475569;
  vertical-align: middle;
  text-align: center;
}
.tabla-matriculas td:first-child,
.tabla-estudiantes td:first-child,
.consulta-diplomas-table td:first-child {
  font-weight: 600;
  color: #1e293b;
}

.tabla-estudiantes td:first-child,
.tabla-matriculas td:first-child,
.tabla-diplomas td:first-child,
.consulta-diplomas-table td:first-child,
.tabla-actas td:first-child {
  font-weight: 700;
  color: #2563eb;
}

.tabla-matriculas th:last-child,
.tabla-matriculas td:last-child,
.tabla-estudiantes th:last-child,
.tabla-estudiantes td:last-child {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

.tabla-matriculas tbody td[colspan],
.tabla-estudiantes tbody td[colspan],
.consulta-diplomas-resultado > p {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 15px;
  font-style: italic;
}

.acciones-diploma-wrap {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

#paginacion-actas,
#paginacion-matriculas,
#paginacion-diplomas,
#paginacion-estudiantes,
#paginacion-jl {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-pagina {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: #f1f5f9;
  color: #475569;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pagina:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-pagina.activo {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: white;
  border-color: #1e40af;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.pagina-dots {
    pointer-events: none;
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 0 4px;
}

#form-edicion-acta {
  margin-top: 2rem;
  display: none;
}

#form-edicion-acta .crud-box {
  max-width: 700px;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.tabla-matriculas tbody tr td[colspan]:contains("Cargando") {
  animation: pulse 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
  .crud-box,
  .registro-estudiante,
  .consulta-diplomas-wrapper {
    padding: 20px;
  }

  .filtros-matriculas {
    grid-template-columns: 1fr;
  }

  .filtros-matriculas .acciones {
    flex-direction: column;
  }

  .tabla-matriculas-wrapper,
  .tabla-estudiantes-wrapper,
  .tabla-diplomas-consulta-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tabla-matriculas,
  .tabla-estudiantes {
    min-width: 800px;
  }

  .tabla-actas,
  .consulta-diplomas-table {
    min-width: 500px;
  }
}