/* vocabulary.css — the teacher's Vocabulary tab (§SB-12b).
 * A light console in the spirit of WelcomeHome's VocabularyConsole / SetWordList,
 * in the dashboard's palette (--primary-color, #6564b6). Every class is `vocab-`
 * prefixed so nothing leaks into the rest of homework-dashboard.css. */

.vocab-console *,
.vocab-console *::before,
.vocab-console *::after { box-sizing: border-box; }

.vocab-console {
  --vocab-primary: var(--primary-color, #6564b6);
  --vocab-primary-dark: #4d4c9a;
  --vocab-save: #047857;
  --vocab-save-dark: #065f46;
  --vocab-danger: #b91c1c;
  --vocab-border: #e5e7eb;
  --vocab-muted: #6b7280;
  --vocab-field: #f5f7ff;
  color: #111827;
}

.vocab-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.5rem 0;
}
.vocab-console > .vocab-error { padding: 0 1.5rem; }
.vocab-header h2 { margin: 0; font-size: 1.5rem; }
.vocab-subtitle { margin: 0.25rem 0 0; color: var(--vocab-muted); font-size: 0.9rem; }
.vocab-muted { color: var(--vocab-muted); }
.vocab-small { font-size: 0.8rem; }
.vocab-error { color: var(--vocab-danger); font-weight: 600; font-size: 0.9rem; margin: 0.5rem 0; }
.vocab-status { color: var(--vocab-save); font-weight: 600; font-size: 0.85rem; }
.vocab-hidden { display: none; }
.vocab-console .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons */
.vocab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.vocab-btn:hover:not(:disabled) { background: #e5e7eb; }
.vocab-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.vocab-btn-small { padding: 0.15rem 0.7rem; font-size: 0.75rem; background: #fff; }
.vocab-btn-primary { background: var(--vocab-primary); border-color: var(--vocab-primary); color: #fff; }
.vocab-btn-primary:hover:not(:disabled) { background: var(--vocab-primary-dark); }
.vocab-btn-save { background: var(--vocab-save); border-color: var(--vocab-save); color: #fff; }
.vocab-btn-save:hover:not(:disabled) { background: var(--vocab-save-dark); }
.vocab-btn-save:disabled { background: #e5e7eb; border-color: #e5e7eb; color: #4b5563; opacity: 1; }
.vocab-btn-danger-text { background: transparent; border-color: transparent; color: var(--vocab-danger); }
.vocab-btn-danger-text:hover:not(:disabled) { background: #fef2f2; }
.vocab-link { background: none; border: 0; color: var(--vocab-primary); font-weight: 600; cursor: pointer; padding: 0; font-size: 0.85rem; }
.vocab-link:hover { text-decoration: underline; }
.vocab-x { background: none; border: 0; color: #9ca3af; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 0.2rem; }
.vocab-x:hover { color: var(--vocab-danger); }
.vocab-console button:focus-visible,
.vocab-console input:focus-visible,
.vocab-console select:focus-visible,
.vocab-console a:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }

/* The list of lists */
.vocab-new-list, .vocab-rename { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.vocab-new-list input, .vocab-rename input, .vocab-rename select {
  flex: 1 1 16rem;
  border: 1px solid #c7d2fe;
  background: var(--vocab-field);
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.95rem;
}
.vocab-rename select { flex: 0 0 auto; }
.vocab-empty { border: 1px solid var(--vocab-border); border-radius: 1rem; background: #fff; padding: 2.5rem 1rem; text-align: center; }
.vocab-empty-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.25rem; }
.vocab-list-cards { display: flex; flex-direction: column; gap: 0.75rem; }
.vocab-list-card {
  position: relative;
  border: 1px solid var(--vocab-border);
  border-radius: 0.9rem;
  background: #fff;
  padding: 0.9rem 1rem 0.9rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.vocab-list-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 0.9rem 0 0 0.9rem;
  background: linear-gradient(to bottom, var(--vocab-primary), #a5b4fc);
}
.vocab-list-card-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.vocab-list-name { font-size: 1.05rem; font-weight: 600; }
.vocab-pill { background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.75rem; font-weight: 600; }
.vocab-class-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0; }
.vocab-pill-level { background: #6564b6; color: #fff; }
.vocab-pill-topic { background: #ecfdf5; color: #065f46; }
.vocab-chip { display: inline-flex; align-items: center; gap: 0.25rem; background: #f3f4f6; border: 1px solid var(--vocab-border); border-radius: 999px; padding: 0.05rem 0.2rem 0.05rem 0.55rem; font-size: 0.75rem; }
/* The × that unassigns the list from that class */
.vocab-chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 1.1rem; height: 1.1rem; border: 0; border-radius: 999px; background: none; color: #6b7280; font-size: 0.95rem; line-height: 1; cursor: pointer; padding: 0; }
.vocab-chip-remove:hover:not(:disabled) { background: #fee2e2; color: #b91c1c; }
.vocab-chip-remove:disabled { cursor: default; opacity: 0.5; }
.vocab-list-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* The word editor */
.vocab-editor { max-width: 1400px; margin: 0 auto; border: 1px solid var(--vocab-border); border-radius: 1rem; background: #fff; padding: 1rem; }

/* Assigning (§SB-12c): the Assign Homework tab's two panels (homework-dashboard.css), plus these. */
.vocab-pad { padding: 0.75rem; }
.vocab-class-row { align-items: center; }
.vocab-class-row .student-info { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; min-width: 0; }
.vocab-class-meta { color: var(--vocab-muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vocab-has-list { margin-left: auto; flex-shrink: 0; background: #ecfdf5; color: var(--vocab-save); border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.72rem; font-weight: 700; }
.vocab-assign .exercise-panel { padding-bottom: 1rem; }
.vocab-assign .vocab-list-cards { padding: 0 0.75rem; }
.vocab-assign .vocab-new-list { padding: 0 0.75rem; }
.vocab-assign-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0.75rem 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #c7d2fe;
  border-radius: 0.75rem;
  background: #eef2ff;
  font-size: 0.9rem;
  font-weight: 600;
  color: #312e81;
}
.vocab-assign-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.vocab-list-card { cursor: pointer; }
.vocab-list-card.is-selected { border-color: var(--vocab-primary); box-shadow: 0 0 0 2px rgba(101, 100, 182, 0.25); }
.vocab-list-card input[type="radio"] { accent-color: var(--vocab-primary); width: 1rem; height: 1rem; }
.vocab-editor-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.vocab-editor-title { display: flex; align-items: baseline; gap: 0.6rem; }
.vocab-editor-title h3 { margin: 0; font-size: 1.25rem; }
.vocab-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.vocab-toolbar-left { display: flex; align-items: center; gap: 0.75rem; }
.vocab-count { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vocab-muted); }

.vocab-grid-head,
.vocab-row,
.vocab-add-word {
  display: grid;
  /* §SB-16: the definition gets about twice the room of the word */
  grid-template-columns: 1.5rem minmax(0, 1fr) minmax(0, 2fr) 15rem minmax(6rem, auto);
  gap: 0.6rem;
  align-items: center;
}
.vocab-grid-head { padding: 0 0.25rem 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vocab-muted); }
.vocab-row { padding: 0.55rem 0.25rem; border-bottom: 1px solid #f1f5f9; }
.vocab-row.sortable-chosen { background: #fff; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12); border-radius: 0.5rem; }
.vocab-row.sortable-ghost { opacity: 0.35; }
.vocab-add-word {
  /* §SB-14: the "new word" card, on the rows' grid so its media sit under "Picture & voice". */
  margin-top: 0.5rem;
  padding: 0.75rem 0.25rem;
  border: 1px dashed var(--vocab-border);
  border-radius: 0.6rem;
  background: #f8fafc;
}
.vocab-add-word.is-retry { border-color: #fca5a5; background: #fff7f7; }
.vocab-add-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.3rem 0.5rem; }
.vocab-unsaved { font-size: 0.78rem; font-weight: 600; color: var(--vocab-danger); }
.vocab-drag { background: none; border: 0; color: #9ca3af; cursor: grab; font-size: 0.8rem; letter-spacing: -0.25em; touch-action: none; padding: 0.25rem 0; }
.vocab-drag:active { cursor: grabbing; }
.vocab-input {
  width: 100%;
  border: 1px solid #e0e7ff;
  background: var(--vocab-field);
  border-radius: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
  min-width: 0;
}
.vocab-input:focus { background: #fff; border-color: #818cf8; }
/* §SB-16: the word boxes are textareas as tall as their text (fitHeight) */
textarea.vocab-input { display: block; resize: none; overflow: hidden; font: inherit; font-size: 0.9rem; line-height: 1.35; }

.vocab-media { display: flex; align-items: center; gap: 0.5rem; }
.vocab-picture {
  width: 4.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  border: 0;
  padding: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  background: #f9fafb;
}
.vocab-picture img { width: 100%; height: 100%; object-fit: cover; border: 1px solid var(--vocab-border); border-radius: 0.5rem; }
.vocab-picture-empty {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border: 1px dashed #d1d5db;
  border-radius: 0.5rem;
  color: #9ca3af;
  font-size: 0.72rem;
}
.vocab-picture:hover .vocab-picture-empty { border-color: #93c5fd; color: #3b82f6; background: #eff6ff; }
.vocab-play, .vocab-record {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #047857;
  cursor: pointer;
  font-size: 0.85rem;
}
.vocab-play:disabled { border-color: var(--vocab-border); background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.vocab-record { border-color: #fecaca; background: #fff1f2; color: var(--vocab-danger); touch-action: none; user-select: none; }
.vocab-record.is-recording { background: var(--vocab-danger); color: #fff; width: 4.5rem; }
.vocab-record:disabled { opacity: 0.5; cursor: not-allowed; }
.vocab-meter { display: block; height: 0.4rem; margin: 0 0.4rem; background: rgba(255, 255, 255, 0.35); border-radius: 999px; overflow: hidden; }
.vocab-meter span { display: block; height: 100%; background: #fff; transition: width 0.08s linear; }
.vocab-voice-picker { width: 6.5rem; border: 1px solid #e0e7ff; background: var(--vocab-field); border-radius: 0.5rem; padding: 0.3rem; font-size: 0.75rem; }
.vocab-voice-label { font-size: 0.75rem; color: #4b5563; }
.vocab-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.3rem 0.6rem; }
.vocab-take { display: inline-flex; align-items: center; font-size: 0.75rem; }
.vocab-take .vocab-link { font-size: 0.75rem; }
.vocab-delete-word { background: none; border: 0; cursor: pointer; font-size: 1rem; opacity: 0.6; }
.vocab-delete-word:hover { opacity: 1; }

/* The picture window */
.vocab-modal-scrim { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(17, 24, 39, 0.5); }
.vocab-modal { width: 100%; max-width: 42rem; max-height: 92vh; overflow: auto; background: #fff; border-radius: 1rem; padding: 1.25rem; box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25); }
.vocab-modal.is-dragging { outline: 4px solid #7dd3fc; }
.vocab-modal-head { display: flex; justify-content: space-between; gap: 1rem; }
.vocab-modal-head h3 { margin: 0; font-size: 1.1rem; }
.vocab-modal-head p { margin: 0.2rem 0 0; font-size: 0.85rem; }
.vocab-modal-head a { color: #0369a1; font-weight: 600; }
.vocab-modal-close { font-size: 1.5rem; }
.vocab-modal-preview { display: flex; min-height: 14rem; align-items: center; justify-content: center; margin-top: 0.9rem; border: 1px solid var(--vocab-border); border-radius: 0.75rem; background: #f9fafb; padding: 0.75rem; }
.vocab-modal-preview img { max-width: 100%; max-height: 50vh; border-radius: 0.5rem; object-fit: contain; }
.vocab-problems { color: var(--vocab-danger); font-size: 0.85rem; font-weight: 600; padding-left: 1.1rem; }
.vocab-confirm { margin-top: 1rem; border: 1px solid #fde68a; background: #fffbeb; border-radius: 0.75rem; padding: 0.9rem; color: #92400e; font-size: 0.875rem; }
.vocab-confirm p { margin: 0.25rem 0; }
.vocab-confirm-title { font-weight: 700; color: #78350f; }
.vocab-checkbox { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.vocab-modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }

/* Phone width: one column per row, media below the fields. */
@media (max-width: 760px) {
  .vocab-grid-head { display: none; }
  .vocab-row, .vocab-add-word { grid-template-columns: 1.5rem minmax(0, 1fr); }
  .vocab-row > .vocab-input-second,
  .vocab-row > .vocab-media,
  .vocab-row > .vocab-row-actions,
  .vocab-add-word > .vocab-input-second,
  .vocab-add-word > .vocab-media,
  .vocab-add-word > .vocab-add-actions { grid-column: 2; }
  .vocab-add-actions { justify-content: flex-start; }
  .vocab-row-actions { justify-content: flex-start; }
}
