/* Gamilar Visual Quiz Builder - Compact High-Density Pro Styles */

.editor-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.editor-sidebar {
  width: 250px;
  background: rgba(9, 13, 22, 0.9);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #c7d2fe;
}

.question-nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.question-nav-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.question-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.question-nav-item.active {
  background: rgba(79, 70, 229, 0.25);
  border-color: #6366f1;
  color: #ffffff;
  font-weight: 700;
}

.q-nav-number {
  font-weight: 800;
  color: #a5b4fc;
}

.q-nav-text {
  flex: 1;
  margin: 0 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-nav-del {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.q-nav-del:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.2);
}

/* Main Area */
.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--card-border);
}

.action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.action-btn.primary {
  background: #4f46e5;
  border-color: #6366f1;
  color: white;
}

.action-btn.primary:hover {
  background: #4338ca;
}

.action-btn.danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.38);
  color: #fca5a5;
  font-weight: 700;
}

.action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.32);
  border-color: #ef4444;
  color: #ffffff;
}

/* Compact Meta Grid */
.meta-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 2.5fr;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.editor-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.editor-input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xs);
  color: white;
  outline: none;
  transition: border-color 0.15s;
}

.editor-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Compact Question Detail Card */
.question-detail-card {
  background: var(--surface-card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

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

.question-card-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
}

.q-text-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 1.05rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xs);
  color: white;
  outline: none;
}

.q-text-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Options 2x2 Grid */
.options-builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.option-edit-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid white;
}

.option-edit-row.opt-a { border-left-color: var(--color-opt-a); }
.option-edit-row.opt-b { border-left-color: var(--color-opt-b); }
.option-edit-row.opt-c { border-left-color: var(--color-opt-c); }
.option-edit-row.opt-d { border-left-color: var(--color-opt-d); }

.option-edit-row .choice-badge {
  width: 26px;
  height: 26px;
  font-size: 0.88rem;
}

.option-radio {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #10b981;
}

.option-edit-row .editor-input {
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
}

/* AI Prompt Modal */
.ai-prompt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.ai-prompt-modal-backdrop.open {
  display: flex;
}

.ai-prompt-modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  padding: 2rem 2.2rem;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75);
  animation: floatIn 0.25s ease-out;
  box-sizing: border-box;
}

.ai-prompt-modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: all 0.2s;
}

.ai-prompt-modal-close:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: rgba(239, 68, 68, 0.6);
  transform: rotate(90deg);
}

.ai-prompt-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.ai-prompt-icon {
  font-size: 2.2rem;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-prompt-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.2rem;
}

.ai-prompt-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.ai-prompt-box-wrap {
  flex: 1;
  min-height: 220px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.ai-prompt-textarea {
  width: 100%;
  height: 100%;
  min-height: 220px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  color: #f1f5f9;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.86rem;
  line-height: 1.5;
  padding: 1rem;
  resize: vertical;
  outline: none;
  overflow-y: auto;
  box-sizing: border-box;
}

.ai-prompt-textarea:focus {
  border-color: #6366f1;
}

.ai-prompt-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-prompt-instructions {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 440px;
}

.ai-prompt-instructions code {
  background: rgba(255, 255, 255, 0.12);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: #38bdf8;
}

.ai-prompt-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-shrink: 0;
}
