// ── Shell ─────────────────────────────────────────────────────────
.ap-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
  box-sizing: border-box;
  font-family: var(--app-font-family);
}

.ap-loading {
  padding: 40px;
  text-align: center;
  color: var(--text-tertiary, #6b7280);
}

// ── Header ────────────────────────────────────────────────────────
.ap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.ap-header-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.ap-header-sub {
  font-size: 12px;
  color: var(--text-tertiary, #6b7280);
}

.ap-header-actions {
  display: flex;
  gap: 8px;
}

.ap-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-default, #d1d5db);
  background: var(--bg-surface, #fff);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.ap-btn-flag-on {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.ap-btn-submit {
  background: var(--action-primary-default, #16a34a);
  border-color: var(--action-primary-default, #16a34a);
  color: #fff;
}

// ── Time bar ──────────────────────────────────────────────────────
.ap-timebar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #111827;
  color: #f9fafb;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.ap-time-label {
  color: #9ca3af;
}

.ap-time-value {
  font-size: 16px;
  font-weight: 700;
  color: #facc15;
}

.ap-qcounter,
.ap-marks {
  margin-left: auto;
  color: #d1d5db;
}

// ── Body layout ───────────────────────────────────────────────────
.ap-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.ap-side-panel {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-panel {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: 10px;
  padding: 14px;
}

.ap-panel-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-tertiary, #6b7280);
  text-transform: uppercase;
  margin-bottom: 10px;
}

// ── Navigator ─────────────────────────────────────────────────────
.ap-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.ap-nav-btn {
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-default, #d1d5db);
  background: var(--bg-page, #f9fafb);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ap-nav-answered { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.ap-nav-current { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.ap-nav-flagged { background: #ede9fe; border-color: #8b5cf6; color: #6d28d9; }

.ap-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-tertiary, #6b7280);
}

.ap-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.ap-dot-answered { background: #16a34a; }
.ap-dot-current { background: #f59e0b; }
.ap-dot-flagged { background: #8b5cf6; }
.ap-dot-notanswered { background: #d1d5db; }

.ap-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text-secondary, #374151);
}

// ── Question panel ────────────────────────────────────────────────
.ap-question-panel {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-question-card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: 10px;
  padding: 20px;
}

.ap-question-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin-bottom: 16px;
}

.ap-answer-block {
  display: flex;
  flex-direction: column;
  gap: 8px;

  ::ng-deep mat-form-field.Radio_Form_Field {
    display: block !important;
    height: auto !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  ::ng-deep .Radio_Form_Field .mat-mdc-text-field-wrapper,
  ::ng-deep .Radio_Form_Field .mdc-text-field,
  ::ng-deep .Radio_Form_Field .mat-mdc-form-field-flex,
  ::ng-deep .Radio_Form_Field .mat-mdc-form-field-infix {
    height: auto !important;
    overflow: visible !important;
  }

  ::ng-deep mat-radio-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    height: auto !important;
  }

  ::ng-deep mat-radio-button {
    display: block !important;
    width: 100%;
  }

  ::ng-deep mat-radio-button .mat-internal-form-field,
  ::ng-deep mat-radio-button .mdc-form-field,
  ::ng-deep mat-radio-button .mdc-label {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: initial !important;
    word-break: break-word;
    height: auto !important;
  }
}

.ap-multi-row {
  display: flex;
  align-items: center;
}

.ap-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-default, #d1d5db);
  border-radius: 6px;
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.ap-question-nav-buttons {
  display: flex;
  justify-content: space-between;
}

// ── Score ring ────────────────────────────────────────────────────
.ap-score-ring-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.ap-score-svg {
  width: 110px;
  height: 110px;
}

.ap-circle-bg {
  fill: none;
  stroke: var(--border-default, #e5e7eb);
  stroke-width: 3;
}

.ap-circle-fill {
  fill: none;
  stroke: var(--action-primary-default, #6366f1);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s ease;
}

.ap-svg-pct {
  fill: var(--text-primary, #111827);
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.ap-svg-lbl {
  fill: var(--text-tertiary, #9ca3af);
  font-size: 4px;
  text-anchor: middle;
  dominant-baseline: middle;
}

// ── Results screen ────────────────────────────────────────────────
.ap-results-card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: 12px;
  padding: 24px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.ap-results-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.ap-results-eyebrow {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary, #6b7280);
  margin-bottom: 4px;
}

.ap-results-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.ap-results-badge {
  background: #dcfce7;
  color: #15803d;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ap-results-badge-fail {
  background: #fee2e2;
  color: #b91c1c;
}

.ap-results-stats {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border-default, #e5e7eb);
  margin-bottom: 16px;
}

.ap-results-stat-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ap-results-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ap-results-stat-label {
  font-size: 11px;
  color: var(--text-tertiary, #6b7280);
}

.ap-results-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.ap-results-breakdown-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin-bottom: 10px;
}

.ap-results-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-default, #f3f4f6);
  font-size: 13px;
}

.ap-results-row-num {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-results-row-num-fail {
  background: #fee2e2;
  color: #b91c1c;
}

.ap-results-row-label {
  flex: 1 1 0;
  color: var(--text-primary, #111827);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ap-results-explanation {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary, #6b7280);
}

.ap-results-row-marks {
  color: var(--text-tertiary, #6b7280);
}

.ap-results-row-icon {
  width: 20px;
  text-align: center;
}

.ap-icon-correct { color: #16a34a; font-weight: 700; }
.ap-icon-incorrect { color: #dc2626; font-weight: 700; }
.ap-icon-pending { color: var(--text-tertiary, #9ca3af); }

.ap-results-row-pending {
  background: #f5f3ff;
  border-radius: 6px;
}

.ap-results-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
