/* ==========================================================================
   DGCA Examination Portal Theme (Professional, Plain Government UI)
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 13px;
  background-color: #ffffff;
  color: #000000;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.no-select {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  cursor: default;
}

/* ── 0. Fullscreen Lock Overlay ── */
#fullscreen-lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.fs-modal-box {
  background: #ffffff;
  border: 3px solid #cc0000;
  border-radius: 4px;
  padding: 24px 30px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.fs-title {
  color: #cc0000;
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.fs-text {
  font-size: 12px;
  color: #333333;
  line-height: 1.5;
  margin-bottom: 18px;
}

.fs-btn {
  background: #0d3c61 !important;
  color: #ffffff !important;
  font-weight: bold;
  padding: 8px 20px !important;
  font-size: 12px !important;
}

/* ── 1. Top Status Bar ── */
#top-status-bar {
  background: #f7f7f7;
  color: #222222;
  font-size: 11px;
  height: 22px;
  min-height: 22px;
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #cccccc;
  flex-shrink: 0;
}

.status-content-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-tag {
  color: #000000;
  font-weight: bold;
}

.pipe {
  color: #aaaaaa;
}

.sec-text {
  color: #006600;
}

.status-content-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.admin-top-btn {
  padding: 1px 6px;
  font-size: 10px;
  background: #f0f0f0;
  border-color: #888888;
  color: #222222;
  font-weight: bold;
}

.fs-icon-btn {
  padding: 1px 6px;
  font-size: 10px;
  background: #eeeeee;
}

/* ── 2. Compact Header ── */
#header-section {
  background: #ffffff;
  border-bottom: 1px solid #cccccc;
  padding: 3px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 42px;
  min-height: 42px;
  flex-shrink: 0;
}

.header-spacer {
  flex: 1;
}

.candidate-profile-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 2px 6px;
  border: 1px solid #cccccc;
  border-radius: 2px;
}

.cand-details {
  text-align: right;
  line-height: 1.2;
}

.cand-name-label {
  font-weight: bold;
  font-size: 11px;
  color: #000000;
}

.cand-id-label {
  font-size: 10px;
  color: #555555;
}

.cand-avatar-frame {
  width: 28px;
  height: 32px;
  border: 1px solid #999999;
  background: #f0f0f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cand-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── 3. Menu Tabs ── */
#menu-view-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex: 1;
  padding: 8px 12px;
  overflow: hidden;
  background-color: #ffffff;
}

.menu-box-frame {
  background: #ffffff;
  border: 1px solid #999999;
  border-radius: 4px;
  width: 100%;
  max-width: 1020px;
  height: 100%;
  max-height: calc(100vh - 78px);
  display: flex;
  flex-direction: column;
}

.menu-header-bar {
  background: #f0f0f0;
  border-bottom: 1px solid #999999;
  padding: 3px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.menu-tabs-group {
  display: flex;
  gap: 4px;
}

.menu-tab-btn {
  background: #e8e8e8;
  border: 1px solid #999999;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: bold;
  color: #333333;
  cursor: pointer;
}

.menu-tab-btn:hover {
  background: #dedede;
}

.menu-tab-btn.active-tab {
  background: #ffffff;
  border-bottom: 2px solid #ffffff;
  margin-bottom: -1px;
  color: #000000;
}

.menu-scroll-body {
  padding: 8px 12px;
  overflow-y: auto;
  flex: 1;
}

.section-divider-title {
  background: #f5f5f5;
  border-left: 3px solid #666666;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: bold;
  color: #222222;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

/* Collective Cards */
.collective-cards-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .collective-cards-row {
    grid-template-columns: 1fr;
  }
}

.collective-card {
  border: 1px solid #999999;
  background: #fafafa;
  border-radius: 3px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.collective-card.highlight-card {
  background: #f4f8fc;
  border: 1.5px solid #628bb5;
}

.col-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.col-tag {
  font-size: 9px;
  background: #0d3c61;
  color: #ffffff;
  padding: 1px 4px;
  font-weight: bold;
  border-radius: 2px;
}

.col-title {
  font-weight: bold;
  font-size: 12px;
  color: #0d3c61;
}

.col-desc {
  font-size: 11px;
  color: #444444;
  line-height: 1.35;
}

.col-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #666666;
  margin-top: 2px;
}

.primary-start-btn {
  margin-top: 4px;
  font-weight: bold;
  background: #e4eaf0;
  border: 1px solid #6688aa;
  padding: 4px 10px;
}

.primary-start-btn:hover {
  background: #d0deea;
}

/* Full Subjects Grid */
#subjects-list-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

@media (max-width: 760px) {
  #subjects-list-grid {
    grid-template-columns: 1fr;
  }
}

