/* components.css — cursos, tareas, alumnos, botones compartidos */

/* ─── Botones de acción ──────────────────────────────────────────────────── */
.btn-action {
  padding: 6px 14px; border-radius: 8px; font-size: 12px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  border: none; white-space: nowrap;
}
.btn-action.primary { background: #1a1f3c; color: #ffffff; font-size: 14px; }
.btn-action.primary:hover { background: #1a1f3cda;border-color: rgba(26, 30, 56, 0.56); }
.btn-action.secondary { background: none; border: 0.5px solid rgba(0,0,0,.18); color: #444; }
.btn-action.secondary:hover { border-color: rgba(0,0,0,.35); }
.btn-action.danger { background: none; border: 0.5px solid #A32D2D; color: #A32D2D; }
.btn-action.danger:hover { background: #A32D2D; color: #fff; }

.icon-btn {
  background: none; border: 0.5px solid rgba(0,0,0,.15); border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #666;
}
.icon-btn:hover { border-color: rgba(0,0,0,.3); color: #111; }
.icon-btn.del:hover { border-color: #A32D2D; color: #A32D2D; }
.icon-btn:disabled { opacity: .3; cursor: default; pointer-events: none; }

/* ─── Secciones de curso ─────────────────────────────────────────────────── */
.course-section {
  background: #ffffff; border: 0.6px solid rgba(0,0,0,.12);
  border-radius: 12px; margin-bottom: 12px; overflow: hidden;
  box-shadow: 5px 5px 5px 4px rgba(0, 0, 0, 0.262);
}
.course-header {
  padding: 1rem 1.25rem; display: flex; align-items: center;
  justify-content: space-between; cursor: pointer; user-select: none;
}
.course-header:hover { background: rgba(0,0,0,.025); }
.course-title-wrap { display: flex; align-items: center; gap: 10px; }
.course-title-wrap span { font-size: 14px; font-weight: 500; }
.course-meta { font-size: 12px; color: #666; margin-top: 2px; }
.chevron { font-size: 14px; color: #888; transition: transform .2s; display: inline-block; }
.chevron.open { transform: rotate(180deg); }

.tasks-list { border-top: 0.5px solid rgba(0,0,0,.1); padding: .75rem 1.25rem; display: none; flex-direction: column; gap: 8px; }
.tasks-list.open { display: flex; }

/* ─── Ítem de tarea ──────────────────────────────────────────────────────── */
.task-item {
  background: #fff;
  border-radius: 14px;
  padding: .9rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 2px 2px 2px 1px rgba(0,0,0,.278);
  transition: box-shadow .15s, transform .1s;
}
.task-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.task-check {
  width: 18px; height: 18px; border: 1.5px solid rgba(0,0,0,.25);
  border-radius: 4px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; transition: background .15s;
}
.task-check.done { background: #6f9143; border-color: #6f9143; }
.task-check.done::after {
  content: ''; display: block; width: 5px; height: 9px;
  border: 2px solid #E6F1FB; border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px,-1px);
}

.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 13px; font-weight: 500; }
.task-name.done { text-decoration: line-through; color: #888; }
.task-desc { font-size: 13px; color: #5b5b5b; margin-top: 2px; line-height: 1.5; }

.task-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.task-due { font-size: 12px; color: #5b5b5b; white-space: nowrap; }
.task-due.overdue { color: #A32D2D; }

.task-actions { display: flex; gap: 6px; margin-left: 4px; flex-shrink: 0; }

.pgn-badge {
  font-size: 11px; background: #f0e6ff; color: #5a2d9c;
  border-radius: 12px; padding: 2px 8px;
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px; cursor: pointer; border: none;
}
.pgn-badge:hover { background: #e0d0ff; }

.teacher-course-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px; margin-bottom: 4px;
}
.btn-add-task {
  background: #185FA5; color: #E6F1FB; border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-add-task:hover { background: #0C447C; }

/* ─── Tabla de alumnos ───────────────────────────────────────────────────── */
.students-toolbar { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.students-toolbar input {
  flex: 1; min-width: 160px; font-size: 13px; padding: 6px 10px;
  border: 0.5px solid rgba(0,0,0,.18); border-radius: 8px;
}
.students-table {
  background: #ffffff; border: 0.5px solid rgba(0,0,0,.12);
  border-radius: 12px; overflow: hidden;
}
.st-head {
  display: grid; grid-template-columns: 2fr 2fr 1.2fr 1fr auto;
  padding: 10px 1rem; background: #f9f9f6;
  border-bottom: 0.5px solid rgba(0,0,0,.08);
}
.st-head span { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .03em; }
.st-row {
  display: grid; grid-template-columns: 2fr 2fr 1.2fr 1fr auto;
  padding: 10px 1rem; border-bottom: 0.5px solid rgba(0,0,0,.06); align-items: center;
}
.st-row:last-child { border-bottom: none; }
.st-row:hover { background: rgba(0,0,0,.02); }
.st-cell { font-size: 13px; color: #222; }
.st-cell.muted { color: #888; font-size: 12px; }
.st-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff; margin-right: 8px; flex-shrink: 0;
}
.st-name-cell { display: flex; align-items: center; }
.st-actions { display: flex; gap: 5px; }

/* ─── Panel de mensajes de contacto ─────────────────────────────────────── */
.msg-card {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg-card:hover { border-color: rgba(0,0,0,.22); }

.msg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.msg-name {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}
.msg-date {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}
.msg-email {
  font-size: 12px;
  color: #555;
}
.msg-subject {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  background: #E6F1FB;
  color: #185FA5;
  border-radius: 20px;
  padding: 2px 10px;
  align-self: flex-start;
}
.msg-body {
  font-size: 13px;
  color: #333;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}
.msg-empty {
  font-size: 13px;
  color: #888;
  padding: 2rem 0;
  text-align: center;
}
.msg-error { color: #A32D2D; }

/* ─── Checkboxes de alumnos (modal) ──────────────────────────────────────── */
.students-check { display: flex; flex-direction: column; gap: 6px; }
.student-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.student-row input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }

/* ─── Insignias — barra y tabs (profesor) ───────────────────────────────── */
.badges-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.badges-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,.1);
  padding-bottom: 0;
}

.badges-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  font-family: inherit;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badges-tab:hover { color: #444; }
.badges-tab.active { color: #185FA5; border-bottom-color: #185FA5; }

.badges-tab-count {
  background: #e53030;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* ─── Grid de insignias (profesor) ──────────────────────────────────────── */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.badge-card {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 5px 5px 5px 4px rgba(0, 0, 0, 0.262);
  transition: box-shadow .15s;
}
.badge-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); background: rgba(61, 59, 59, 0.525); }

.badge-card-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 10px;
  background: #f0f2f7;
}

.badge-card-img-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: #f0f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.badge-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1f3c;
  text-align: center;
}

.badge-card-meta {
  font-size: 11px;
  color: #888;
  text-align: center;
}

.badge-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* ─── Sección pendientes de otorgar ─────────────────────────────────────── */
.badges-pending-group {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.badges-pending-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1f3c;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badges-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(0,0,0,.06);
  gap: 12px;
}
.badges-pending-row:last-child { border-bottom: none; padding-bottom: 0; }

.badges-pending-student {
  font-size: 13px;
  color: #333;
  flex: 1;
}

/* ─── Sección progreso alumnos ───────────────────────────────────────────── */
.badges-progress-group {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.badges-progress-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1f3c;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 0.5px solid rgba(0,0,0,.07);
  padding-bottom: 8px;
}

.badge-progress-thumb {
  width: 24px; height: 24px;
  object-fit: contain; border-radius: 4px;
}

.badges-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(0,0,0,.06);
}
.badges-progress-row:last-child { border-bottom: none; padding-bottom: 0; }

.badges-progress-student { font-size: 13px; color: #333; flex: 1; }
.progress-email { font-size: 11px; color: #aaa; }

.badges-no-tasks { font-size: 13px; color: #aaa; margin: 4px 0 0; }

/* Pills de progreso */
.bp-pill {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.bp-granted { background: #eaf3de; color: #27500a; }
.bp-review  { background: #faeeda; color: #633806; }
.bp-partial { background: #e6f1fb; color: #0c447c; }
.bp-none    { background: #f2f2f2; color: #999; }

/* ─── Grid de insignias (alumno) ────────────────────────────────────────── */
.insig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.insig-card {
  position: relative;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  transition: box-shadow .15s, border-color .15s;
}
.insig-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.11); }

.insig-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 10px;
}

.insig-img-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  background: #f0f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.insig-name {
  font-size: 12px;
  font-weight: 600;
  color: #1a1f3c;
  text-align: center;
  line-height: 1.4;
}

/* Estado: sin empezar */
.insig-silhouette .insig-img,
.insig-silhouette .insig-img-placeholder {
  filter: grayscale(100%) opacity(0.25);
  box-shadow: none;
}
.insig-silhouette .insig-name { color: #bbb; }

/* Estado: en progreso */
.insig-progress .insig-img,
.insig-progress .insig-img-placeholder {
  filter: grayscale(60%) opacity(0.55);
}
.insig-progress .insig-name { color: #888; }

/* Estado: en revisión — imagen sigue oculta hasta que el profesor otorgue */
.insig-review .insig-img,
.insig-review .insig-img-placeholder {
  filter: grayscale(100%) opacity(0.35);
}
.insig-review .insig-name { color: #888; }
.insig-review {
  border-color: #E8860C;
  animation: insig-pulse-review 1.8s ease-in-out infinite;
}
@keyframes insig-pulse-review {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,134,12,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(232,134,12,0); }
}

/* Estado: obtenida */
.insig-earned {
  border-color: #C9943A;
  box-shadow: 0 0 0 2px rgba(201,148,58,0.25), 0 4px 14px rgba(0,0,0,.1);
}

/* Tooltip en hover */
.insig-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,30,0.92);
  color: #fff;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: normal;
  max-width: 200px;
  text-align: center;
  z-index: 20;
  pointer-events: none;
  line-height: 1.45;
}
.insig-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(20,20,30,0.92);
}
.insig-card:hover .insig-tooltip { display: block; }

/* Badge checklist en el modal */
.badge-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
}
.badge-task-row input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.badge-task-course-group { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 4px; }
.badge-task-course-group:first-child { margin-top: 0; }

/* Empty state insignias */
.badges-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #aaa;
  font-size: 13px;
}
.badges-empty-icon { font-size: 48px; margin-bottom: 0.75rem; }
.badges-empty-msg { font-size: 15px; font-weight: 500; color: #666; margin-bottom: 6px; }

/* ─── Tabla de alumnos responsive ───────────────────────────────────────── */
@media (max-width: 680px) {
  .st-head,
  .st-row { grid-template-columns: 2fr 1.2fr auto; }
  .st-head > *:nth-child(2),
  .st-row  > *:nth-child(2),
  .st-head > *:nth-child(4),
  .st-row  > *:nth-child(4) { display: none; }
}

/* ─── Partidas – tarjetas compactas en móvil ─────────────────────────────── */
@media (max-width: 480px) {
  .game-thumb      { width: 52px; height: 52px; }
  .games-stat-card { min-width: 110px; padding: .75rem 1rem; }
  .games-stat-num  { font-size: 18px; }
}

/* ─── Sección Mis partidas (alumno) ─────────────────────────────────────── */
.games-stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.games-stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  flex: 1;
  min-width: 130px;
}

.games-stat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.games-icon-blue  { background: #E6F1FB; color: #185FA5; }
.games-icon-green { background: #EAF3DE; color: #27500A; }
.games-icon-amber { background: #FEF5E7; color: #854F0B; }
.games-icon-gold  { background: #FEF3CD; color: #7B5E00; }
.games-icon-dark  { background: #E8EAF0; color: #1a1f3c; }

.games-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: #1a1f3c;
  line-height: 1;
  margin-bottom: 2px;
}

.games-stat-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

/* Toolbar: search + filters */
.games-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.games-search-wrap {
  flex: 1;
  min-width: 180px;
  position: relative;
  display: flex;
  align-items: center;
}

.games-search-icon {
  position: absolute;
  left: 10px;
  color: #aaa;
  pointer-events: none;
}

.games-search {
  width: 100%;
  padding: 9px 12px 9px 32px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #222;
  outline: none;
  transition: border-color .13s;
}
.games-search:focus { border-color: #185FA5; }

.games-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gfilter {
  padding: 7px 14px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  color: #555;
  cursor: pointer;
  transition: background .13s, border-color .13s, color .13s;
  white-space: nowrap;
}
.gfilter:hover { border-color: rgba(0,0,0,.25); color: #222; }
.gfilter.active {
  background: #1a1f3c;
  border-color: #1a1f3c;
  color: #fff;
  font-weight: 600;
}

/* Game cards list */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-card {
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: 5px 5px 5px 2px rgba(0, 0, 0, 0.262);
  transition: box-shadow .15s, transform .1s;
  text-decoration: none;
}
.game-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.game-thumb {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  flex-shrink: 0;
  background-image: repeating-conic-gradient(#b58863 0% 25%, #f0d9b5 0% 50%);
  background-size: 17px 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.08);
}

.game-card-body {
  flex: 1;
  min-width: 0;
}

.game-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1f3c;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.game-meta-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #888;
}

.game-opening-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.game-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* Empty state */
.games-empty-state {
  background: #fff;
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.games-empty-icon {
  font-size: 48px;
  margin-bottom: 1rem;
  line-height: 1;
}

.games-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1f3c;
  margin-bottom: 6px;
}

.games-empty-sub {
  font-size: 13px;
  color: #888;
  margin-bottom: 1.5rem;
  line-height: 1.55;
}