/* Khidmah Roster — teacher tools drawer, PIN dialog, and drawer forms (spec 06). */

/* Drawer interior (the frame itself lives in theme.css). T18: the header is
   fixed and .drawer-body is the only scrolling area, so no section is clipped. */
#drawer {
  display: flex;
  flex-direction: column;
}
.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 8px;
  border-bottom: 2px solid var(--gold-500);
}
.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer-title { margin: 0; color: var(--emerald-900); }
.drawer-close { min-width: 44px; }

/* Accordion sections. */
.drawer-section {
  flex: 0 0 auto;  /* grows to fit its content; .drawer-body scrolls (T18) */
  border: 1px solid var(--gold-500);
  border-radius: var(--radius);
  background-color: var(--sand);
  overflow: clip;  /* round the corners only; never clips content (T18) */
}
.drawer-section-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: none;
  background-color: var(--emerald-900);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.drawer-section-btn:hover { background-color: var(--emerald-700); }
.drawer-section-btn:focus-visible { outline: 3px solid var(--gold-500); outline-offset: -3px; }
.acc-arrow { width: 1em; }
.drawer-section-body { padding: 12px 14px; }

/* List rows (students, jobs). */
.roster-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.roster-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gold-300);
}
.roster-row:last-child { border-bottom: none; }
.roster-name { flex: 1 1 auto; min-width: 80px; font-weight: 600; }
.roster-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Students list scrolls inside its own box when long (T18); the add form
   above it stays reachable. */
.student-list { max-height: 40vh; overflow-y: auto; }

/* Compact buttons (still a 44px tap target). */
.btn-small { min-height: 44px; padding: 6px 14px; font-size: .85rem; }

/* Add forms and inline edits. */
.add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.add-form input { flex: 1 1 120px; min-width: 90px; }
.add-job { flex-direction: column; align-items: stretch; gap: .5rem; }
.add-job .btn { align-self: flex-start; }
/* Single-line fields: never stretch to fill the column (T18). */
.add-job input { flex: 0 0 auto; width: 100%; height: 44px; }
.add-job label { width: fit-content; }
.drawer input[type="text"], .drawer input[type="date"], .drawer input[type="password"], .drawer input[type="file"] {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--emerald-700);
  border-radius: 8px;
  background-color: #ffffff;
  color: var(--ink);
  font: inherit;
}
.drawer input:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 1px; }
.drawer label { font-weight: 600; }
.form-error { margin: 6px 0; color: var(--danger); font-weight: 600; }

/* Job expand (edit fields + volunteer checkboxes). */
.job-edit { flex-basis: 100%; margin-top: 6px; padding: 10px; background-color: var(--emerald-100); border-radius: 8px; }
.job-edit-panel { display: flex; flex-direction: column; gap: 6px; }
.job-edit-panel label { width: fit-content; }
.job-edit-panel input[type="text"] { width: 100%; max-width: 300px; height: 44px; }
.volunteers { margin: 8px 0 0; padding: 8px 10px; border: 1px solid var(--emerald-700); border-radius: 8px; }
.volunteers legend { font-weight: 600; padding: 0 4px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; font-weight: 400; cursor: pointer; }
.check input { width: 1.15em; height: 1.15em; }

/* Fairness & up next. */
.queue-title { margin: 12px 0 4px; color: var(--emerald-900); }
.queue-list { list-style: none; margin: 0 0 4px; padding: 0; }
.queue-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--gold-300);
  border-radius: 8px;
  margin-bottom: 6px;
}
.queue-first { border: 2px solid var(--gold-500); background-color: var(--emerald-100); }
.queue-meta { color: var(--ink-soft); font-size: .85rem; }
.queue-hint, .queue-help { margin: 4px 0 8px; font-size: .88rem; color: var(--ink-soft); }
.queue-hint { color: var(--emerald-900); font-weight: 600; }
.queue-help { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--gold-300); }

/* Settings rows. */
.setting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.setting-label { font-weight: 600; }
.setting-row input[type="date"] { flex: 1 1 140px; min-width: 130px; }
.setting-row input[type="file"] { flex-basis: 100%; margin-top: 4px; }

/* PIN dialog (auth.js). */
#pin-dialog { width: min(360px, 92vw); }
.pin-head {
  padding: 12px 16px;
  background-color: var(--midnight);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 2px solid var(--gold-500);
}
.pin-title { margin: 0; color: #ffffff; font-size: 1.15rem; }
.pin-body { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.pin-body input { min-height: 44px; padding: 6px 10px; border: 1px solid var(--emerald-700); border-radius: 8px; font: inherit; }
.pin-body .dialog-actions { gap: 8px; padding: 4px 0 0; }
