/* =========================================================
   PilotMetrics - Training Groups
   ========================================================= */

.grp-gate { text-align: center; padding: 32px 20px; }
.grp-gate h2 { justify-content: center; font-size: 18px; margin-bottom: 10px; }
.grp-gate .desc { margin: 0 auto 16px; max-width: 520px; font-size: 13px; }

/* My groups */
.grp-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.grp-empty { margin: 0; font-size: 12px; line-height: 1.5; }
.grp-pill {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 14px; border-radius: 8px; text-align: left;
  background: #0f172a; border: 1px solid var(--line); color: var(--text); box-shadow: none; cursor: pointer;
}
.grp-pill b { font-size: 13px; }
.grp-pill span { font-size: 10px; font-weight: 700; color: var(--muted); }
.grp-pill:hover { border-color: var(--line-light); background: var(--card-hover); }
.grp-pill.active { border-color: var(--blue); background: var(--blue-light); }
/* The flight school sits at the end of the row, set apart from the groups */
.grp-pill-school { border-style: dashed; }
.grp-pill-school.active { border-style: solid; border-color: var(--cyan); background: var(--cyan-light); }
.grp-list .grp-empty { flex: 1 1 100%; }

.grp-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grp-form { display: flex; gap: 8px; align-items: flex-end; }
.grp-form .field { flex: 1; }

/* A group */
.grp-head { align-items: flex-start; }
.grp-head h2 { font-size: 18px; }
.grp-meta { margin-top: 4px; font-size: 11px; color: var(--muted); }
.grp-meta b { color: var(--text); letter-spacing: 0.04em; }
.grp-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.grp-share {
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 10px 12px;
  border-radius: 8px; background: #0f172a; border: 1px solid var(--line);
  font-size: 12px; line-height: 1.5; color: var(--muted); cursor: pointer;
}
.grp-share b { color: var(--text); }
.grp-share input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--blue); cursor: pointer; }

.grp-small-note { margin: -4px 0 12px; }

.grp-subhead { margin: 18px 0 8px; font-size: 13px; color: #fff; }
.grp-table .num { text-align: right; white-space: nowrap; }
.grp-table tr.is-you td { background: var(--blue-light); }
.grp-table small { color: var(--muted); }

/* Statistics */
.grp-message {
  padding: 12px 14px; border-radius: 8px; font-size: 12px; line-height: 1.5;
  background: #0f172a; border: 1px dashed var(--line-light); color: var(--muted);
}
.grp-message b { color: var(--text); }

.grp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.grp-stat b { font-size: 20px; margin-top: 4px; }
.grp-stat small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.grp-stat small.better { color: #34d399; font-weight: 700; }
.grp-stat small.worse { color: #fbbf24; font-weight: 700; }

.grp-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.grp-panel { padding: 12px 14px; border-radius: 8px; background: #0f172a; border: 1px solid var(--line); min-width: 0; }
.grp-panel h3 { margin: 0 0 8px; font-size: 13px; color: #fff; }
.grp-panel .desc { margin: 0 0 10px; }

.grp-bars { display: flex; flex-direction: column; gap: 7px; }
.grp-bar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 11px; }
.grp-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.grp-bar-label em { font-style: normal; font-size: 9px; font-weight: 800; text-transform: uppercase; color: var(--cyan); margin-left: 4px; }
.grp-bar-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.grp-bar-fill { height: 100%; border-radius: 4px; background: var(--blue); min-width: 2px; }
.grp-bar.is-you .grp-bar-fill { background: var(--cyan); }
.grp-bar-value { color: var(--muted); white-space: nowrap; text-align: right; }

#schoolSelect { max-width: 260px; }

/* How does my training compare? (percentiles) */
.cmp-scopes { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.cmp-scopes button { box-shadow: none; }
.cmp-scopes button.active { border-color: var(--cyan); background: var(--cyan-light); color: #fff; }
.cmp-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cmp-item { padding: 14px; border-radius: 8px; background: #0f172a; border: 1px solid var(--line); min-width: 0; }
.cmp-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cmp-headline { margin: 8px 0 10px; font-size: 14px; line-height: 1.45; color: var(--text); }
.cmp-headline b { font-size: 22px; color: var(--cyan); }
.cmp-headline.low b { color: var(--amber); }
/* Where the pilot sits, from the bottom of the range (left) to the top (right) */
.cmp-track { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--line-light), var(--blue)); }
.cmp-marker {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--cyan); border: 2px solid #0f172a; box-shadow: 0 0 0 2px var(--cyan);
}
.cmp-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: var(--muted); }
.cmp-sub { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.cmp-sub b { color: var(--text); }
.cmp-note { margin: 10px 0 0; }

@media (max-width: 900px) {
  .grp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grp-forms { grid-template-columns: minmax(0, 1fr); }
  .cmp-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .grp-form { flex-direction: column; align-items: stretch; }
  .grp-actions { width: 100%; }
  .grp-actions button { flex: 1; }
  .grp-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .grp-bar-track { grid-column: 1 / -1; grid-row: 2; }
  #schoolSelect { max-width: none; width: 100%; }
  /* Keep the shared members table to the headline columns */
  .grp-table th:nth-child(4), .grp-table td:nth-child(4),
  .grp-table th:nth-child(6), .grp-table td:nth-child(6) { display: none; }
}
