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

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #93C5FD;
  --accent: #F59E0B;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;

  --bg-main: #F0F4FF;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #F8FAFF;
  --bg-gradient: linear-gradient(135deg, #EEF2FF 0%, #F0F9FF 40%, #FDF2F8 100%);

  --text-secondary: #64748B;
  --text-muted: #94A3B8;

  --border: #E2E8F0;
  --border-focus: #3B82F6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(59,130,246,0.12);

  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --sidebar-width: 220px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { 
  background: var(--bg-gradient); }
/* .question-block, .answer-options, .q-main, .answer-opt {
  user-select: none;
  -webkit-user-select: none; */
/* } */

/* ── Layout ────────────────────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,0.04);
}

.sidebar-logo {
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo span {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: 1.1rem;
  background: linear-gradient(to right, #F59E0B, #3B82F6);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
  letter-spacing: -0.3px;
}
.logo-icon {
  width: 28px; height: 28px;
  /* background: linear-gradient(135deg, #3B82F6, #8B5CF6); */
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.18s ease;
  text-decoration: none;
  position: relative;
}
.nav-item:hover { background: #F0F4FF; color: var(--primary); }
.nav-item.active {
  color: var(--primary);
  background: #EEF2FF;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.topbar-title h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem; font-weight: 700;
  color: var(--text-primary);
}
.topbar-title p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 2px; }

.user-badge {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary);
}
.avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.75rem; font-weight: 700;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: #F1F5F9;
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 9px 16px;
  border: none; background: none;
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.2s ease;
}
.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}