.subject-item-card {
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  padding: 6px 8px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.subject-item-card:hover {
  background: #f9f9f9;
  border-color: #aaaaaa;
}

.sub-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sub-title-text {
  font-weight: bold;
  font-size: 11px;
  color: #000000;
}

.sub-meta-text {
  font-size: 10px;
  color: #555555;
}

.start-test-btn {
  background: #e8e8e8;
  border: 1px solid #888888;
  border-radius: 2px;
  color: #000000;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 10px;
  cursor: pointer;
}

.start-test-btn:hover {
  background: #d8d8d8;
}

.special-test-btn {
  font-weight: bold;
  padding: 4px 14px;
  background: #e0e0e0;
}

/* Chapter Filters */
.chapter-filters-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  background: #f7f7f7;
  border: 1px solid #cccccc;
  border-radius: 3px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

@media (max-width: 760px) {
  .chapter-filters-row {
    grid-template-columns: 1fr;
  }
}

.filter-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-lbl {
  font-size: 10px;
  font-weight: bold;
  color: #333333;
}

.classic-select, .classic-input {
  background: #ffffff;
  border: 1px solid #999999;
  border-radius: 2px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: Arial, sans-serif;
  color: #000000;
}

.classic-textarea {
  background: #ffffff;
  border: 1px solid #999999;
  border-radius: 2px;
  padding: 4px 6px;
  font-size: 11px;
  font-family: Arial, sans-serif;
  color: #000000;
  width: 100%;
  resize: vertical;
}

#chapters-cards-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

@media (max-width: 760px) {
  #chapters-cards-container {
    grid-template-columns: 1fr;
  }
}

.chapter-item-card {
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  padding: 6px 10px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chapter-item-card:hover {
  background: #f4f8fc;
  border-color: #8bb0d4;
}

.ch-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 75%;
}

.ch-title-text {
  font-weight: bold;
  font-size: 11px;
  color: #000000;
}

.ch-book-tag {
  font-size: 9px;
  color: #0b3d68;
  font-weight: bold;
}

.ch-count-text {
  font-size: 10px;
  color: #666666;
}

/* ── 4. Admin Panel ── */
.admin-search-box {
  background: #f7f7f7;
  border: 1px solid #cccccc;
  border-radius: 3px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.admin-editor-panel {
  background: #fdfdfd;
  border: 2px solid #2b5e82;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
}

.admin-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #0d3c61;
  padding-bottom: 6px;
  border-bottom: 1px solid #cbd7e2;
  margin-bottom: 8px;
}

.admin-form-group {
  margin-bottom: 8px;
}

.correct-key-selector {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  background: #f0f4f8;
  padding: 6px 10px;
  border: 1px solid #cbd7e2;
  border-radius: 2px;
}

.admin-radio-lbl {
  font-weight: bold;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.save-override-btn {
  background: #0d3c61 !important;
  color: #ffffff !important;
  font-weight: bold;
}

.save-override-btn:hover {
  background: #1a568a !important;
}

.admin-opt-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

.admin-opt-letter {
  font-weight: bold;
  min-width: 22px;
}

/* ── 5. Question Meta Bar with Question ID ── */
.qid-pill {
  background: #f0f3f6;
  border: 1px solid #b8cad8;
  border-radius: 2px;
  padding: 1px 6px;
  font-size: 10px;
  color: #333333;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.qid-pill:hover {
  background: #dfe8f2;
  border-color: #7b9ebc;
}

.copy-qid-btn {
  background: #e2e8ee;
  border: 1px solid #99aab8;
  border-radius: 2px;
  color: #0d3c61;
  font-size: 9px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

.toast-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #113b63;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100000;
  display: none;
}

/* ── 6. Main Exam Window ── */
#exam-view-container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex: 1;
  padding: 6px 12px 8px 12px;
  width: 100%;
  overflow: hidden;
  background-color: #ffffff;
}

#exam-window-frame {
  background: #ffffff;
  border: 1px solid #999999;
  border-radius: 4px;
  width: 100%;
  max-width: 1050px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#palette-wrapper {
  background: #ffffff;
  padding: 3px;
  border-bottom: 1px solid #999999;
  flex-shrink: 0;
}

#question-grid {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  gap: 2px;
  width: 100%;
}

.q-cell {
  height: 16px;
  background-color: #784949;
  color: #ffffff;
  font-size: 9px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 2px;
  user-select: none;
  min-width: 0;
}

.q-cell:hover {
  filter: brightness(1.2);
}

.q-cell.answered {
  background-color: #4a8c45 !important;
  color: #ffffff;
}

