/* Multi-question exam UI: view switch, question navigator, manager, modals. */

#view-switch {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #252526;
  border-bottom: 1px solid #3a3a3a;
  min-height: 40px;
  flex: 0 0 auto;
}

.view-tab {
  padding: 5px 14px;
  background: #333333;
  color: #cccccc;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.view-tab:hover {
  border-color: #007acc;
}

.view-tab.active {
  background: #007acc;
  color: #ffffff;
  border-color: #007acc;
}

.view-switch-spacer {
  flex: 1;
}

.view-session-code {
  color: #9d9d9d;
  font-size: 13px;
}

#exam-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#exam-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#question-sidebar {
  width: 330px;
  min-width: 220px;
  max-width: 45vw;
  display: flex;
  flex-direction: column;
  background: #252526;
  border-right: 1px solid #3a3a3a;
  min-height: 0;
}

.q-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c8c8c;
  border-bottom: 1px solid #333333;
}

.q-count {
  background: #333333;
  border-radius: 9px;
  padding: 0 7px;
  color: #cccccc;
  font-size: 11px;
}

.question-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  max-height: 42%;
  flex: 0 0 auto;
}

.question-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  color: #d4d4d4;
  font-size: 13px;
}

.question-item:hover {
  background: #2f2f2f;
}

.question-item.active {
  background: #094771;
  border-left-color: #007acc;
  color: #ffffff;
}

.question-item .q-index {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3a3a3a;
  color: #cccccc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex: 0 0 auto;
}

.question-item.active .q-index {
  background: #007acc;
  color: #ffffff;
}

.question-item.completed .q-dot {
  color: #4caf50;
}

.question-item.answered .q-dot {
  color: #ffb74d;
}

.q-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-dot {
  font-size: 11px;
  color: transparent;
  width: 12px;
  text-align: right;
}

.question-detail {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  border-top: 1px solid #333333;
  min-height: 0;
}

.question-detail h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #ffffff;
}

.markdown-body {
  color: #cfcfcf;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: #e8e8e8;
  font-size: 14px;
  margin: 12px 0 6px;
}

.markdown-body p {
  margin: 6px 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
  margin: 6px 0;
}

.markdown-body pre {
  background: #1b1b1b;
  border: 1px solid #333333;
  border-radius: 4px;
  padding: 8px 10px;
  overflow-x: auto;
}

.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
}

.markdown-body :not(pre) > code {
  background: #333333;
  border-radius: 3px;
  padding: 1px 4px;
}

.markdown-body table {
  border-collapse: collapse;
  margin: 8px 0;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #444444;
  padding: 4px 8px;
}

.q-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.q-status {
  font-size: 12px;
  color: #9d9d9d;
}

.q-status.done {
  color: #4caf50;
}

.q-empty {
  padding: 16px 14px;
  color: #8c8c8c;
  font-size: 13px;
  line-height: 1.6;
}

#mark-done-btn.is-done {
  background: #2e7d32;
  border-color: #2e7d32;
}

.toggle-label {
  display: none;
  align-items: center;
  gap: 4px;
  color: #cccccc;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.toggle-label input {
  accent-color: #007acc;
}

/* Interviewer question manager */
#manage-view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.manage-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #2d2d2d;
  border-bottom: 1px solid #3a3a3a;
  flex: 0 0 auto;
}

.manage-title {
  font-size: 14px;
  color: #ffffff;
}

.manage-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.manage-list {
  width: 38%;
  min-width: 260px;
  max-width: 520px;
  overflow-y: auto;
  border-right: 1px solid #3a3a3a;
  background: #252526;
  padding: 8px;
}

.manage-item {
  background: #2d2d2d;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.manage-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manage-item-head .q-index {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3a3a3a;
  color: #cccccc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex: 0 0 auto;
}

.manage-item-head .q-title {
  flex: 1;
  color: #e8e8e8;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-item-head .q-lang {
  font-size: 11px;
  color: #9d9d9d;
  background: #333333;
  border-radius: 3px;
  padding: 1px 6px;
}

