/* =========================================================
   SISTEMA DE ASISTENCIA ESCOLAR V3
   ARCHIVO: estilos.css
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f9;
  color: #1f2937;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.oculto {
  display: none !important;
}


/* =========================================================
   PANTALLA DE CARGA
   ========================================================= */

.pantalla-carga {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #ffffff;
}

.carga-contenido {
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;

  margin: 0 auto 15px;

  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;

  animation: girar 0.8s linear infinite;
}

@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}


/* =========================================================
   LOGIN
   ========================================================= */

.pantalla-login {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;

  background:
    linear-gradient(
      135deg,
      #0f172a,
      #1d4ed8
    );
}

.login-card {
  width: 100%;
  max-width: 410px;

  padding: 38px 32px;

  background: #ffffff;

  border-radius: 18px;

  box-shadow:
    0 20px 50px
    rgba(0, 0, 0, 0.22);

  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;

  margin: 0 auto 18px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 38px;

  background: #eff6ff;
  border-radius: 50%;
}

.login-card h1 {
  margin: 0;

  font-size: 26px;
  color: #111827;
}

.login-subtitulo {
  margin: 8px 0 28px;

  color: #6b7280;
}

.campo {
  margin-bottom: 17px;
  text-align: left;
}

.campo label {
  display: block;

  margin-bottom: 7px;

  font-size: 14px;
  font-weight: 600;

  color: #374151;
}

.campo input {
  width: 100%;

  padding: 13px 14px;

  border: 1px solid #d1d5db;
  border-radius: 9px;

  outline: none;

  transition: 0.2s;
}

.campo input:focus {
  border-color: #2563eb;

  box-shadow:
    0 0 0 3px
    rgba(37, 99, 235, 0.12);
}

.btn-principal {
  width: 100%;

  margin-top: 4px;
  padding: 13px;

  border: 0;
  border-radius: 9px;

  background: #2563eb;
  color: #ffffff;

  font-weight: 700;
}

.btn-principal:hover {
  background: #1d4ed8;
}

.btn-principal:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.mensaje-login {
  min-height: 22px;

  margin-top: 16px;

  font-size: 14px;
}

.mensaje-login.error {
  color: #dc2626;
}

.mensaje-login.info {
  color: #2563eb;
}

.mensaje-login.exito {
  color: #15803d;
}


/* =========================================================
   ESTRUCTURA PRINCIPAL
   ========================================================= */

.sistema {
  min-height: 100vh;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
  position: fixed;

  top: 0;
  left: 0;
  bottom: 0;

  width: 260px;

  display: flex;
  flex-direction: column;

  background: #0f172a;
  color: #ffffff;

  z-index: 1000;
}

.sidebar-cabecera {
  min-height: 82px;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 16px 18px;

  border-bottom:
    1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 45px;
  height: 45px;

  flex: 0 0 45px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 25px;

  background:
    rgba(255, 255, 255, 0.1);

  border-radius: 10px;
}

.sidebar-cabecera strong {
  display: block;

  font-size: 15px;
}

.sidebar-cabecera small {
  display: block;

  margin-top: 3px;

  color: #94a3b8;
}


/* =========================================================
   MENÚ
   ========================================================= */

.menu-principal {
  flex: 1;

  padding: 14px 10px;

  overflow-y: auto;
}

.menu-item {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 12px;

  margin-bottom: 5px;

  padding: 12px 14px;

  border: 0;
  border-radius: 8px;

  background: transparent;
  color: #cbd5e1;

  text-align: left;

  transition: 0.2s;
}

.menu-item:hover {
  background:
    rgba(255, 255, 255, 0.08);

  color: #ffffff;
}

.menu-item.activo {
  background: #2563eb;
  color: #ffffff;
}

.menu-icono {
  width: 25px;

  text-align: center;

  font-size: 18px;
}

.menu-texto {
  font-size: 14px;
  font-weight: 600;
}


/* =========================================================
   PIE DEL SIDEBAR
   ========================================================= */

.sidebar-pie {
  padding: 12px;

  border-top:
    1px solid rgba(255, 255, 255, 0.1);
}

