/* =========================
   QUIZZES — SAAS DASHBOARD STYLE
========================= */

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

.quizzes-header h2 {
  margin: 0 0 4px 0;
}

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

/* =========================
   CREATE QUIZ SECTION
   Own heading + subtitle so this reads as a distinct "add
   something new" area, separate from the "browse/manage what
   already exists" section below it.
========================= */
.quiz-create-section h2 {
  margin: 0 0 4px 0;
}

.quiz-create-section > .quizzes-subtitle {
  margin-bottom: 4px;
}

/* =========================
   TOOLBAR — search + subject pills
   Same visual language as the rest of this page (not borrowed from
   marketplace.css) so Quizzes doesn't depend on another page's
   stylesheet being loaded.
========================= */
.quiz-toolbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0 4px;
}

.quiz-search {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  font-size: 15px;
  color: #111827;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.quiz-search::placeholder {
  color: #9ca3af;
}

.quiz-search:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.quiz-filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.quiz-filters::-webkit-scrollbar {
  display: none;
}

.quiz-filter-btn {
  border: none;
  background: #f3f4f6;
  color: #374151;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.quiz-filter-btn:hover {
  background: #ede9fe;
  color: #6d28d9;
  transform: translateY(-1px);
}

.quiz-filter-btn.active {
  background: #7c3aed;
  color: #fff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}

/* =========================
   LEVEL & SEMESTER SELECTORS
========================= */
.quiz-level-semester-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0 0;
}

.quiz-level-filter,
.quiz-semester-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-level-filter label,
.quiz-semester-filter label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

.quiz-level-filter select,
.quiz-semester-filter select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #111827;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.quiz-level-filter select:hover,
.quiz-semester-filter select:hover {
  border-color: #c4b5fd;
}

.quiz-level-filter select:focus,
.quiz-semester-filter select:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

/* =========================
   FORM CARD
========================= */
.quiz-form {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 16px;
  padding: 20px;
  margin: 20px 0 28px 0;
}

.quiz-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* lets the field shrink below its input's intrinsic
                   width instead of forcing the grid column wider
                   than its 1fr share — same gotcha as the admin
                   header title/description truncation fix. */
}

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

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

.quiz-form select,
.quiz-form input {
  width: 100%;
  box-sizing: border-box; /* padding was previously added on top of
                              the stretched width instead of being
                              included in it, pushing inputs past
                              the form's edge. */
  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;
}

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

.quiz-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.btn-primary {
  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;
}

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

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

.btn-secondary {
  border: 1px solid #ddd;
  background: #fff;
  color: #444;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: #f3f3f3;
}

/* =========================
   QUIZ GRID + CARDS
========================= */
.quiz-list-wrapper {
  margin-top: 8px;
}

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

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #eee;
  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;
}

.quiz-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);
}

.quiz-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.quiz-card-week {
  margin: 0;
  font-size: 13px;
  color: #777;
}

.quiz-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 10px;
  flex-wrap: wrap;
}

.quiz-card-actions {
  display: flex;
  gap: 8px;
}

/* =========================
   BADGES
========================= */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

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

.badge-price {
  background: #ecfdf5;
  color: #047857;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
}

.badge-inactive {
  background: #f3f4f6;
  color: #6b7280;
}

/* =========================
   ACTION BUTTONS
========================= */
.btn-edit {
  border: none;
  background: #eef2ff;
  color: #4338ca;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease;
}

.btn-edit:hover {
  background: #e0e7ff;
}

.btn-delete {
  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;
}

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

/* =========================
   EMPTY STATE
========================= */
.quiz-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;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 720px) {
  .quiz-level-semester-filters {
    grid-template-columns: 1fr;
  }

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

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

  .quiz-form-actions {
    flex-direction: column;
  }

  .quiz-form-actions button {
    width: 100%;
  }

  .quiz-grid {
    grid-template-columns: 1fr;
  }

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

  .quiz-card-actions {
    flex-direction: column;
  }

  .quiz-card-actions button {
    width: 100%;
  }
}
