@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════ */
:root {
  --bg-base:      #080a12;
  --bg-surface:   #0d0f1c;
  --bg-elevated:  #131629;
  --bg-card:      rgba(255,255,255,0.042);
  --bg-card-hov:  rgba(255,255,255,0.072);

  --primary:      #6366f1;
  --primary-glow: rgba(99,102,241,0.25);
  --primary-lt:   #818cf8;
  --violet:       #7c3aed;
  --cyan:         #22d3ee;
  --pink:         #ec4899;
  --green:        #22c55e;
  --amber:        #f59e0b;

  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --border: rgba(255,255,255,0.07);
  --border-hov: rgba(255,255,255,0.15);

  --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-card-hov: 0 20px 40px -8px rgba(99,102,241,0.2), 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(99,102,241,0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --header-h: 140px;
  --stats-h: 44px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-1);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════
   ANIMATED MESH BACKGROUND
══════════════════════════════════════════════ */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-mesh::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  top: -200px; left: -100px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  animation: meshFloat 12s ease-in-out infinite;
}
.bg-mesh::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  bottom: -150px; right: -100px;
  background: radial-gradient(circle, rgba(236,72,153,0.08) 0%, transparent 70%);
  animation: meshFloat 15s ease-in-out infinite reverse;
}
.bg-mesh-3 {
  position: absolute;
  width: 500px; height: 500px;
  top: 40%; left: 40%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(34,211,238,0.05) 0%, transparent 70%);
  animation: meshFloat 18s ease-in-out infinite 3s;
}
@keyframes meshFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(30px,-20px) scale(1.05); }
  66%      { transform: translate(-20px,30px) scale(0.97); }
}

/* ══════════════════════════════════════════════
   HEADER / GLASS TOP BAR
══════════════════════════════════════════════ */
#main-header {
  position: relative;
  z-index: 50;
  background: rgba(13,15,28,0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 50%, var(--pink) 100%);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4), 0 0 0 1px rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.logo-text h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  background: linear-gradient(90deg, #f1f5f9 0%, var(--primary-lt) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-text p {
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Tabs (center) */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.tab-group {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 4px;
  display: flex;
  gap: 2px;
}
.tab-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 1.25rem;
  border: none;
  background: transparent;
  border-radius: 40px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tab-btn svg { width: 15px; height: 15px; opacity: 0.7; }
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99,102,241,0.4);
}
.tab-btn.active svg { opacity: 1; }
.tab-btn:not(.active):hover { color: var(--text-1); background: rgba(255,255,255,0.06); }

/* Right controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

/* Answer toggle */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: all var(--transition);
}
.slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
input:checked + .slider {
  background: linear-gradient(135deg, var(--green), #16a34a);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(34,197,94,0.3);
}
input:checked + .slider::before { transform: translateX(20px); }

/* Header buttons */
.btn-header {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.btn-header svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-export {
  background: rgba(34,197,94,0.1);
  color: var(--green);
  border-color: rgba(34,197,94,0.25);
}
.btn-export:hover {
  background: rgba(34,197,94,0.2);
  border-color: rgba(34,197,94,0.5);
  box-shadow: 0 0 16px rgba(34,197,94,0.15);
}

.btn-upload {
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(99,102,241,0.35);
}
.btn-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.5);
}
.btn-upload:active { transform: translateY(0); }

.btn-icon {
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
  border-color: var(--border);
  padding: 0.45rem;
  display: none;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── FILTERS ROW ───────────────────────────────── */
.filters-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 130px;
}
.filter-item label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  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='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  outline: none;
  width: 100%;
}
.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: rgba(99,102,241,0.08);
}
.filter-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.filter-select option { background: var(--bg-elevated); }

/* Filter arrow  */
.filter-arrow {
  font-size: 1rem;
  color: var(--text-3);
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

/* Board/College simple checkboxes */
.filter-checks {
  flex: 0 0 auto;
  min-width: auto;
}
.check-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition);
}
.check-label:hover { color: var(--text-1); }
.check-label input[type=checkbox] { display: none; }
.check-box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-hov);
  border-radius: 5px;
  background: rgba(255,255,255,0.05);
  display: grid;
  place-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.check-label input:checked + .check-box {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(99,102,241,0.4);
}
.check-label input:checked + .check-box::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(40deg) translateY(-1px);
  display: block;
}

/* ══════════════════════════════════════════════
   STATS BAR
══════════════════════════════════════════════ */
#stats-bar {
  position: relative;
  z-index: 40;
  background: rgba(99,102,241,0.06);
  border-bottom: 1px solid rgba(99,102,241,0.12);
  flex-shrink: 0;
}
.stats-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1.5rem;
  font-size: 0.82rem;
}
.stat-count {
  font-weight: 700;
  color: var(--primary-lt);
}
.stat-info {
  color: var(--text-3);
}

