/* =========================================================
   Weighted Grade Calculator — tool-specific styles.
   Layered on /tools/_shared/tool.css.
   ========================================================= */

/* ---------- Toolbar ---------- */
.wg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.wg-toolbar .btn { flex: 1 1 auto; }

/* ---------- Categories ---------- */
.wg-categories { margin-bottom: var(--space-5); }
.wg-categories .section-eyebrow { margin-bottom: var(--space-3); }

.wg-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Header strip — visible on wider screens only.
   On mobile we rely on per-field labels inside each row. */
.wg-row-head {
  display: none;
}
@media (min-width: 720px) {
  .wg-row-head {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) 90px 90px 64px 36px;
    gap: var(--space-2);
    align-items: end;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    padding: 0 var(--space-3) 4px;
    margin-bottom: 4px;
  }
  .wg-col-weight,
  .wg-col-grade,
  .wg-col-status { text-align: center; }
}

/* ---------- Row ---------- */
.wg-row {
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: var(--transition-colors);
}
.wg-row.is-unfinished {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

/* Mobile: two-row layout — name spans, weight/grade/status/remove align in a strip. */
.wg-row-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.wg-field { display: flex; flex-direction: column; gap: 4px; }
.wg-field > span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.wg-field input[type="text"],
.wg-field input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: var(--transition-colors);
}
.wg-field input[type="number"] { text-align: center; font-weight: 600; }
.wg-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.wg-row.is-unfinished .wg-field input[type="number"][data-role="grade"] {
  background: var(--surface-inset);
  color: var(--text-muted);
}

.wg-status-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.wg-status-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.wg-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: var(--transition-colors), transform 0.06s ease;
}
.wg-remove:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft-bg);
}
.wg-remove:active:not(:disabled) { transform: translateY(1px); }
.wg-remove:disabled { opacity: 0.4; cursor: not-allowed; }
.wg-remove svg { width: 16px; height: 16px; }

/* Wider layout — one row per category. */
@media (min-width: 720px) {
  .wg-row { padding: var(--space-2) var(--space-3); }
  .wg-row-fields {
    grid-template-columns: minmax(0, 1.6fr) 90px 90px 64px 36px;
    gap: var(--space-2);
    align-items: center;
  }
  .wg-field > span { display: none; }
  .wg-field input[type="text"],
  .wg-field input[type="number"] { padding: 8px 10px; font-size: 14px; }
  .wg-status-cell { justify-content: center; padding: 0; }
  .wg-status-cell .wg-status-text { display: none; }
  .wg-remove { margin-left: 0; }
}

/* ---------- Add button ---------- */
.wg-add {
  margin-bottom: var(--space-3);
  font-weight: 600;
}

/* ---------- Weight status message ---------- */
.wg-weight-status {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-inset);
  color: var(--text-secondary);
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: var(--transition-colors);
}
.wg-weight-status.is-ok {
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  border-color: var(--accent);
}
.wg-weight-status.is-warn {
  background: var(--surface-2);
  color: var(--warning);
  border-color: var(--border-strong);
}

/* ---------- Result block ---------- */
.wg-result {
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition-colors);
}
.wg-result-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  text-align: center;
}
.wg-result-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.wg-percent {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.wg-percent-value {
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}
.wg-percent-pct {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}
.wg-letter {
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  padding-left: var(--space-5);
  border-left: 1px solid var(--border);
}
.wg-result-note {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.wg-result[data-band="A"] .wg-letter { color: var(--success); }
.wg-result[data-band="B"] .wg-letter { color: var(--accent); }
.wg-result[data-band="C"] .wg-letter { color: #CA8A04; }
.wg-result[data-band="D"] .wg-letter { color: #EA580C; }
.wg-result[data-band="F"] .wg-letter { color: var(--danger); }

/* ---------- Planner ---------- */
.wg-planner {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-inset);
  margin-bottom: var(--space-2);
}
.wg-planner > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-soft-fg);
  background: var(--accent-soft-bg);
  border-radius: var(--radius);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-colors);
}
.wg-planner[open] > summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.wg-planner > summary::-webkit-details-marker { display: none; }
.wg-planner > summary::before {
  content: '+';
  display: inline-block;
  width: 14px;
  text-align: center;
  font-weight: 700;
  color: var(--accent);
}
.wg-planner[open] > summary::before { content: '−'; }

.wg-planner-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
}
.wg-planner-lead {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: var(--space-4);
}
.wg-planner-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}
.wg-planner-target {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.wg-planner-target input[type="number"] {
  width: 80px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.wg-planner-target input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.wg-planner-output {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.wg-planner-empty {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.wg-planner-need {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.wg-planner-need-value {
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.wg-planner-need-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.wg-planner-need.is-impossible .wg-planner-need-value { color: var(--danger); }
.wg-planner-need.is-locked .wg-planner-need-value { color: var(--success); }
