/* ================================================================
   Gráficos de Notas · ProfeAcademī
   Estilos exclusivos de la app (no pisa estilos globales)
   ================================================================ */

.gn-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
}

.gn-view { display: none; }
.gn-view.active { display: block; }
.gn-view[hidden] { display: none !important; }

/* ───────────── Chip de sesión ───────────── */
.pa-mini-actions {
  position: fixed; top: 1rem; right: 1rem; z-index: 1000;
  display: flex; gap: .5rem; align-items: center;
}
.pa-mini-back {
  padding: .5rem 1rem; background: white;
  color: #475569; border: 1px solid rgba(0,0,0,.1); border-radius: 10px;
  font-size: .85rem; font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.pa-mini-back:hover { box-shadow: 0 6px 16px rgba(0,0,0,.1); transform: translateY(-1px); }
.pa-mini-chip {
  display: none; align-items: center; gap: .5rem;
  padding: .45rem .9rem; background: white;
  border: 1px solid rgba(0,0,0,.08); border-radius: 12px;
  color: #1f2937; font-size: .85rem; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.pa-mini-chip.visible { display: inline-flex; }
.pa-mini-rol {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 7px;
  font-size: .62rem; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: white;
}
.pa-mini-rol.rol-admin     { background: rgb(255,56,86); }
.pa-mini-rol.rol-asistente { background: rgb(251,191,36); color: #422006; }
.pa-mini-rol.rol-profesor  { background: rgb(56,139,253); }
.pa-mini-rol.rol-utp       { background: rgb(31,41,55); }
.pa-mini-rol.rol-pendiente { background: rgb(156,163,175); }
.pa-mini-logout {
  padding: .35rem .7rem; background: #f1f5f9;
  color: #475569; border: 1px solid rgba(0,0,0,.1); border-radius: 8px;
  font-size: .75rem; font-weight: 600; cursor: pointer;
}

/* ───────────── Subida ───────────── */
.gn-upload-card {
  background: var(--bg-card, #fff);
  border: 2px dashed rgba(255, 193, 7, .35);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all .2s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.gn-upload-card.drag-over {
  border-color: #ffc107;
  background: rgba(255, 193, 7, .06);
  transform: scale(1.01);
}
.gn-upload-icon { color: #ffc107; margin-bottom: 1rem; }
.gn-upload-card h2 { margin: 0 0 .5rem; font-size: 1.6rem; color: var(--text-primary, #1f2937); }
.gn-upload-card > p { color: var(--text-secondary, #6b7280); margin: 0 0 1rem; }

.gn-formats { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin: 1rem 0 1.5rem; }
.format-tag {
  background: rgba(255, 193, 7, .1); color: #ffc107;
  padding: .25rem .75rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
}

.gn-hint { margin-top: .8rem; color: var(--text-muted, #9ca3af); font-size: .85rem; }
.gn-error {
  margin-top: 1rem; padding: .8rem 1rem;
  background: #fef2f2; color: #b91c1c;
  border: 1px solid #fecaca; border-radius: 10px;
  font-size: .9rem;
}

.btn-primary {
  background: linear-gradient(135deg, #ffc107, #ffd54f);
  color: white; border: none;
  padding: .75rem 1.5rem; border-radius: 12px;
  font-weight: 700; font-size: .95rem;
  cursor: pointer; transition: all .2s ease;
  box-shadow: 0 6px 16px rgba(255, 193, 7, .3);
  display: inline-flex; align-items: center; gap: .5rem;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255, 193, 7, .4); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ───────────── Reportes guardados ───────────── */
.gn-saved-card {
  margin-top: 1.5rem;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.05);
}
.gn-saved-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.gn-saved-head h3 { margin: 0; font-size: 1.1rem; color: var(--text-primary, #1f2937); }
.gn-btn-ghost {
  background: transparent; border: 1px solid rgba(0,0,0,.1);
  padding: .45rem .9rem; border-radius: 10px;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  color: var(--text-secondary, #475569);
}
.gn-btn-ghost:hover { background: rgba(0,0,0,.04); }

.gn-saved-list { display: flex; flex-direction: column; gap: .6rem; }
.gn-saved-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1rem;
  background: rgba(255, 193, 7, .05);
  border: 1px solid rgba(255, 193, 7, .15);
  border-radius: 10px;
}
.gn-saved-item .gn-saved-info { display: flex; flex-direction: column; gap: .2rem; }
.gn-saved-item strong { color: var(--text-primary, #1f2937); }
.gn-saved-item small { color: var(--text-muted, #9ca3af); }
.gn-saved-item-actions { display: flex; gap: .4rem; }
.gn-saved-item button {
  background: white; border: 1px solid rgba(0,0,0,.1);
  padding: .35rem .7rem; border-radius: 8px;
  font-size: .8rem; cursor: pointer;
}
.gn-saved-item button.danger { color: #dc2626; border-color: #fecaca; }
.gn-muted { color: var(--text-muted, #9ca3af); font-size: .9rem; }

/* ───────────── Toolbar reporte ───────────── */
.gn-report-toolbar {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: center;
  background: var(--bg-card, #fff);
  padding: 1rem 1.25rem;
  border-radius: 14px;
  margin-bottom: 1.25rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.05);
}
.gn-report-meta {
  display: flex; flex-wrap: wrap; gap: 1rem;
  font-size: .9rem; color: var(--text-secondary, #475569);
}
.gn-report-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ───────────── Canvas del reporte ───────────── */
.gn-report-canvas {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.06);
}

.gn-report-header {
  text-align: center;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
.gn-report-header h2 { margin: 0 0 .3rem; color: #1f2937; }
.gn-report-header p { margin: 0; color: #6b7280; }

.gn-section {
  margin-bottom: 2rem;
  padding: 1rem;
  border: 1px solid #f0f0f5;
  border-radius: 12px;
  background: #fafafa;
}
.gn-section-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .8rem;
  margin-bottom: 1rem;
}
.gn-section-head h3 { margin: 0; color: #1f2937; font-size: 1.15rem; }

.gn-section-stats { display: flex; gap: .6rem; flex-wrap: wrap; }
.gn-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700;
}
.gn-pill.insuficiente { background: #fee2e2; color: #b91c1c; }
.gn-pill.elemental    { background: #fef3c7; color: #92400e; }
.gn-pill.adecuado     { background: #d1fae5; color: #065f46; }

.gn-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.gn-chart-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: .9rem;
  display: flex; flex-direction: column;
}
.gn-chart-card-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; color: #475569; font-size: .9rem;
  margin-bottom: .6rem;
}
.gn-chart-box {
  position: relative;
  height: 280px;
  width: 100%;
}
.gn-btn-icon {
  background: #f1f5f9; border: 1px solid rgba(0,0,0,.08);
  width: 30px; height: 30px; border-radius: 8px;
  cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.gn-btn-icon:hover { background: #e2e8f0; }

/* ───────────── Tabla ───────────── */
.gn-table-wrap { overflow-x: auto; }
.gn-table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
.gn-table thead th {
  background: #f8fafc;
  color: #1f2937; font-weight: 700;
  text-align: left;
  padding: .65rem .8rem;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.gn-table tbody td {
  padding: .55rem .8rem;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
}
.gn-table tbody tr:hover { background: #fafbff; }
.gn-table .nivel-cell { font-weight: 700; }
.gn-table .nivel-insuficiente { color: #b91c1c; }
.gn-table .nivel-elemental    { color: #92400e; }
.gn-table .nivel-adecuado     { color: #065f46; }

/* ───────────── Loading ───────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; z-index: 9999;
  color: white;
}
.loading-overlay[hidden] { display: none !important; }
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: white;
  border-radius: 50%;
  animation: gn-spin .9s linear infinite;
}
@keyframes gn-spin { to { transform: rotate(360deg); } }

/* ───────────── Toasts ───────────── */
.gn-toasts {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .6rem;
  z-index: 10000;
}
.gn-toast {
  background: #1f2937; color: white;
  padding: .8rem 1.1rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  animation: gn-slide-in .25s ease;
  max-width: 360px;
}
.gn-toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.gn-toast.error   { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.gn-toast.info    { background: linear-gradient(135deg, #4338ca, #6366f1); }
@keyframes gn-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ───────────── Tema oscuro ───────────── */
body.theme-dark .gn-upload-card,
body.theme-dark .gn-saved-card,
body.theme-dark .gn-report-toolbar {
  background: #1e1b2f;
  color: #e5e7eb;
}
body.theme-dark .gn-saved-item { background: rgba(255, 193, 7, .15); }
body.theme-dark .gn-btn-ghost { color: #d1d5db; border-color: rgba(255,255,255,.15); }

/* Responsive */
@media (max-width: 720px) {
  .gn-report-toolbar { flex-direction: column; align-items: stretch; }
  .gn-report-actions { justify-content: stretch; }
  .gn-report-actions .btn-primary { flex: 1; justify-content: center; }
  .gn-chart-box { height: 240px; }
}
