/* ============================================================
   style-extras.css — additions for the Subjects/Classes patch.
   Loaded AFTER style.css; only adds new rules and a couple of
   small overrides for relabelled controls.
   ============================================================ */

/* The HTML `hidden` attribute must always win over any `display:` rule
   we set later in this file (e.g. .modal-overlay sets display:flex).
   Without this the retag modal renders on top of the login screen. */
[hidden] { display: none !important; }

/* ---------- Brand / topbar ---------- */
.brand { gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text h1 { font-size: 17px; }
.brand-text .brand-sub { font-size: 12px; }

/* The tab strip now has 8 entries — let it wrap on narrow screens. */
.tabs { row-gap: 4px; }

/* ---------- Hint / banner boxes ---------- */
.hint-box {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; padding: 10px 14px; margin: 10px 0;
  font-size: 14px; color: #1e3a8a;
}
.hint-box .hint-action { margin-left: 8px; }
.hint-box.warn-box {
  background: #fffbeb; border-color: #fde68a; color: #92400e;
}
.hint-box > div + div { margin-top: 4px; }

/* Split-row button (line item table) — keep it tight next to the ✕ */
.btn.split-row { padding: 2px 8px; font-size: 13px; }

.unassigned-banner {
  display: flex; align-items: center; gap: 16px;
  justify-content: space-between; flex-wrap: wrap;
}
.unassigned-banner > div { flex: 1; min-width: 220px; }

/* ---------- Class picker inside the line-items table ---------- */
table select.class-pick {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 13px; background: white;
}
table select.class-pick.is-empty {
  border-color: var(--danger);
  background: #fef2f2;
}
table select.class-pick:focus { outline: none; border-color: var(--primary); }

/* ---------- Toggle-button "active" state (e.g. Show only Unassigned) ---------- */
.btn.ghost.active-filter {
  background: #fef3c7; color: #92400e;
  border-color: #fde68a;
}

/* ---------- "Unassigned" pill marker on line items / classes ---------- */
.unassigned-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: #fef3c7; color: #92400e;
}

/* ---------- Reports ---------- */
.report-section { margin-top: 18px; }
.report-section h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.report-row {
  display: grid;
  grid-template-columns: 1fr 220px 100px 110px;
  gap: 14px; align-items: center;
  padding: 10px 12px; background: var(--bg); border-radius: 6px;
  font-size: 14px; margin-bottom: 6px;
}
.report-row .name { font-weight: 500; }
.report-row .meta { color: var(--muted); font-size: 13px; }
.report-row .amount { text-align: right; font-weight: 600; color: var(--accent); }
.report-row.is-unassigned {
  background: #fffbeb; border: 1px solid #fde68a;
}
.report-row.is-unassigned .amount { color: #92400e; }
@media (max-width: 700px) {
  .report-row { grid-template-columns: 1fr; gap: 4px; }
  .report-row .amount { text-align: left; }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white; border-radius: 12px;
  width: 100%; max-width: 800px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-sub { padding: 0 22px; margin-top: 8px; }
.modal-body { padding: 14px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ---------- Subjects/Classes management tables ---------- */
#subjectsTable td,
#classesTable td { vertical-align: middle; }
#subjectsTable input[type="text"],
#classesTable input[type="text"],
#subjectsTable input[type="number"],
#classesTable input[type="number"],
#subjectsTable select,
#classesTable select {
  padding: 6px 8px; font-size: 13px; min-width: 80px;
}
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.placeholder-row td { background: #fffbeb; }
.placeholder-row td:first-child::before {
  content: "📌 "; color: #92400e;
}
.archived-row td { opacity: 0.55; font-style: italic; }

/* ---------- Class budget table empty state ---------- */
#classBudgetTable tbody:empty + .form-row { margin-top: 4px; }
#classBudgetTable td.empty-state {
  text-align: center; color: var(--muted); padding: 24px; font-style: italic;
}

/* ---------- Code styling for class codes inline ---------- */
code {
  background: var(--bg); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .modal { max-height: 100vh; border-radius: 0; }
  .brand-text h1 { font-size: 15px; }
  .unassigned-banner { flex-direction: column; align-items: stretch; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar > * { width: 100%; }
}
