/* ==========================================================================
   SoftSutra CBT exam: question pane, options, action buttons, ads, palette
   Split from index.html lines 36-97 + 254-266 + exam mobile rules. Keep selectors scoped to this file's domain.
   ========================================================================== */

  /* CBT MAIN LAYOUT */
  .cbt-container { display: flex; flex: 1; overflow: hidden; position: relative; }
  .question-pane { flex: 1; display: flex; flex-direction: column; background: #ffffff; height: 100%; overflow: hidden; border-right: 1px solid var(--border-color); }
  
  /* SECTION BAR */
  .section-nav { display: flex; background: #f1f5f9; border-bottom: 1px solid var(--border-color); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
  .section-nav::-webkit-scrollbar { display: none; }
  .sec-tab { padding: 8px 12px; font-size: 12px; font-weight: 600; border: none; background: transparent; cursor: pointer; white-space: nowrap; color: var(--text-muted); border-bottom: 2px solid transparent; }
  .sec-tab.active { color: var(--secondary); background: #ffffff; border-bottom: 2px solid var(--secondary); font-weight: 700; }

  /* QUESTION SCROLL BOX */
  .question-content-box { flex: 1; padding: 10px 14px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
  .q-header-meta { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; margin-bottom: 10px; flex-shrink: 0; }
  .q-number-tag { font-size: 14px; font-weight: 700; color: var(--secondary); }
  .marks-info { font-size: 11.5px; color: var(--text-muted); }
  .marks-info span.pos { color: var(--success); font-weight: bold; }
  .marks-info span.neg { color: var(--danger); font-weight: bold; }

  .question-body { font-size: 15px; line-height: 1.45; color: #0f172a; margin-bottom: 12px; font-weight: 600; }
  .options-wrapper { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
  .option-label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1.5px solid #cbd5e1; border-radius: 8px; cursor: pointer; background: #f8fafc; font-size: 13.5px; }
  .option-label:active { background: #eff6ff; }
  .option-label input[type="radio"] { accent-color: var(--secondary); width: 17px; height: 17px; }
  .option-label.selected { background: #eff6ff; border-color: var(--secondary); font-weight: 600; }

  .time-tracker-box { background: #e0f2fe; border-left: 4px solid #0284c7; padding: 8px 12px; margin-top: 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: #0369a1; }
  .review-box { background: #f0fdf4; border-left: 4px solid #16a34a; padding: 10px 12px; margin-top: 8px; border-radius: 6px; font-size: 13px; line-height: 1.5; color: #166534; }
  .trick-box { background: #fffbeb; border-left: 4px solid #f59e0b; padding: 10px 12px; margin-top: 8px; border-radius: 6px; font-size: 13px; line-height: 1.5; color: #92400e; }

  /* ACTION ZONE: buttons sit directly under the options, never in a sticky bottom bar. */
  .q-footer-actions {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0 4px;
    margin: 2px 0 0;
    background: transparent;
    border-top: 1px dashed #e2e8f0;
    flex-shrink: 0;
  }
  .q-footer-actions.review-mode { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .q-footer-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 9px 4px;
    font-size: 11.5px;
    line-height: 1.15;
    white-space: nowrap;
  }

  /* ADS BELOW THE ACTION BUTTONS */
  .exam-ad-stack { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
  .exam-ad-stack .ad-slot-banner { margin-bottom: 0; }
  .option-label { touch-action: manipulation; }

  /* EXAM EXIT CONFIRMATION */
  .exit-confirm-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.88); z-index: 320; display: none; align-items: center; justify-content: center; padding: 16px; }
  .exit-confirm-card { background: #fff; width: 100%; max-width: 400px; border-radius: 12px; padding: 20px; text-align: center; border-top: 5px solid var(--accent); box-shadow: 0 18px 45px rgba(0,0,0,0.4); }
  .exit-confirm-card h3 { font-size: 17px; color: var(--primary); margin-bottom: 6px; }
  .exit-confirm-card p { font-size: 13px; line-height: 1.45; color: var(--text-muted); margin-bottom: 14px; }
  .exit-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

  /* SIDEBAR PALETTE */
  .sidebar-pane { width: 300px; background: #f8fafc; display: flex; flex-direction: column; flex-shrink: 0; }
  .legend-box { padding: 8px 10px; background: #ffffff; border-bottom: 1px solid var(--border-color); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-size: 11px; }
  .legend-item { display: flex; align-items: center; gap: 4px; }
  .badge-icon { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; font-size: 9.5px; color: white; }
  .b-answered { background: var(--success); }
  .b-not-answered { background: var(--danger); }
  .b-not-visited { background: #e2e8f0; color: #475569; }
  .b-marked { background: #facc15; color: #0f172a; border: 1px solid #ca8a04; }

  .palette-scroll { flex: 1; padding: 10px; overflow-y: auto; }
  .question-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
  .pal-btn { width: 100%; aspect-ratio: 1; border-radius: 50%; font-size: 12px; font-weight: 700; border: 1.5px solid #cbd5e1; background: #ffffff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .pal-btn.current { box-shadow: 0 0 0 2.5px var(--secondary); font-weight: 900; }
  .pal-btn.answered { background: var(--success); color: white; border-color: var(--success); }
  .pal-btn.not-answered { background: var(--danger); color: white; border-color: var(--danger); }
  .pal-btn.marked { background: #facc15; color: #0f172a; border-color: #ca8a04; font-weight: 800; }
  .pal-btn.marked-answered { background: #facc15; color: #0f172a; border-color: #ca8a04; font-weight: 800; }

  .sidebar-bottom { padding: 10px; background: #ffffff; border-top: 1px solid var(--border-color); flex-shrink: 0; }
  #submitUnlockMsg { font-size: 11px; font-weight: 700; text-align: center; margin-bottom: 6px; padding: 6px; border-radius: 6px; background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }

  /* WARNING MODAL */
  .warning-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88); z-index: 300; display: none; align-items: center; justify-content: center; padding: 15px; }
  .warning-card { background: #ffffff; border-top: 5px solid var(--danger); width: 100%; max-width: 440px; border-radius: 10px; padding: 20px; text-align: center; box-shadow: 0 15px 35px rgba(0,0,0,0.4); }
  .warning-card h3 { color: var(--danger); font-size: 19px; margin-bottom: 8px; }
  .warning-card p { font-size: 13.5px; color: var(--text-main); line-height: 1.5; margin-bottom: 14px; }
  .warning-counter-badge { display: inline-block; background: #fee2e2; color: #991b1b; padding: 4px 12px; border-radius: 20px; font-weight: 800; font-size: 13px; margin-bottom: 12px; }

  /* SCORECARD MODAL */
  .modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.85); z-index: 250; display: none; align-items: center; justify-content: center; padding: 15px; }
  .modal-card { background: #ffffff; width: 100%; max-width: 480px; border-radius: 10px; overflow: hidden; }
  .modal-header { background: var(--primary); color: #fff; padding: 12px; font-size: 16px; font-weight: 700; text-align: center; }
  .modal-body { padding: 14px; }

/* Exam mobile overrides */
@media (max-width: 800px) {
    header { height: 46px; padding: 6px 10px; }
    .brand-logo { font-size: 12px; padding: 3px 6px; }
    .timer-card { font-size: 13.5px; padding: 3px 7px; }
    .btn-pal-toggle { display: inline-block; }
    
    .sidebar-pane {
      position: fixed; top: 46px; right: 0; bottom: 0; width: 280px; z-index: 50;
      box-shadow: -5px 0 25px rgba(0,0,0,0.3); border-left: 2px solid var(--border-color);
      transform: translateX(100%); transition: transform 0.25s ease-in-out;
    }
    .sidebar-pane.open { transform: translateX(0); }
    .sidebar-backdrop {
      display: none; position: fixed; inset: 0; top: 46px; background: rgba(0,0,0,0.5); z-index: 45;
    }
    .sidebar-backdrop.open { display: block; }

    .question-content-box { padding: 8px 10px calc(18px + env(safe-area-inset-bottom, 0px)); }
    .question-body { font-size: 14px; margin-bottom: 8px; line-height: 1.4; }
    .option-label { padding: 9px 10px; font-size: 13px; gap: 8px; }
    .ad-slot-banner { padding: 2px 4px; font-size: 10px; margin-bottom: 6px; min-height: 24px; }
    
    .q-footer-actions { gap: 4px; padding: 6px 0 3px; }
    .q-footer-actions .btn { flex-direction: column; gap: 1px; padding: 6px 2px; font-size: 9.5px; line-height: 1.1; }
    .exam-ad-stack { gap: 4px; margin-top: 3px; }
    .exit-confirm-actions { grid-template-columns: 1fr; }
}
