/* ============================================================
   css/pages/mcqs.css — MCQ Manager screen styles
   ============================================================ */

/* ── Filter row ──────────────────────────────────────────────── */

.mcq-filters {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.mcq-filter-dropdowns {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.mcq-select-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1;
  min-width: 140px;
}

.mcq-select-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 500;
  padding-left: 2px;
}

.mcq-select {
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  padding: var(--sp-2) var(--sp-3);
  padding-right: var(--sp-6);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23D4AF37' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  transition: border-color var(--transition-fast);
}

.mcq-select:hover,
.mcq-select:focus {
  border-color: var(--gold);
}

/* Search */

.mcq-search-wrap {
  position: relative;
}

.mcq-search-icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}

.mcq-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) 40px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.mcq-search-input::placeholder {
  color: var(--text-muted);
}

.mcq-search-input:focus {
  border-color: var(--gold);
}

/* ── Stats grid ──────────────────────────────────────────────── */

.mcq-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.mcq-stat-icon {
  color: var(--gold);
  display: flex;
  align-items: center;
}

/* ── List header ─────────────────────────────────────────────── */

.mcq-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  min-height: 24px;
}

.mcq-list-count {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.mcq-count-badge {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-neutral);
  border-radius: var(--radius-pill);
  padding: 2px 12px;
}

/* ── MCQ list & cards ────────────────────────────────────────── */

.mcq-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.mcq-card {
  background: var(--bg-card);
  border: 1px solid var(--border-neutral);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.mcq-card:hover {
  border-color: var(--gold-border);
  box-shadow: 0 2px 16px rgba(212, 175, 55, 0.08);
}

/* Top row: QID + menu button */
.mcq-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.mcq-qid {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Three-dot menu button */
.mcq-menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
  line-height: 1;
  font-size: 18px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.mcq-menu-btn:hover {
  background: var(--bg-card-hover);
  color: var(--gold);
}

/* Stem */
.mcq-stem {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: var(--sp-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Bottom row: subject pill + difficulty dot */
.mcq-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.mcq-subject-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--gold-border);
  color: var(--gold);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 10px;
  white-space: nowrap;
}

.mcq-difficulty {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.mcq-diff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.diff-foundation { background: var(--info); }
.diff-application { background: var(--success); }
.diff-reasoning  { background: var(--warning); }
.diff-trap       { background: var(--danger); }

/* ── Context menu (three-dot dropdown) ────────────────────────── */

.mcq-ctx-menu {
  position: absolute;
  top: 40px;
  right: var(--sp-4);
  background: var(--bg-card-alt, #161616);
  border: 1px solid var(--border-neutral);
  border-radius: var(--radius-md);
  overflow: hidden;
  z-index: 50;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: ctx-in var(--transition-fast) ease;
}

@keyframes ctx-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mcq-ctx-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  background: none;
  border: none;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.mcq-ctx-item:hover {
  background: var(--bg-card-hover);
}

.mcq-ctx-item svg {
  flex-shrink: 0;
}

.mcq-ctx-item.danger {
  color: var(--danger);
}

/* ── Skeleton loading ─────────────────────────────────────────── */

.mcq-skeleton-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.mcq-skeleton {
  pointer-events: none;
}

.skel {
  background: linear-gradient(
    90deg,
    var(--bg-card-hover) 25%,
    var(--bg-input) 50%,
    var(--bg-card-hover) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skel-qid  { height: 12px; width: 120px; margin-bottom: var(--sp-2); }
.skel-stem { height: 14px; width: 100%; margin-bottom: var(--sp-2); }
.skel-stem-short { width: 65%; margin-bottom: var(--sp-3); }
.skel-meta { height: 22px; width: 160px; }

/* ── Empty state ─────────────────────────────────────────────── */

.mcq-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-4);
  color: var(--text-muted);
  text-align: center;
}

.mcq-empty-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-secondary);
}

.mcq-empty-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: calc(-1 * var(--sp-1));
}

/* ── Preview Modal ───────────────────────────────────────────── */

.mcq-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.mcq-modal {
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mcq-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-neutral);
  flex-shrink: 0;
}

.mcq-modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gold);
}

.mcq-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--sp-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.mcq-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.mcq-modal-body {
  padding: var(--sp-5);
  overflow-y: auto;
  flex: 1;
}

/* Preview content */
.preview-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.preview-meta-chip {
  font-size: var(--text-xs);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-neutral);
  color: var(--text-secondary);
}

.preview-meta-chip.gold {
  border-color: var(--gold-border);
  color: var(--gold);
}

.preview-qid {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

.preview-stem {
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: var(--sp-4);
  font-weight: 500;
}

.preview-image {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  border: 1px solid var(--border-neutral);
}

.preview-options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.preview-option {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-neutral);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: transparent;
  transition: background var(--transition-fast);
}

.preview-option.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.08);
}

.preview-option-letter {
  font-weight: 700;
  color: var(--text-secondary);
  width: 16px;
  flex-shrink: 0;
}

.preview-option.correct .preview-option-letter {
  color: var(--success);
}

.preview-option-text {
  flex: 1;
  line-height: 1.4;
}

.preview-correct-label {
  font-size: var(--text-xs);
  color: var(--success);
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid var(--success);
  border-radius: var(--radius-pill);
  margin-left: auto;
  flex-shrink: 0;
}

.preview-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-2);
}

.preview-explanation {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
}

.preview-divider {
  height: 1px;
  background: var(--border-neutral);
  margin: var(--sp-4) 0;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .mcq-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
  }

  .mcq-filter-dropdowns {
    flex-direction: column;
  }

  .mcq-select-wrap {
    min-width: 0;
  }

  .mcq-modal {
    max-height: 92vh;
  }
}

@media (max-width: 480px) {
  .mcq-stats-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
}