/* ══════════════════════════════════════════════
   MAIN CONTENT AREA
══════════════════════════════════════════════ */
#main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  scroll-behavior: smooth;
}
.content-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 5rem;
}

/* ══════════════════════════════════════════════
   QUESTION CARDS
══════════════════════════════════════════════ */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  transform: perspective(1000px) rotateX(0deg);
  animation: cardIn 0.35s ease both;
  position: relative;
  overflow: hidden;
}
.question-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.03) 0%, transparent 60%);
  pointer-events: none;
}
@keyframes cardIn {
  from { opacity: 0; transform: perspective(1000px) rotateX(-3deg) translateY(16px); }
  to   { opacity: 1; transform: perspective(1000px) rotateX(0deg) translateY(0); }
}
.question-card:hover {
  background: var(--bg-card-hov);
  border-color: rgba(99,102,241,0.2);
  box-shadow: var(--shadow-card-hov);
  transform: perspective(1000px) rotateX(-1.5deg) translateY(-3px);
}

/* Card base image style for transparency support in dark mode */
.question-card img {
  max-width: 100%;
  border-radius: 6px;
  background: #ffffff;
  padding: 0.25rem;
  margin: 0.5rem 0;
  display: block;
}

/* Card header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-number {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-lt);
  background: rgba(99,102,241,0.15);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.meta-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}
.meta-tag.board  { color: var(--cyan);  background: rgba(34,211,238,0.08);  border-color: rgba(34,211,238,0.2); }
.meta-tag.college { color: var(--pink); background: rgba(236,72,153,0.08); border-color: rgba(236,72,153,0.2); }
.meta-tag.year   { color: var(--amber); background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2); }

/* Question text */
.q-text {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-1);
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.q-text p { margin-bottom: 0.3rem; }

/* MCQ Options grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  font-size: 0.9rem;
  color: var(--text-2);
  transition: all var(--transition);
}
.option-label {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
}
.option.show-answer.is-answer {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.35);
  color: #4ade80;
}
.option.show-answer.is-answer .option-label {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

/* Explanation */
.explain-block {
  display: none;
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: #fcd34d;
  line-height: 1.7;
}
.explain-block.show { display: block; animation: fadeSlide 0.3s ease; }
.explain-label { font-weight: 700; margin-bottom: 0.3rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--amber); }

/* CQ Specific */
.cq-context {
  background: rgba(124,58,237,0.07);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius-sm);
  padding: 1rem 1.125rem;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}
.cq-context img { max-height: 200px; object-fit: contain; }
.cq-context-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--violet);
  margin-bottom: 0.5rem;
}
.cq-sub-list { display: flex; flex-direction: column; gap: 1rem; }
.cq-item { border-top: 1px solid var(--border); padding-top: 1rem; }
.cq-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}
.type-a { background: rgba(99,102,241,0.15); color: var(--primary-lt); }
.type-b { background: rgba(34,211,238,0.12); color: var(--cyan); }
.type-c { background: rgba(236,72,153,0.12); color: var(--pink); }
.type-d { background: rgba(245,158,11,0.12); color: var(--amber); }
.cq-q-text { font-size: 0.95rem; color: var(--text-1); line-height: 1.7; margin-bottom: 0.5rem; }
.answer-block {
  display: none;
  padding: 0.875rem 1rem;
  background: rgba(34,197,94,0.06);
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: #86efac;
  line-height: 1.75;
}
.answer-block.show { display: block; animation: fadeSlide 0.3s ease; }
.answer-label { font-weight: 700; color: var(--green); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }

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

/* ══════════════════════════════════════════════
   STATES
══════════════════════════════════════════════ */
.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 1rem;
  padding: 3rem 2rem;
}
.state-icon { font-size: 3.5rem; filter: drop-shadow(0 4px 12px rgba(99,102,241,0.2)); }
.state-title { font-size: 1.25rem; font-weight: 700; color: var(--text-2); }
.state-sub   { font-size: 0.9rem; color: var(--text-3); max-width: 360px; }

/* Loading */
.spinner-ring {
  width: 52px; height: 52px;
  border: 3px solid rgba(99,102,241,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   UPLOAD MODAL
══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: none;
}
.modal-overlay.open {
  display: flex;
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-elevated);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04), var(--shadow-glow);
  animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--primary-lt), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.modal-close {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-2);
  font-size: 1.1rem;
  transition: all var(--transition);
  line-height: 1;
}
.modal-close:hover { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Form fields */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-input, .form-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.875rem;
  outline: none;
  transition: all var(--transition);
  width: 100%;
}
.form-select {
  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='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}
.form-select option { background: var(--bg-elevated); }
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: rgba(99,102,241,0.06);
}
.form-input::placeholder { color: var(--text-3); }

