/* ==========================================================================
   SIKKHALAY QUESTION BANK DATABASE INGESTION & ENTRY STUDIO (CSS)
   Optimized for High-Speed Question Insertion (MCQ & CQ) & Custom Scoring
   ========================================================================== */

/* 1. ROOT DESIGN TOKENS */
:root {
  --brand-primary: #059669;
  --brand-primary-hover: #047857;
  --brand-primary-light: #ecfdf5;
  --brand-dark: #064e3b;
  --brand-border: #a7f3d0;
  
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  
  --accent-blue: #2563eb;
  --accent-blue-light: #dbeafe;
  --accent-blue-border: #bfdbfe;
  
  --accent-indigo: #4f46e5;
  --accent-indigo-light: #e0e7ff;
  --accent-indigo-border: #c7d2fe;
  
  --accent-amber: #d97706;
  --accent-amber-light: #fef3c7;
  --accent-amber-border: #fde68a;
  
  --accent-red: #dc2626;
  --accent-red-light: #fee2e2;
  --accent-red-border: #fecaca;
  
  --accent-purple: #9333ea;
  --accent-purple-light: #f3e8ff;
  --accent-purple-border: #e9d5ff;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  
  --header-height: 64px;
  --max-content-width: 1480px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* 2. BASE RESETS */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-subtle);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

/* 3. STUDIO HEADER */
.studio-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.studio-header-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.studio-brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, #047857 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
  flex-shrink: 0;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.studio-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.3rem 0.65rem;
  background: var(--brand-primary-light);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-dark);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--brand-primary);
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* 4. MAIN WORKSPACE */
.studio-main {
  flex: 1;
  max-width: var(--max-content-width);
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.studio-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 1.15rem 1.4rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.studio-hero-title h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.studio-hero-title p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Navigation Tabs */
.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-subtle);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.ws-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.ws-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
}

.ws-tab-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

/* Ingestion Queue Summary */
.queue-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.queue-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.queue-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.queue-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.queue-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.queue-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

/* 5. CARDS & CONTAINER LAYOUTS */
.studio-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1.15rem;
}

.studio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.studio-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.studio-card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* 6. FORM CONTROLS & GRIDS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.form-group-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.form-control, .form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* Custom Scoring Management Strip inside Question Cards */
.scoring-management-box {
  background: var(--brand-primary-light);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.scoring-fields-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.score-field-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-dark);
}

.score-number-input {
  width: 68px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-dark);
  text-align: center;
  outline: none;
}

.score-number-input:focus {
  border-color: var(--brand-primary);
}

/* 7. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}
.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  box-shadow: 0 4px 6px rgba(5, 150, 105, 0.3);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-accent {
  background: var(--accent-indigo-light);
  color: var(--accent-indigo);
  border: 1px solid var(--accent-indigo-border);
}
.btn-accent:hover {
  background: #c7d2fe;
}

.btn-danger-outline {
  background: transparent;
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
}
.btn-danger-outline:hover {
  background: var(--accent-red-light);
}

.btn-sm {
  padding: 0.32rem 0.65rem;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* 8. BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-emerald {
  background: var(--brand-primary-light);
  color: var(--brand-dark);
  border: 1px solid var(--brand-border);
}

.badge-indigo {
  background: var(--accent-indigo-light);
  color: #3730a3;
  border: 1px solid var(--accent-indigo-border);
}

.badge-amber {
  background: var(--accent-amber-light);
  color: #92400e;
  border: 1px solid var(--accent-amber-border);
}

.badge-blue {
  background: var(--accent-blue-light);
  color: #1e40af;
  border: 1px solid var(--accent-blue-border);
}

.badge-purple {
  background: var(--accent-purple-light);
  color: #6b21a8;
  border: 1px solid var(--accent-purple-border);
}

.badge-slate {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* 9. QUESTION ENTRY CARDS */
.question-composer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  margin-bottom: 1rem;
  position: relative;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.question-composer-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.question-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.65rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* MCQ Options 4-Box Grid */
.mcq-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.mcq-option-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-subtle);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  transition: all var(--transition-fast);
}

.mcq-option-row:focus-within {
  border-color: var(--border-medium);
  background: var(--bg-surface);
}

.mcq-option-row.is-correct {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary);
}