/* ── Drop Zone ─────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed #BFDBFE;
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: #EFF6FF;
  transition: all 0.2s ease;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: #DBEAFE;
}
.drop-zone-icon {
  width: 48px; height: 48px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-sm);
  color: var(--primary);
}
.drop-zone-title { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.drop-zone-sub { font-size: 0.8rem; color: var(--text-muted); }
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ── Uploaded File Badge ───────────────────────────────────────────────────── */
.file-badge {
  display: flex; align-items: center; gap: 12px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.file-icon {
  width: 40px; height: 40px;
  background: #EF4444;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.65rem; font-weight: 800;
  letter-spacing: 0;
}
.file-info { flex: 1; }
.file-info .file-name { font-weight: 600; font-size: 0.9rem; }
.file-info .file-size { font-size: 0.8rem; color: var(--text-muted); }
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: 6px; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: #FEE2E2; color: var(--danger); }

/* ── Format Settings ───────────────────────────────────────────────────────── */
.format-settings { margin-top: 20px; }
.format-settings h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem; font-weight: 700; margin-bottom: 16px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.setting-group label {
  display: block;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.setting-group select,
.setting-group input[type="number"],
.setting-group input[type="text"] {
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  line-height: 1.2;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-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='%2394A3B8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.setting-group input[type="number"],
.setting-group input[type="text"] {
  background-image: none;
  padding-right: 12px;
}

/* Remove native number spinner arrows so height stays consistent */
.setting-group input[type="number"]::-webkit-inner-spin-button,
.setting-group input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* .setting-group input[type="number"] {
  -moz-appearance: textfield;
} */
.setting-group select:focus,
.setting-group input:focus { border-color: var(--border-focus); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white; border: none;
  border-radius: 100px;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0.2px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  padding: 10px 20px;
  background: white; color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 100px;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-secondary:hover { background: #EEF2FF; }

.btn-success {
  padding: 10px 24px;
  background-color: #3A86FF;
  color: white; border: none;
  border-radius: 100px;
  font-size: 0.85rem; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(16,185,129,0.3);
  font-family: inherit;
}
.btn-success:hover { transform: translateY(-1px); }

/* ── Generated Questions List ─────────────────────────────────────────────── */
.questions-output { margin-top: 24px; }
.questions-output-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.questions-output-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem; font-weight: 700;
}
.q-actions { display: flex; gap: 10px; }

.question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  background: white;
  transition: box-shadow 0.15s;
  position: relative;
}
.question-card:hover { box-shadow: var(--shadow-md); }
.question-card.editing { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

.q-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.q-number {
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--primary); color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}
.q-text { flex: 1; font-weight: 600; font-size: 0.9rem; line-height: 1.5; }
.q-text textarea {
  width: 100%; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  resize: vertical; outline: none;
  background: var(--bg-input);
}
.q-text textarea:focus { border-color: var(--primary); }
.q-edit-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); padding: 4px;
  border-radius: 6px; transition: background 0.15s;
  flex-shrink: 0;
}
.q-edit-btn:hover { background: #EEF2FF; }

.options-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  transition: all 0.15s;
}
.option-item.correct { background: #ECFDF5; border-color: #6EE7B7; }
.option-label {
  width: 22px; height: 22px; flex-shrink: 0;
  background: #F1F5F9; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--text-secondary);
}
.option-item.correct .option-label { background: #10B981; color: white; }
.option-item input {
  flex: 1; border: none; background: none;
  font-family: inherit; font-size: 0.85rem; outline: none;
}
.correct-indicator { color: var(--success); margin-left: auto; flex-shrink: 0; }

.q-footer { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.correct-answer-selector { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.correct-answer-selector select {
  padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.8rem; background: var(--bg-input);
  outline: none; font-family: inherit;
}
.q-save-btn {
  padding: 6px 16px;
  background: var(--success); color: white;
  border: none; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%; max-width: 480px;
  transform: translateY(20px);
  transition: transform 0.2s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem; font-weight: 800; margin-bottom: 6px;
}
.modal p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 20px; }
.modal-field { margin-bottom: 16px; }
.modal-field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.modal-field input, .modal-field textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px; font-family: inherit;
  font-size: 0.9rem; outline: none;
  transition: border-color 0.15s;
  background: var(--bg-input);
}
.modal-field input:focus, .modal-field textarea:focus { border-color: var(--primary); }
.modal-field textarea { resize: vertical; min-height: 80px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-secondary { flex: 1; justify-content: center; }
.modal-actions .btn-success { flex: 1; justify-content: center; }

/* ── Share URL box ─────────────────────────────────────────────────────────── */
.share-url-box {
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
}
.share-url-box input {
  flex: 1; border: none; background: none;
  font-size: 0.85rem; color: var(--primary);
  font-weight: 500; outline: none;
}
.share-url-box button {
  background: var(--primary); color: white;
  border: none; border-radius: 6px;
  padding: 6px 12px; font-size: 0.8rem;
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.share-url-box button:hover { background: var(--primary-dark); }

/* ── Loading Spinner ───────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: white;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; font-weight: 500;
  border-left: 4px solid var(--success);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  min-width: 280px;
}
.toast.show { transform: translateX(0); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

/* ── Quiz List / History ───────────────────────────────────────────────────── */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.quiz-list-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  transition: all 0.2s;
  cursor: pointer;
}
.quiz-list-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quiz-list-card h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem; font-weight: 700; margin-bottom: 4px;
}
.quiz-list-card .meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.quiz-list-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem; font-weight: 600;
  background: #EEF2FF; color: var(--primary);
}
.tag.green { background: #ECFDF5; color: #059669; }
.tag.orange { background: #FFF7ED; color: #D97706; }
.quiz-list-card .card-actions { display: flex; gap: 8px; }
.btn-sm {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-secondary);
}
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-sm.primary:hover { background: var(--primary-dark); }
.btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── Text area for text input tab ─────────────────────────────────────────── */
.text-input-area {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 0.9rem;
  resize: vertical; outline: none;
  background: var(--bg-input);
  transition: border-color 0.15s;
  color: var(--text-primary);
}
.text-input-area:focus { border-color: var(--primary); }
.text-input-area::placeholder { color: var(--text-muted); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: none; }
  .main-content { padding: 20px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .options-list { grid-template-columns: 1fr; }
}