/* Drop zone */
.drop-zone {
  border: 2px dashed rgba(99,102,241,0.3);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(99,102,241,0.03);
  position: relative;
  margin-bottom: 1rem;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 24px rgba(99,102,241,0.1);
}
.drop-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; display: block; }
.drop-text { font-size: 0.875rem; color: var(--text-2); line-height: 1.5; }
.drop-text strong { color: var(--primary-lt); }
.drop-hint { font-size: 0.75rem; color: var(--text-3); margin-top: 0.25rem; }
.file-chosen {
  display: none;
  align-items: center;
  gap: 0.625rem;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.875rem;
  font-size: 0.85rem;
  color: #4ade80;
  margin-bottom: 1rem;
}
.file-chosen.visible { display: flex; }

/* Upload progress */
.upload-progress {
  display: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.upload-progress.visible { display: block; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 8px rgba(99,102,241,0.5);
}

/* Modal footer */
.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.btn-cancel {
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-cancel:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }
.btn-submit {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: white;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(99,102,241,0.4);
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(99,102,241,0.5); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.125rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(100px) scale(0.9); }
}
.toast-icon { font-size: 1.4rem; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.1rem; }
.toast-msg   { font-size: 0.78rem; color: var(--text-3); line-height: 1.4; }
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast.info    { border-color: rgba(99,102,241,0.3); }

/* ══════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .options-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header-top {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .header-center { order: 3; width: 100%; justify-content: flex-start; }
  .header-right  { margin-left: auto; }
  .btn-header span { display: none; }
  .btn-icon { display: grid; }
  
  .filters-row {
    display: none;
    flex-direction: column;
    padding: 1rem 1rem;
    gap: 0.75rem;
  }
  .filters-row.mobile-open { display: flex; }
  .filter-arrow { display: none; }
  .filter-item { min-width: 100%; }
  .filter-checks { flex-direction: row; }
  .check-group { flex-direction: row; flex-wrap: wrap; }

  .content-wrapper { padding: 1rem 0.875rem 5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .logo-text h1 { font-size: 1rem; }
  .tab-btn { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
  .question-card { padding: 1.1rem; }
  .modal-footer { flex-direction: column-reverse; }
  .btn-cancel, .btn-submit { width: 100%; justify-content: center; }
}

/* ══════════════════════════════════════════════
   QUESTION MAKER
══════════════════════════════════════════════ */
.qmaker-wrapper {
  padding: 0;
}
.qmaker-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 10px;
}
.qmaker-browse-panel {
  flex: 1;
  min-width: 0;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: 10px;
}
.qmaker-paper-panel {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.qm-type-toggle {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}
.qm-type-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
}
.qm-type-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.qm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.qm-card:hover {
  border-color: var(--primary-lt);
}
.qm-card.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}
.qm-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qm-passage-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--violet);
  background: rgba(124, 58, 237, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.qm-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 10px;
  margin-bottom: 10px;
  font-family: inherit;
}
.qm-input:focus {
  border-color: var(--primary);
  outline: none;
}
.qm-selected-list {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qm-sel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
}
.qm-sel-del {
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.qm-sel-del:hover {
  background: rgba(239, 68, 68, 0.1);
}
.qm-btn-export {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  transition: all var(--transition);
}
.qm-btn-export:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.qm-btn-export:not(:disabled):hover {
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.qm-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 12px 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
  z-index: 100;
}
.qm-fab svg { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .qmaker-layout {
    flex-direction: column;
  }
  .qmaker-paper-panel {
    width: 100%;
    position: static;
  }
}

/* ══════════════════════════════════════════════
   USER BADGE & LOGOUT
══════════════════════════════════════════════ */
.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.625rem;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 30px;
  transition: all var(--transition);
}

.user-badge-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.user-badge-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
}

.user-badge-access {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--primary-lt);
  background: rgba(99,102,241,0.15);
  padding: 0 0.4rem;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  align-self: flex-start;
}

.btn-logout {
  background: rgba(239,68,68,0.08);
  color: #f87171;
  border-color: rgba(239,68,68,0.2);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  flex-shrink: 0;
}
.btn-logout:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 0 12px rgba(239,68,68,0.15);
}
.btn-logout svg { width: 15px; height: 15px; }

@media (max-width: 600px) {
  .user-badge-info { display: none; }
  .user-badge { padding: 0.35rem; }
}