.manage-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.manage-item-actions button {
  padding: 3px 10px;
  background: #333333;
  color: #cccccc;
  border: 1px solid #444444;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.manage-item-actions button:hover:not(:disabled) {
  border-color: #007acc;
  color: #ffffff;
}

.manage-item-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}

.manage-item-actions button.danger:hover {
  border-color: #e57373;
  color: #e57373;
}

.manage-item-ext {
  margin-top: 5px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: #7d7d7d;
}

.manage-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.manage-right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: #cccccc;
  font-size: 13px;
  border-bottom: 1px solid #3a3a3a;
  background: #2d2d2d;
}

#api-doc-text {
  flex: 1;
  width: 100%;
  min-height: 0;
  resize: none;
  border: none;
  outline: none;
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px 16px;
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}

/* Question / import modals */
.modal-content.question-modal-content {
  max-width: 780px;
  width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  text-align: left;
  padding: 24px 28px;
}

.question-modal-content h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.question-modal-content label {
  display: block;
  margin: 10px 0 4px;
  color: #9d9d9d;
  font-size: 12px;
}

.question-modal-content input[type="text"],
.question-modal-content select,
.question-modal-content textarea {
  width: 100%;
  box-sizing: border-box;
  background: #1e1e1e;
  color: #e8e8e8;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.question-modal-content textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12.5px;
  resize: vertical;
}

.question-modal-content input:focus,
.question-modal-content select:focus,
.question-modal-content textarea:focus {
  outline: none;
  border-color: #007acc;
}

.question-modal-content p {
  color: #9d9d9d;
  font-size: 12.5px;
  margin: 0 0 10px;
}

.question-modal-content input[type="file"] {
  color: #cccccc;
  font-size: 12px;
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.question-modal-content .error-message {
  color: #e57373;
  font-size: 12.5px;
  margin-top: 10px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  #question-sidebar {
    width: 240px;
  }

  .manage-list {
    width: 45%;
    min-width: 220px;
  }

  #top-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
}
/* The base stylesheet makes .primary-btn/.secondary-btn full-width (for the
   dashboard modals). Inside toolbars, sidebars and our modals they must be
   compact instead. */
#view-switch .secondary-btn,
.manage-toolbar .secondary-btn,
.manage-toolbar .primary-btn,
.manage-right-head .secondary-btn,
#mark-done-btn,
.modal-actions .secondary-btn,
.modal-actions .primary-btn {
  width: auto;
  flex: 0 0 auto;
  padding: 6px 14px;
  font-size: 12.5px;
  line-height: 1.4;
  border-radius: 5px;
  box-shadow: none;
  text-shadow: none;
}

#view-switch .secondary-btn,
.manage-toolbar .secondary-btn,
.manage-right-head .secondary-btn,
#mark-done-btn,
.modal-actions .secondary-btn {
  background: #333333;
  background-image: none;
  color: #dddddd;
  border: 1px solid #444444;
}

#view-switch .secondary-btn:hover,
.manage-toolbar .secondary-btn:hover,
.manage-right-head .secondary-btn:hover,
#mark-done-btn:hover,
.modal-actions .secondary-btn:hover {
  background: #3d3d3d;
  border-color: #007acc;
  color: #ffffff;
}

.manage-toolbar .primary-btn,
.modal-actions .primary-btn {
  background: #007acc;
  background-image: none;
  color: #ffffff;
  border: 1px solid #007acc;
}

.manage-toolbar .primary-btn:hover,
.modal-actions .primary-btn:hover {
  background: #0066b3;
  border-color: #0066b3;
}

.manage-title {
  white-space: nowrap;
  flex: 0 0 auto;
}

.manage-toolbar {
  flex-wrap: wrap;
}

#mark-done-btn.is-done {
  background: #2e7d32;
  border-color: #2e7d32;
  color: #ffffff;
}
