/* =========================
   SUBJECTS PAGE
   Brought in line with dashboard.css/admin.css and quizzes.css:
   labeled form fields instead of a bare input row, a quieter card
   hover (no more heavy translateY(-3px) lift), and a muted delete
   button instead of solid red — same institutional tone as the
   rest of the admin section.

   Classes here are namespaced (subject-form-grid, subject-form-
   field, subject-add-btn, ...) rather than reusing quizzes.css's
   bare .form-field / .form-field-wide — both stylesheets load
   together in the SPA, so identical bare class names would create
   the same cross-page collision problem documented elsewhere in
   this project.
========================= */

.subjects-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-header p {
  margin-top: 4px;
}

.count-badge {
  background: #ede9fe;
  color: #6d28d9;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

/* =========================
   CREATE SUBJECT SECTION
========================= */

.subject-create-section h2 {
  margin: 0 0 4px 0;
}

.subject-create-section > .subjects-subtitle {
  margin-bottom: 4px;
}

.subject-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0 0;
}

.subject-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Same gotcha as quizzes.css's .form-field: grid items default to
     min-width: auto, which lets a select's option text push this
     column wider than its 1fr share and overflow the form. */
  min-width: 0;
}

.subject-form-field-wide {
  grid-column: span 2;
}

.subject-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.subject-form-field input,
.subject-form-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.subject-form-field input:focus,
.subject-form-field select:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.subject-form-actions {
  margin-top: 18px;
}

.subject-add-btn {
  border: none;
  background: #7c3aed;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}

.subject-add-btn:hover {
  background: #6d28d9;
}

.subject-add-btn:active {
  transform: scale(0.98);
}

/* =========================
   ALL SUBJECTS — section header + divider
========================= */

.subjects-header {
  margin-bottom: 20px;
  padding-top: 24px;
  border-top: 1px solid #eee;
}

/* =========================
   GRID
========================= */

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* =========================
   CARD
   Same restrained treatment as quiz-card: thin border doing most
   of the work, a small lift on hover instead of a heavy one.
========================= */

.subject-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 16px;
  padding: 18px;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.03);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.subject-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.06),
    0 12px 24px rgba(0, 0, 0, 0.06);
}

.subject-card h3 {
  margin: 0 0 6px 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.subject-card small {
  color: #777;
}

/* =========================
   SUBJECT CARD INFO + TAGS
========================= */

.subject-card-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.subject-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.subject-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.subject-tag.level {
  background: #ede9fe;
  color: #6d28d9;
}

.subject-tag.semester {
  background: #eff6ff;
  color: #2563eb;
}

/* =========================
   DELETE
   Quiet red (light background, dark red text) instead of a solid
   red button — matches quizzes.css's .btn-delete treatment.
========================= */

.delete-subject {
  flex: 0 0 auto;
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease;
}

.delete-subject:hover {
  background: #fecaca;
}

/* =========================
   EMPTY STATE
========================= */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed #ddd;
  border-radius: 16px;
  background: #fafafa;
  color: #888;
  font-size: 15px;
  font-weight: 500;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .subject-form-grid {
    grid-template-columns: 1fr;
  }

  .subject-form-field-wide {
    grid-column: span 1;
  }

  .subject-add-btn {
    width: 100%;
  }

  .delete-subject {
    width: 100%;
    margin-top: 12px;
  }

  .subject-card {
    flex-direction: column;
    align-items: stretch;
  }
}
