/* ================================
   QUESTIONS MANAGEMENT PAGE
   Theme-aware: uses --theme-* for light/dark mode
   ================================ */

.questions-management-page {
  --qm-primary: var(--theme-primary, #f21b23);
  --qm-primary-dark: var(--theme-primary-dark, #d91820);
  --qm-accent: var(--theme-primary);
  --qm-surface: var(--theme-card-bg, rgba(255, 255, 255, 0.9));
  --qm-border: var(--theme-border-color, rgba(0, 0, 0, 0.08));
  --qm-text: var(--theme-text-primary, #4d4d4f);
  --qm-text-muted: var(--theme-text-secondary, #4d4d4f);
  --qm-radius: var(--theme-radius, 12px);
  --qm-radius-sm: 8px;
  --qm-shadow: var(--shadow-md, 0 4px 20px rgba(0, 0, 0, 0.08));
  --qm-shadow-hover: var(--shadow-lg, 0 8px 30px rgba(0, 0, 0, 0.12));
  padding: 0;
  min-height: 0;
  width: 100%;
}

/* Tabs - questions page */
.questions-management-page .tab-navigation {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  background: var(--qm-surface);
  border: 1px solid var(--qm-border);
  border-radius: var(--qm-radius);
  box-shadow: var(--qm-shadow);
  flex-wrap: wrap;
}

/* Dark theme: content section uses rgba(58, 56, 56, 0.95) */
body.night-mode .questions-management-page .tab-navigation,
body.night-mode .questions-management-page .form-section {
  background: rgba(58, 56, 56, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Dark theme: ensure all text is readable (light on dark) */
body.night-mode .questions-management-page .tab-btn {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .questions-management-page .tab-btn:hover {
  color: #f87171;
  background: rgba(255, 255, 255, 0.08);
}
body.night-mode .questions-management-page .tab-btn.active {
  color: #f87171;
  background: rgba(248, 113, 113, 0.2);
}
body.night-mode .questions-management-page .tab-btn.active svg,
body.night-mode .questions-management-page .tab-btn svg {
  color: inherit;
}
body.night-mode .questions-management-page .user-create-form-header-title {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .questions-management-page .input-label {
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .questions-management-page .input-field,
body.night-mode .questions-management-page .select-field {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .questions-management-page .input-field::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
body.night-mode .questions-management-page .form-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
}
body.night-mode .questions-management-page .form-actions .btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .questions-management-page .input-group:focus-within .input-label {
  color: #f87171;
}
body.night-mode .questions-management-page .required-asterisk {
  color: #f87171;
}

.questions-management-page .tab-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--qm-radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--qm-text-muted);
  transition: all 0.25s ease;
  position: relative;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.questions-management-page .tab-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.questions-management-page .tab-btn:hover {
  color: var(--qm-primary);
  background: var(--theme-sidebar-hover-bg, rgba(0, 0, 0, 0.04));
}

.questions-management-page .tab-btn.active {
  color: var(--qm-primary);
  background: var(--theme-sidebar-active-bg, rgba(242, 27, 35, 0.12));
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.questions-management-page .tab-btn.active svg {
  color: var(--qm-primary);
}

/* Form section overrides */
.questions-management-page .form-section {
  background: var(--qm-surface);
  border-radius: var(--qm-radius);
  box-shadow: var(--qm-shadow);
  border: 1px solid var(--qm-border);
}

.questions-management-page .form-header {
  border-bottom-color: var(--qm-border);
}

.questions-management-page .user-create-form-header-title {
  color: var(--qm-text);
  font-size: 1.5rem;
}

.questions-management-page .form-actions {
  border-top-color: var(--qm-border);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.questions-management-page .form-actions .btn-primary {
  background: linear-gradient(135deg, var(--qm-primary) 0%, var(--qm-primary-dark) 100%);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--qm-radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  min-height: 44px;
}

.questions-management-page .form-actions .btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.questions-management-page .form-actions .btn-secondary {
  background: var(--qm-surface);
  color: var(--qm-text-muted);
  border: 2px solid var(--qm-border);
  padding: 0.75rem 1.5rem;
  border-radius: var(--qm-radius-sm);
  font-weight: 600;
  min-height: 44px;
}

.questions-management-page .form-actions .btn-secondary:hover:not(:disabled) {
  border-color: var(--qm-primary);
  color: var(--qm-primary);
  background: var(--theme-sidebar-hover-bg, rgba(0, 0, 0, 0.04));
}

/* Input focus theme */
.questions-management-page .input-field:focus,
.questions-management-page .select-field:focus {
  border-color: var(--qm-primary);
  box-shadow: 0 0 0 3px var(--theme-border-color);
}

.questions-management-page .input-group:focus-within .input-label {
  color: var(--qm-primary);
}

/* Inputs and labels - theme colors */
.questions-management-page .input-label {
  color: var(--qm-text);
}

.questions-management-page .input-field,
.questions-management-page .select-field {
  background: var(--theme-input-bg, #ffffff);
  color: var(--qm-text);
  border-color: var(--qm-border);
}

.questions-management-page .input-field::placeholder {
  color: var(--qm-text-muted);
}

/* Error message - theme-aware */
.questions-management-page .user-create-error {
  background: var(--theme-input-bg);
  color: var(--danger-color, #f44336);
  border: 1px solid var(--danger-color, #f44336);
  border-radius: var(--qm-radius-sm);
}

/* ================================
   OPTIONS BUILDER (Question Create)
   ================================ */
.questions-management-page .form-column-full {
  grid-column: 1 / -1;
}

.questions-management-page .options-builder .input-hint {
  display: block;
  margin-top: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--qm-text-muted);
  line-height: 1.4;
}

.questions-management-page .options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.questions-management-page .option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.questions-management-page .option-number {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--qm-text-muted);
  min-width: 1.5rem;
}

.questions-management-page .option-input {
  flex: 1;
  min-width: 200px;
}

.questions-management-page .option-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--qm-border);
  border-radius: var(--qm-radius-sm);
  background: var(--qm-surface);
  color: var(--qm-text-muted);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.questions-management-page .option-remove-btn:hover {
  border-color: var(--qm-primary);
  color: var(--qm-primary);
  background: rgba(242, 27, 35, 0.08);
}

.questions-management-page .option-remove-btn svg {
  width: 18px;
  height: 18px;
}

.questions-management-page .option-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: 2px solid var(--qm-border);
  border-radius: var(--qm-radius-sm);
  background: var(--qm-surface);
  color: var(--qm-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  font-family: inherit;
}

.questions-management-page .option-add-btn:hover {
  border-color: var(--qm-primary);
  color: var(--qm-primary);
  background: rgba(242, 27, 35, 0.08);
}

.questions-management-page .option-add-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.questions-management-page .options-empty-msg {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--qm-text-muted);
  font-style: italic;
}

/* Dark theme – options section */
body.night-mode .questions-management-page .options-builder .input-hint,
.night-mode .questions-management-page .options-builder .input-hint {
  color: rgba(255, 255, 255, 0.78);
}

body.night-mode .questions-management-page .option-number,
.night-mode .questions-management-page .option-number {
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .questions-management-page .option-remove-btn,
.night-mode .questions-management-page .option-remove-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .questions-management-page .option-remove-btn:hover,
.night-mode .questions-management-page .option-remove-btn:hover {
  border-color: #f87171;
  color: #f87171;
  background: rgba(248, 113, 113, 0.2);
}

body.night-mode .questions-management-page .option-add-btn,
.night-mode .questions-management-page .option-add-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .questions-management-page .option-add-btn:hover,
.night-mode .questions-management-page .option-add-btn:hover {
  border-color: #f87171;
  color: #f87171;
  background: rgba(248, 113, 113, 0.2);
}

body.night-mode .questions-management-page .option-add-btn svg,
.night-mode .questions-management-page .option-add-btn svg {
  color: inherit;
}

body.night-mode .questions-management-page .options-empty-msg,
.night-mode .questions-management-page .options-empty-msg {
  color: rgba(255, 255, 255, 0.7);
}

/* Slightly brighter placeholder for option inputs in dark mode */
body.night-mode .questions-management-page .options-builder .option-input::placeholder,
.night-mode .questions-management-page .options-builder .option-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* ================================
   MOBILE RESPONSIVE
   ================================ */

@media (max-width: 768px) {
  .questions-management-page {
    padding: 0;
  }

  .questions-management-page .tab-navigation {
    flex-direction: row;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
  }

  .questions-management-page .tab-btn {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }

  .questions-management-page .tab-btn span {
    display: inline;
  }

  .questions-management-page .form-section,
  .questions-management-page .table-section {
    padding: 1rem;
    border-radius: var(--qm-radius-sm);
  }

  .questions-management-page .form-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .questions-management-page .form-actions {
    flex-direction: column;
    width: 100%;
  }

  .questions-management-page .form-actions .btn-primary,
  .questions-management-page .form-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .questions-management-page .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .questions-management-page .tab-btn {
    padding: 0.7rem 0.5rem;
    font-size: 0.8rem;
  }

  .questions-management-page .tab-btn svg {
    width: 18px;
    height: 18px;
  }
}