.mcq-radio {
  accent-color: var(--brand-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.opt-prefix {
  font-weight: 800;
  font-size: 0.8rem;
  min-width: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.mcq-option-row.is-correct .opt-prefix {
  color: var(--brand-primary);
}

/* Image Upload Preview Box */
.image-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.img-preview-box {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.img-preview-thumb {
  max-height: 48px;
  max-width: 100px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border-light);
}

/* 10. CQ (CREATIVE QUESTION) CARDS */
.cq-subq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.cq-subq-box {
  background: var(--bg-subtle);
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.cq-subq-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 11. RAW BULK TEXT PARSER & REPOSITORY */
.bulk-parse-textarea {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #334155;
  padding: 1rem;
  border-radius: var(--radius-md);
  width: 100%;
}

.qbank-search-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qbank-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.qbank-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

/* 12. TOAST & MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: 90vw;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  pointer-events: auto;
  animation: slideToast 0.25s ease-out forwards;
  word-break: break-word;
}

@keyframes slideToast {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 13. RESPONSIVE DESIGN (FOR <= 768px, <= 480px, < 400px) */
@media (max-width: 768px) {
  .studio-main {
    padding: 1rem 0.85rem;
  }
  
  .studio-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.15rem;
  }
  
  .workspace-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  
  .mcq-options-grid,
  .cq-subq-grid {
    grid-template-columns: 1fr;
  }

  .form-group-span-2 {
    grid-column: span 1 !important;
  }
}

@media (max-width: 480px) {
  .studio-header-inner {
    padding: 0.5rem 0.75rem;
  }

  .studio-header-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 0;
    gap: 0.35rem;
  }

  .studio-header-actions .btn {
    font-size: 0.74rem;
    padding: 0.35rem 0.6rem;
    flex-shrink: 0;
  }

  .studio-main {
    padding: 0.75rem 0.5rem;
  }

  .studio-hero {
    padding: 0.85rem 0.75rem;
    border-radius: var(--radius-lg);
    margin-bottom: 0.85rem;
  }

  .studio-hero-title h1 {
    font-size: 1.2rem;
  }

  .queue-summary-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .queue-summary-strip .queue-card:last-child {
    grid-column: span 2;
  }

  .studio-card {
    padding: 1rem 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .form-grid > .form-group,
  .form-grid > .form-group-span-2 {
    grid-column: span 1 !important;
  }

  .qbank-search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .qbank-search-bar input,
  .qbank-search-bar select {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* SMALL MOBILE SCREENS (< 400px) */
@media (max-width: 400px) {
  :root {
    --header-height: auto;
  }

  body {
    font-size: 13px;
  }

  .studio-header-inner {
    padding: 0.45rem 0.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .studio-brand-group {
    justify-content: space-between;
    width: 100%;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .brand-title {
    font-size: 0.92rem;
  }

  .brand-subtitle {
    font-size: 0.65rem;
  }

  .status-pill {
    font-size: 0.68rem;
    padding: 0.2rem 0.5rem;
  }

  .studio-header-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    gap: 4px;
    scrollbar-width: none;
  }

  .studio-header-actions::-webkit-scrollbar {
    display: none;
  }

  .studio-header-actions .btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    flex-shrink: 0;
  }

  .studio-main {
    padding: 0.5rem 0.35rem;
  }

  .studio-hero {
    padding: 0.75rem 0.6rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
  }

  .studio-hero-title h1 {
    font-size: 1.1rem;
    line-height: 1.25;
  }

  .studio-hero-title p {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .workspace-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 3px;
    gap: 3px;
  }

  .ws-tab-btn {
    font-size: 0.72rem;
    padding: 0.38rem 0.6rem;
    flex-shrink: 0;
  }

  .queue-summary-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.75rem;
  }

  .queue-card {
    padding: 0.55rem 0.45rem;
    gap: 0.45rem;
    border-radius: var(--radius-sm);
  }

  .queue-icon {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }

  .queue-val {
    font-size: 0.85rem;
  }

  .queue-lbl {
    font-size: 0.6rem;
  }

  .studio-card {
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
  }

  .studio-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.65rem;
  }

  .studio-card-title {
    font-size: 0.95rem;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.55rem;
  }

  .form-grid > .form-group,
  .form-grid > .form-group-span-2 {
    grid-column: span 1 !important;
  }

  .form-label {
    font-size: 0.72rem;
  }

  .form-control, .form-input, .form-select, .form-textarea {
    font-size: 0.78rem;
    padding: 0.42rem 0.55rem;
  }

  .question-composer-card {
    padding: 0.7rem 0.45rem;
    margin-bottom: 0.7rem;
    border-radius: var(--radius-md);
  }

  .question-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .mcq-options-grid {
    grid-template-columns: 1fr !important;
    gap: 0.4rem;
  }

  .mcq-option-row {
    padding: 0.45rem 0.5rem;
    gap: 0.45rem;
  }

  .opt-prefix {
    font-size: 0.75rem;
    min-width: 16px;
  }

  .mcq-option-row .form-control {
    font-size: 0.76rem;
    padding: 0.35rem 0.45rem;
  }

  .cq-subq-grid {
    grid-template-columns: 1fr !important;
    gap: 0.4rem;
  }

  .cq-subq-box {
    padding: 0.5rem 0.45rem;
  }

  .scoring-management-box {
    padding: 0.5rem 0.6rem;
  }

  .scoring-fields-wrap {
    gap: 0.5rem;
    width: 100%;
    justify-content: space-between;
  }

  .qbank-search-bar {
    padding: 0.55rem 0.45rem;
    gap: 0.4rem;
  }

  .qbank-card {
    padding: 0.7rem 0.5rem;
  }

  .qbank-card h4 {
    font-size: 0.82rem;
  }

  .qbank-card .btn {
    width: 100%;
    font-size: 0.75rem;
    margin-top: 0.4rem;
  }

  #toast-container {
    left: 8px;
    right: 8px;
    bottom: 10px;
  }

  .toast {
    font-size: 0.74rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-box {
    max-width: 100%;
    border-radius: var(--radius-lg);
  }

  .modal-header,
  .modal-footer {
    padding: 0.65rem 0.75rem;
  }

  .modal-body {
    padding: 0.75rem 0.65rem;
  }
}

/* ============================================================
   v3.0 — MySQL Integration: API Status Pill, Pulse, Purple
   ============================================================ */

:root {
  --accent-purple-light:  #faf5ff;
  --accent-purple-border: #e9d5ff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fde68a;
  transition: background 0.4s, color 0.4s, border-color 0.4s;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  animation: pill-pulse 1.8s ease-in-out infinite;
}

@keyframes pill-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.75); }
}