.q-cell.current {
  background-color: #ffd03b !important;
  color: #000000 !important;
  border: 1.5px solid #000000;
  font-weight: bold;
}

#q-meta-line {
  background: #ffffff;
  border-bottom: 1px solid #999999;
  padding: 4px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: bold;
}

.q-label {
  color: #000000;
}

.q-num-highlight {
  color: #0033cc;
  font-size: 14px;
}

.marks-label {
  color: #000000;
}

.meta-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.your-ans-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.ans-heading {
  font-weight: bold;
  color: #000000;
}

.radio-dot-label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-weight: bold;
  user-select: none;
}

.radio-dot-label input[type="radio"] {
  cursor: pointer;
  margin: 0;
}

#btn-confirm {
  background: #e1e1e1;
  border: 1px solid #777777;
  border-radius: 2px;
  color: #000000;
  font-weight: bold;
  font-size: 11px;
  padding: 2px 10px;
  cursor: pointer;
}

#btn-confirm:hover {
  background: #d4d4d4;
}

#btn-confirm:active {
  background: #bcbcbc;
}

#q-content-box {
  padding: 16px 22px;
  flex: 1;
  overflow-y: auto;
  background: #ffffff;
  user-select: none !important;
}

#q-text {
  font-size: var(--q-font-size, 13.5px);
  line-height: 1.55;
  font-weight: bold;
  color: #000000;
  margin-bottom: 16px;
  white-space: pre-line;
  user-select: none !important;
}

#q-options-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none !important;
}

.opt-row-static {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--q-font-size, 13px);
  line-height: 1.45;
  padding: 2px 4px;
  color: #000000;
  cursor: default !important;
  pointer-events: none;
  user-select: none !important;
}

.opt-prefix {
  font-weight: bold;
  min-width: 22px;
}

.opt-text-val {
  flex: 1;
}

.explanation-panel {
  margin-top: 14px;
  padding: 10px 12px;
  background-color: #f7f9fa;
  border: 1px solid #b8c9d9;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.5;
  color: #1a3b5c;
}

.explanation-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: #0b2a4a;
}

#bottom-toolbar {
  background: #ffffff;
  border-top: 1px solid #999999;
  padding: 5px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.nav-btn-group {
  display: flex;
  gap: 6px;
}

.classic-btn {
  background: #e8e8e8;
  border: 1px solid #888888;
  border-radius: 2px;
  color: #000000;
  font-size: 11px;
  font-family: Arial, sans-serif;
  padding: 3px 12px;
  cursor: pointer;
  user-select: none;
}

.classic-btn:hover {
  background: #d8d8d8;
}

.classic-btn:active {
  background: #c0c0c0;
}

.classic-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.font-size-group {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #000000;
}

.font-label {
  margin-right: 3px;
}

.size-btn {
  padding: 2px 7px;
  font-size: 11px;
}

.submit-exam-btn {
  background: #dcdcdc;
  border: 1px solid #666666;
  color: #000000;
  font-weight: bold;
  padding: 3px 14px;
}

.submit-exam-btn:hover {
  background: #cecece;
}

/* History Table */
.history-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 6px;
}

.history-tbl th, .history-tbl td {
  padding: 5px 8px;
  border: 1px solid #dddddd;
  text-align: left;
}

.history-tbl th {
  background: #f0f0f0;
  font-weight: bold;
}

.history-tbl tr:nth-child(even) {
  background: #fafafa;
}

/* Result Modal */
.hidden {
  display: none !important;
}

#result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#result-modal {
  background: #ffffff;
  border: 2px solid #555555;
  border-radius: 4px;
  width: 440px;
  max-width: 95%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.modal-title-bar {
  background: #f0f0f0;
  color: #000000;
  font-weight: bold;
  font-size: 12px;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #999999;
}

.modal-x-btn {
  background: none;
  border: none;
  color: #000000;
  font-size: 16px;
  cursor: pointer;
}

.modal-content-area {
  padding: 14px 18px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.result-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #e0e0e0;
}

.result-table td:last-child {
  text-align: right;
}

.highlight-row td {
  background: #f9f9f9;
  font-weight: bold;
  font-size: 13px;
}

.verdict-row td {
  background: #f0f0f0;
  color: #000000;
  font-weight: bold;
  font-size: 14px;
}

.modal-footer-bar {
  padding: 6px 14px;
  background: #f0f0f0;
  border-top: 1px solid #cccccc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.review-correct {
  background-color: #d4edda !important;
  color: #155724 !important;
  font-weight: bold;
}

.review-wrong {
  background-color: #f8d7da !important;
  color: #721c24 !important;
  font-weight: bold;
}
