/**
 * Badhte Jao - Online Examination Platform (CBT Engine)
 * Realistic Indian Computer-Based Test (TCS/NTA Style)
 */

:root {
  --cbt-primary: #1976d2;
  --cbt-dark: #263238;
  --cbt-bg: #f4f6f9;
  --status-not-visited: #e2e8f0;
  --status-not-answered: #e53935;
  --status-answered: #2e7d32;
  --status-review: #7b1fa2;
  --status-ans-review: #7b1fa2;
}

body.cbt-mode {
  background-color: var(--cbt-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* CBT Fixed Top Header */
.cbt-header {
  background: #ffffff;
  border-bottom: 2px solid #0288d1;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.cbt-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.cbt-timer-badge {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cbt-timer-badge.warning {
  background: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
  animation: pulse-timer 1s infinite alternate;
}

@keyframes pulse-timer {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

/* Section Tabs */
.cbt-sections-bar {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  align-items: center;
}

.cbt-section-tab {
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.cbt-section-tab:hover {
  background: #e2e8f0;
}

.cbt-section-tab.active {
  background: #0288d1;
  color: #ffffff;
  border-color: #0288d1;
}

/* Main Workbench Layout */
.cbt-workbench {
  display: flex;
  height: calc(100vh - 110px);
  overflow: hidden;
}

.cbt-question-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
  overflow-y: auto;
}

.cbt-question-header {
  padding: 10px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.cbt-question-body {
  padding: 24px;
  flex-grow: 1;
  overflow-y: auto;
}

.cbt-question-text {
  font-size: 1.15rem;
  line-height: 1.6;
  color: #1e293b;
  font-weight: 600;
  margin-bottom: 12px;
}

.cbt-question-text-hi {
  font-size: 1.15rem;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 20px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 12px;
}

/* Options Container */
.cbt-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.cbt-option-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease-in-out;
}

.cbt-option-item:hover {
  border-color: #0288d1;
  background: #f0f9ff;
}

.cbt-option-item.selected {
  border-color: #0288d1;
  background: #e0f2fe;
  font-weight: 600;
  box-shadow: 0 0 0 1px #0288d1;
}

.cbt-option-radio {
  margin-right: 12px;
  margin-top: 3px;
  transform: scale(1.2);
}

.cbt-option-label {
  flex: 1;
  font-size: 1rem;
  color: #1e293b;
}

/* Action Footer */
.cbt-action-footer {
  padding: 12px 20px;
  border-top: 1px solid #cbd5e1;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Palette Sidebar */
.cbt-palette-pane {
  width: 320px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid #cbd5e1;
}

.cbt-candidate-card {
  padding: 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cbt-legend-box {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.78rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.legend-dot {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 10px;
  color: #fff;
}

.dot-not-visited { background: #cbd5e1; color: #334155; }
.dot-not-answered { background: var(--status-not-answered); }
.dot-answered { background: var(--status-answered); }
.dot-review { background: var(--status-review); }
.dot-ans-review { 
  background: var(--status-review);
  position: relative;
}
.dot-ans-review::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 6px;
  height: 6px;
  background: #00e676;
  border-radius: 50%;
}

.cbt-palette-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  overflow-y: auto;
  flex-grow: 1;
}

.palette-btn {
  height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease;
  position: relative;
}

.palette-btn:hover {
  transform: scale(1.05);
}

.palette-btn.active-q {
  outline: 2.5px solid #0288d1;
  outline-offset: 1px;
}

.palette-btn.not-visited { background: #cbd5e1; color: #334155; }
.palette-btn.not-answered { background: var(--status-not-answered); color: #fff; }
.palette-btn.answered { background: var(--status-answered); color: #fff; }
.palette-btn.marked-for-review { background: var(--status-review); color: #fff; }
.palette-btn.answered-marked-for-review {
  background: var(--status-review);
  color: #fff;
}
.palette-btn.answered-marked-for-review::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background: #00e676;
  border-radius: 50%;
  border: 1px solid #fff;
}

/* Mobile Responsive */
@media (max-width: 991px) {
  .cbt-workbench {
    flex-direction: column;
    height: auto;
  }
  .cbt-palette-pane {
    width: 100%;
    max-height: 250px;
  }
}