.btn-cerrar-sesion {
  width: 100%;

  padding: 11px;

  border: 0;
  border-radius: 8px;

  background:
    rgba(239, 68, 68, 0.12);

  color: #fecaca;

  font-weight: 600;
}

.btn-cerrar-sesion:hover {
  background:
    rgba(239, 68, 68, 0.22);
}


/* =========================================================
   ÁREA PRINCIPAL
   ========================================================= */

.area-principal {
  min-height: 100vh;

  margin-left: 260px;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  min-height: 82px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  padding: 12px 26px;

  background: #ffffff;

  border-bottom: 1px solid #e5e7eb;

  position: sticky;
  top: 0;

  z-index: 500;
}

.topbar-izquierda {
  display: flex;
  align-items: center;

  gap: 12px;

  min-width: 0;
}

.topbar h2 {
  margin: 0;

  font-size: 19px;
  color: #111827;
}

.institucion {
  display: block;

  margin-top: 4px;

  font-size: 13px;
  color: #6b7280;
}

.usuario-topbar {
  display: flex;
  align-items: center;

  gap: 10px;
}

.usuario-avatar {
  width: 42px;
  height: 42px;

  flex: 0 0 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #eff6ff;

  border-radius: 50%;

  font-size: 20px;
}

.usuario-datos {
  min-width: 0;
}

.usuario-datos strong {
  display: block;

  max-width: 220px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 14px;
}

.usuario-datos span {
  display: block;

  margin-top: 3px;

  font-size: 11px;
  font-weight: 700;

  color: #2563eb;
}


/* =========================================================
   BOTÓN MENÚ MÓVIL
   ========================================================= */

.btn-menu-movil {
  display: none;

  width: 42px;
  height: 42px;

  flex: 0 0 42px;

  border: 0;
  border-radius: 8px;

  background: #f1f5f9;
  color: #0f172a;

  font-size: 22px;
}


/* =========================================================
   CONTENIDO
   ========================================================= */

.contenido {
  width: 100%;

  padding: 26px;
}

.modulo {
  width: 100%;
  max-width: 1500px;

  margin: 0 auto;
}

.titulo-modulo {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 15px;

  margin-bottom: 20px;
}

.titulo-modulo h1 {
  margin: 0;

  font-size: 24px;
  color: #111827;
}

.titulo-modulo p {
  margin: 6px 0 0;

  color: #6b7280;
}


/* =========================================================
   PLACEHOLDER DE MÓDULOS
   ========================================================= */

.modulo-placeholder {
  min-height: 330px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 14px;

  box-shadow:
    0 2px 8px
    rgba(15, 23, 42, 0.04);

  text-align: center;
}

.modulo-placeholder > span {
  display: block;

  margin-bottom: 12px;

  font-size: 50px;
}

.modulo-placeholder h2 {
  margin: 0 0 8px;

  color: #111827;
}

.modulo-placeholder p {
  max-width: 500px;

  margin: 0;

  line-height: 1.6;

  color: #6b7280;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

  .sidebar {
    width: 235px;
  }

  .area-principal {
    margin-left: 235px;
  }

  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .contenido {
    padding: 20px;
  }

}


/* =========================================================
   CELULAR
   ========================================================= */

@media (max-width: 700px) {

  .sidebar {
    width: 270px;

    transform:
      translateX(-100%);

    transition:
      transform 0.25s ease;

    box-shadow:
      8px 0 25px
      rgba(0, 0, 0, 0.18);
  }

  .sidebar.abierto {
    transform:
      translateX(0);
  }

  .area-principal {
    margin-left: 0;
  }

  .btn-menu-movil {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    min-height: 72px;

    padding: 10px 12px;
  }

  .topbar h2 {
    font-size: 15px;
  }

  .institucion {
    font-size: 11px;
  }

  .usuario-avatar {
    display: none;
  }

  .usuario-datos strong {
    max-width: 110px;

    font-size: 12px;
  }

  .usuario-datos span {
    font-size: 10px;
  }

  .contenido {
    padding: 16px 12px;
  }

  .titulo-modulo {
    align-items: flex-start;
  }

  .titulo-modulo h1 {
    font-size: 21px;
  }

  .titulo-modulo p {
    font-size: 13px;
  }

  .modulo-placeholder {
    min-height: 280px;

    padding: 22px 15px;
  }

}