.badge-purple {
  background: var(--accent-purple-light);
  color: #7c3aed;
  border: 1px solid var(--accent-purple-border);
}

.studio-card-subtitle code {
  background: #f1f5f9;
  color: #0f172a;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--border-light);
}

/* ============================================================
   SMART QUESTION EXTRACTOR (IMAGES & PDF) STYLES
   ============================================================ */

.smart-extractor-card {
  background: linear-gradient(180deg, #ffffff 0%, #fafdfb 100%);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 4px 12px -2px rgba(5, 150, 105, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.smart-extractor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-primary) 0%, #10b981 50%, var(--accent-indigo) 100%);
}

.smart-extractor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.extractor-title-group {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  flex: 1;
  min-width: 280px;
}

.extractor-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-primary) 0%, #047857 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

.extractor-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.extractor-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.extractor-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.45;
  max-width: 900px;
}

.extractor-header-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.extractor-body {
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.extractor-body.is-collapsed {
  display: none;
}

.extractor-controls-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
  background: var(--bg-subtle);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.extractor-control-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.extractor-dropzone {
  border: 2px dashed var(--brand-border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 1.85rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.extractor-dropzone:hover,
.extractor-dropzone.drag-active {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.08);
  transform: translateY(-1px);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.dropzone-icon {
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.extractor-dropzone:hover .dropzone-icon {
  transform: scale(1.08) translateY(-2px);
}

.dropzone-text h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.dropzone-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.staged-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.staged-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
  max-height: 250px;
  overflow-y: auto;
  padding: 2px;
}

.staged-file-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  position: relative;
  transition: all var(--transition-fast);
}

.staged-file-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.staged-file-card.is-processing {
  border-color: var(--accent-amber-border);
  background: var(--accent-amber-light);
}

.staged-file-card.is-done {
  border-color: var(--brand-border);
  background: var(--brand-primary-light);
}

.staged-file-card.is-error {
  border-color: var(--accent-red-border);
  background: var(--accent-red-light);
}

.staged-file-thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.staged-file-info {
  flex: 1;
  min-width: 0;
}

.staged-file-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staged-file-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.staged-file-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.staged-file-remove:hover {
  color: var(--accent-red);
  background: var(--accent-red-light);
}

.extractor-progress-wrap {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.progress-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
}

.progress-status-text {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-percent-text {
  font-weight: 700;
  color: var(--brand-primary);
  font-family: 'JetBrains Mono', monospace;
}

.progress-track {
  height: 8px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary) 0%, #10b981 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.extractor-action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.15rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border-light);
}

.extractor-tip-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.extractor-tip-text span {
  font-weight: 700;
  color: var(--brand-dark);
}

@media (max-width: 768px) {
  .smart-extractor-card {
    padding: 0.85rem 0.65rem;
  }
  .extractor-title {
    font-size: 1rem;
  }
  .extractor-controls-bar {
    grid-template-columns: 1fr;
    padding: 0.65rem 0.75rem;
  }
  .extractor-dropzone {
    padding: 1.25rem 0.85rem;
  }
  .extractor-action-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .extractor-action-strip > div:last-child {
    flex-direction: column;
  }
  .extractor-action-strip .btn {
    width: 100%;
    justify-content: center;
  }
}