/* =========================================================
   CELULARES PEQUEÑOS
   ========================================================= */

@media (max-width: 420px) {

  .login-card {
    padding: 30px 20px;
  }

  .login-card h1 {
    font-size: 23px;
  }

  .topbar h2 {
    max-width: 155px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .institucion {
    max-width: 155px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

}


/* =========================================================
   PANEL GENERAL
   ========================================================= */

.btn-panel-actualizar {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;

  background: #2563eb;
  color: #ffffff;

  font-weight: 600;
}

.btn-panel-actualizar:hover {
  background: #1d4ed8;
}


/* FILTROS */

.panel-filtros {
  display: grid;

  grid-template-columns:
    repeat(5, minmax(130px, 1fr));

  gap: 14px;

  margin-bottom: 20px;

  padding: 18px;

  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.panel-filtro label {
  display: block;

  margin-bottom: 6px;

  font-size: 12px;
  font-weight: 700;

  color: #4b5563;
}

.panel-filtro input,
.panel-filtro select {
  width: 100%;

  height: 42px;

  padding: 0 11px;

  border: 1px solid #d1d5db;
  border-radius: 8px;

  background: #ffffff;

  outline: none;
}

.panel-filtro input:focus,
.panel-filtro select:focus {
  border-color: #2563eb;

  box-shadow:
    0 0 0 3px
    rgba(37, 99, 235, 0.1);
}


/* MENSAJES */

.panel-mensaje {
  margin-bottom: 18px;

  padding: 12px 15px;

  border-radius: 8px;
}

.panel-mensaje.error {
  background: #fef2f2;
  color: #b91c1c;

  border: 1px solid #fecaca;
}


/* TARJETAS */

.panel-tarjetas {
  display: grid;

  grid-template-columns:
    repeat(7, minmax(120px, 1fr));

  gap: 12px;

  margin-bottom: 20px;
}

.panel-tarjeta {
  min-height: 95px;

  display: flex;
  flex-direction: column;
  justify-content: center;

  padding: 16px;

  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 12px;

  box-shadow:
    0 2px 7px
    rgba(15, 23, 42, 0.04);
}

.panel-tarjeta span {
  margin-bottom: 7px;

  font-size: 12px;
  font-weight: 600;

  color: #6b7280;
}

.panel-tarjeta strong {
  font-size: 27px;

  color: #111827;
}

.panel-tarjeta-porcentaje strong {
  color: #2563eb;
}


/* TABLA */

.panel-tabla-contenedor {
  width: 100%;

  overflow-x: auto;

  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.panel-tabla {
  width: 100%;

  min-width: 700px;

  border-collapse: collapse;
}

.panel-tabla th {
  padding: 13px 14px;

  background: #f8fafc;

  border-bottom: 1px solid #e5e7eb;

  text-align: left;

  font-size: 12px;
  color: #475569;

  white-space: nowrap;
}

.panel-tabla td {
  padding: 13px 14px;

  border-bottom: 1px solid #f1f5f9;

  font-size: 13px;

  vertical-align: middle;
}

.panel-tabla tbody tr:last-child td {
  border-bottom: 0;
}

.panel-tabla tbody tr:hover {
  background: #f8fafc;
}

.tabla-vacia {
  padding: 35px !important;

  text-align: center !important;

  color: #6b7280;
}


/* ESTADOS */

.estado-asistencia {
  display: inline-flex;

  min-width: 34px;
  height: 30px;

  align-items: center;
  justify-content: center;

  padding: 0 10px;

  border-radius: 20px;

  font-size: 12px;
  font-weight: 800;
}

.estado-puntual {
  background: #dcfce7;
  color: #166534;
}

.estado-tardanza {
  background: #fef3c7;
  color: #92400e;
}

.estado-falta {
  background: #fee2e2;
  color: #991b1b;
}

.estado-justificado {
  background: #dbeafe;
  color: #1e40af;
}


/* =========================================================
   PANEL - TABLET
   ========================================================= */

@media (max-width: 1200px) {

  .panel-tarjetas {
    grid-template-columns:
      repeat(4, 1fr);
  }

  .panel-filtros {
    grid-template-columns:
      repeat(3, 1fr);
  }

  .panel-filtro-buscar {
    grid-column: span 2;
  }
}


/* =========================================================
   PANEL - CELULAR
   ========================================================= */

@media (max-width: 700px) {

  .titulo-modulo {
    flex-wrap: wrap;
  }

  .btn-panel-actualizar {
    width: 100%;
  }

  .panel-filtros {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    padding: 12px;
    gap: 10px;
  }

  .panel-filtro-buscar {
    grid-column: 1 / -1;
  }

  .panel-tarjetas {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 9px;
  }

  .panel-tarjeta {
    min-height: 82px;

    padding: 12px;
  }

  .panel-tarjeta strong {
    font-size: 23px;
  }

  .panel-tabla {
    min-width: 650px;
  }
}


/* CELULAR PEQUEÑO */

@media (max-width: 420px) {

  .panel-filtros {
    grid-template-columns: 1fr;
  }

  .panel-filtro-buscar {
    grid-column: auto;
  }

  .panel-tarjetas {
    grid-template-columns:
      repeat(2, 1fr);
  }
}


/* =========================================================
   PAGINACIÓN DEL PANEL
   ========================================================= */

.panel-paginacion {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 15px;

  padding: 15px;

  border-top: 1px solid #e5e7eb;
}

.panel-paginacion button {
  padding: 9px 15px;

  border: 1px solid #d1d5db;
  border-radius: 7px;

  background: #ffffff;
  color: #374151;

  font-weight: 600;
}

.panel-paginacion button:hover:not(:disabled) {
  background: #f1f5f9;
}

.panel-paginacion button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.panel-paginacion span {
  font-size: 13px;
  font-weight: 600;

  color: #475569;
}

@media (max-width: 500px) {

  .panel-paginacion {
    gap: 8px;
  }

  .panel-paginacion button {
    padding: 8px 10px;
    font-size: 12px;
  }

  .panel-paginacion span {
    font-size: 11px;
    text-align: center;
  }
}


/* =========================================================
   MÓDULO ASISTENCIA
   ========================================================= */

.asistencia-contenedor {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}


/* MODOS */

.asistencia-modos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.asistencia-modo {
  display: flex;
  align-items: center;
  gap: 13px;

  padding: 15px;

  border: 1px solid #d1d5db;
  border-radius: 12px;

  background: #ffffff;
  color: #374151;

  text-align: left;
}

.asistencia-modo > span {
  font-size: 27px;
}

.asistencia-modo strong {
  display: block;
  margin-bottom: 3px;
}

.asistencia-modo small {
  display: block;
  color: #6b7280;
}

.asistencia-modo.activo {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}


/* PANEL LECTOR / CÁMARA */

.asistencia-panel {
  padding: 28px;

  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 14px;

  text-align: center;
}

.asistencia-panel-icono {
  font-size: 45px;
  margin-bottom: 8px;
}

.asistencia-panel h2 {
  margin: 0 0 7px;
}

.asistencia-panel p {
  margin: 0 0 20px;
  color: #6b7280;
}


/* LECTOR */

.asistencia-input-qr {
  width: 100%;
  max-width: 550px;

  padding: 15px;

  border: 2px solid #cbd5e1;
  border-radius: 10px;

  outline: none;

  text-align: center;
  font-size: 18px;
}

.asistencia-input-qr:focus {
  border-color: #2563eb;

  box-shadow:
    0 0 0 4px
    rgba(37, 99, 235, 0.1);
}

.asistencia-lector-estado {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 7px;

  margin-top: 14px;

  font-size: 13px;
  color: #64748b;
}

.punto-activo {
  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: #22c55e;

  box-shadow:
    0 0 0 4px
    rgba(34, 197, 94, 0.12);
}


/* RESULTADO */

.asistencia-resultado {
  display: flex;
  align-items: center;

  gap: 18px;

  margin-top: 18px;
  padding: 20px;

  border-radius: 14px;
  border: 1px solid #e5e7eb;

  background: #ffffff;
}

.asistencia-resultado-icono {
  width: 65px;
  height: 65px;

  flex: 0 0 65px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  font-size: 32px;
}

.asistencia-resultado-info {
  min-width: 0;
  flex: 1;
}

.asistencia-resultado-etiqueta {
  display: block;

  margin-bottom: 5px;

  font-size: 11px;
  font-weight: 700;

  color: #64748b;
}

.asistencia-resultado h2 {
  margin: 0 0 10px;

  font-size: 21px;
}

.asistencia-resultado-datos {
  display: flex;
  align-items: center;

  gap: 12px;

  flex-wrap: wrap;
}

.asistencia-resultado-datos span,
.asistencia-resultado-datos strong {
  padding: 5px 10px;

  border-radius: 6px;

  background: #f1f5f9;

  font-size: 13px;
}


/* ESPERANDO */

.asistencia-espera
.asistencia-resultado-icono {
  background: #f1f5f9;
  color: #64748b;
}


/* ÉXITO */

.asistencia-exito {
  border-color: #86efac;
  background: #f0fdf4;
}

.asistencia-exito
.asistencia-resultado-icono {
  background: #dcfce7;
  color: #15803d;
}

.asistencia-exito
#asistenciaResultadoEstado {
  background: #dcfce7;
  color: #166534;
}


/* ERROR */

.asistencia-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.asistencia-error
.asistencia-resultado-icono {
  background: #fee2e2;
  color: #dc2626;
}


/* MENSAJES */

.asistencia-mensaje {
  margin-top: 12px;

  padding: 11px 14px;

  border-radius: 8px;

  text-align: center;

  font-size: 13px;
}

.asistencia-mensaje.exito {
  background: #dcfce7;
  color: #166534;
}

.asistencia-mensaje.error {
  background: #fee2e2;
  color: #991b1b;
}

.asistencia-mensaje.info {
  background: #dbeafe;
  color: #1e40af;
}


/* =========================================================
   CÁMARA
   ========================================================= */

.asistencia-camara {
  position: relative;

  width: 100%;
  max-width: 500px;

  aspect-ratio: 4 / 3;

  margin: 0 auto 15px;

  overflow: hidden;

  border-radius: 14px;

  background: #111827;
}

.asistencia-camara video {
  width: 100%;
  height: 100%;

  object-fit: cover;
}

.asistencia-marco-qr {
  position: absolute;

  width: 220px;
  height: 220px;

  top: 50%;
  left: 50%;

  transform:
    translate(-50%, -50%);
}

.esquina {
  position: absolute;

  width: 42px;
  height: 42px;

  border-color: #ffffff;
  border-style: solid;
}

.e1 {
  top: 0;
  left: 0;

  border-width: 4px 0 0 4px;
}

.e2 {
  top: 0;
  right: 0;

  border-width: 4px 4px 0 0;
}

.e3 {
  bottom: 0;
  left: 0;

  border-width: 0 0 4px 4px;
}

.e4 {
  right: 0;
  bottom: 0;

  border-width: 0 4px 4px 0;
}


/* BOTONES CÁMARA */

.btn-asistencia-camara,
.btn-asistencia-secundario {
  padding: 11px 17px;

  border: 0;
  border-radius: 8px;

  font-weight: 700;
}

.btn-asistencia-camara {
  background: #2563eb;
  color: #ffffff;
}

.btn-asistencia-secundario {
  margin-left: 7px;

  background: #e5e7eb;
  color: #374151;
}


/* =========================================================
   CELULAR
   ========================================================= */

@media (max-width: 600px) {

  .asistencia-modos {
    grid-template-columns: 1fr;
  }

  .asistencia-modo {
    padding: 12px;
  }

  .asistencia-panel {
    padding: 20px 12px;
  }

  .asistencia-input-qr {
    font-size: 16px;
  }

  .asistencia-resultado {
    align-items: flex-start;

    padding: 15px;

    gap: 12px;
  }

  .asistencia-resultado-icono {
    width: 48px;
    height: 48px;

    flex-basis: 48px;

    font-size: 24px;
  }

  .asistencia-resultado h2 {
    font-size: 17px;
  }

  .asistencia-marco-qr {
    width: 190px;
    height: 190px;
  }
}