/**
 * F-095 Diagnostic Feedback Engine — Styles
 * Feature flag: ff-f095-diagnostic-feedback
 *
 * Three states:
 *   .df-panel--blank           State 1: compassionate, show explanation
 *   .df-panel--attempted-scoring  State 2: checklist with ✓/○
 *   .df-panel--attempted-zero  State 3: encouraging, all points as targets
 */

/* ── Panel container ────────────────────────────────────────── */

.df-panel {
  margin-top: 0.75rem;
  animation: dfFadeIn 0.25s ease-out;
}

@keyframes dfFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── State labels ───────────────────────────────────────────── */

.df-state-label {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.df-state-label--blank {
  color: var(--text-secondary);
}

.df-state-label--zero {
  color: var(--text-secondary);
}

/* ── Sections ───────────────────────────────────────────────── */

.df-section {
  margin-bottom: 0.75rem;
}

.df-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.df-section--explain .df-section-label {
  color: var(--accent);
}

.df-section--model .df-section-label {
  color: #22c55e;
}

.df-section--checklist .df-section-label {
  color: var(--text-secondary);
}

.df-section-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.df-section--explain .df-section-body {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.2);
}

.df-section--model .df-section-body {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
}

/* ── Checklist ──────────────────────────────────────────────── */

.df-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.df-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 6px;
  margin-bottom: 2px;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: background 0.15s ease;
}

.df-checklist-item--hit {
  background: rgba(34, 197, 94, 0.06);
}

.df-checklist-item--miss {
  background: rgba(245, 158, 11, 0.06);
}

.df-checklist-item--target {
  background: rgba(37, 99, 235, 0.04);
}

/* ── Check icons ────────────────────────────────────────────── */

.df-check {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.df-check--hit {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.df-check--miss {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.df-check--target {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
}

/* ── Checklist text + arrow hints ───────────────────────────── */

.df-checklist-text {
  flex: 1;
  color: var(--text-primary);
}

.df-arrow-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  padding-left: 0;
}

.df-checklist-item--hit .df-checklist-text {
  color: var(--text-primary);
}

.df-checklist-item--miss .df-checklist-text,
.df-checklist-item--target .df-checklist-text {
  color: var(--text-primary);
}

/* ── Misconception panel ────────────────────────────────────── */

.df-misconception-panel {
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 8px;
}

.df-misconception-panel .df-section-label {
  color: var(--color-misconception, #dc2626);
}

.df-misconception-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin-top: 0.35rem;
}

.df-misconception-icon {
  color: var(--color-misconception, #dc2626);
  flex-shrink: 0;
  font-size: 0.9rem;
}

.df-misconception-text {
  flex: 1;
}

/* ── Light mode overrides ───────────────────────────────────── */

[data-theme="light"] .df-section-body {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .df-section--explain .df-section-body {
  background: rgba(37, 99, 235, 0.04);
}

[data-theme="light"] .df-section--model .df-section-body {
  background: rgba(34, 197, 94, 0.04);
}

[data-theme="light"] .df-checklist-item--hit {
  background: rgba(34, 197, 94, 0.05);
}

[data-theme="light"] .df-checklist-item--miss {
  background: rgba(245, 158, 11, 0.05);
}

[data-theme="light"] .df-checklist-item--target {
  background: rgba(37, 99, 235, 0.03);
}

[data-theme="light"] .df-misconception-panel {
  background: rgba(220, 38, 38, 0.04);
}

/* ── MCQ panel (Phase 0c) ───────────────────────────────────── */

.df-panel--mcq {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.df-mcq-chosen {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.df-mcq-chosen-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f59e0b;
}

.df-mcq-chosen-text {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.df-mcq-why-wrong {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-top: 0.2rem;
}

.df-mcq-correct {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.df-mcq-correct-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #22c55e;
  white-space: nowrap;
}

.df-mcq-correct-text {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

[data-theme="light"] .df-mcq-chosen {
  background: rgba(245, 158, 11, 0.05);
}

[data-theme="light"] .df-mcq-correct {
  background: rgba(34, 197, 94, 0.05);
}

/* ── Reduced motion ─────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .df-panel {
    animation: none;
  }
}

/* ── History Panel (Phase 0e) ───────────────────────────────── */

.df-panel--history {
  margin: 0.75rem 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.05);
  overflow: hidden;
}

.df-section--hist-evidence .df-section-label,
.df-section--hist-coaching .df-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b5cf6;
  padding: 0.5rem 0.75rem 0.25rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.12);
}

.df-section--hist-evidence + .df-section--hist-coaching {
  border-top: 1px solid rgba(139, 92, 246, 0.12);
}

.df-section--hist-coaching .df-hist-tips {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.5rem;
}

.df-hist-tip {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
  padding: 0.2rem 0.75rem;
}

.df-hist-tip .df-arrow-hint {
  flex-shrink: 0;
  color: #8b5cf6;
  font-size: 0.8rem;
}

[data-theme="light"] .df-panel--history {
  background: rgba(139, 92, 246, 0.03);
  border-color: rgba(139, 92, 246, 0.2);
}

/* ── Phase 0g: Pre-quiz weakness modal ──────────────────────── */

.df-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.df-modal-overlay--in  { opacity: 1; }
.df-modal-overlay--out { opacity: 0; pointer-events: none; }

.df-modal-card {
  background: var(--surface, #1e2530);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 14px;
  padding: 1.25rem 1.375rem 1.125rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  transform: translateY(10px);
  transition: transform 0.18s ease;
}

.df-modal-overlay--in .df-modal-card {
  transform: translateY(0);
}

.df-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.df-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.df-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}

.df-modal-close:hover {
  background: rgba(255,255,255,0.08);
}

.df-modal-subtitle {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin: 0 0 0.625rem;
}

.df-modal-list {
  list-style: none;
  margin: 0 0 0.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.df-modal-item {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.45;
  padding: 0.3rem 0.625rem;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.07);
  border-left: 2px solid rgba(245, 158, 11, 0.5);
}

.df-modal-stat {
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-left: 0.25rem;
}

.df-modal-more {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0.35rem 0 0;
  padding-left: 0.25rem;
}

.df-modal-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 1rem;
}

.df-modal-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: opacity 0.12s, background 0.12s;
}

.df-modal-btn--review {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.df-modal-btn--review:hover {
  background: rgba(245, 158, 11, 0.2);
}

.df-modal-btn--start {
  background: var(--accent, #2563eb);
  color: #fff;
}

.df-modal-btn--start:hover {
  opacity: 0.9;
}

[data-theme="light"] .df-modal-card {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}

[data-theme="light"] .df-modal-close:hover {
  background: rgba(0,0,0,0.06);
}

[data-theme="light"] .df-modal-item {
  background: rgba(245, 158, 11, 0.05);
}

[data-theme="light"] .df-modal-btn--review {
  color: #92400e;
}

@media (prefers-reduced-motion: reduce) {
  .df-modal-overlay,
  .df-modal-card { transition: none; }
}

/* ── Phase 0h: Flashcard ease-factor insight badge ──────────── */

.fc-hard-badge {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
  animation: dfFadeIn 0.25s ease-out;
  z-index: 1;
}

.fc-hard-badge-icon {
  font-size: 0.8rem;
  color: rgba(245, 158, 11, 0.8);
}

[data-theme="light"] .fc-hard-badge {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(180, 115, 10, 0.25);
  color: #78350f;
}

[data-theme="light"] .fc-hard-badge-icon {
  color: #b45309;
}

@media (prefers-reduced-motion: reduce) {
  .fc-hard-badge { animation: none; }
}

/* ── AC-12: Model answer toggle ─────────────────────────────── */

.df-model-toggle {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.df-model-toggle > summary {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.df-model-toggle > summary::-webkit-details-marker { display: none; }

.df-model-toggle > summary::after {
  content: '\25BC'; /* ▼ */
  font-size: 0.6rem;
  margin-left: auto;
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.df-model-toggle[open] > summary::after {
  transform: rotate(180deg);
}

.df-model-toggle > summary:hover {
  color: var(--text-primary);
}

.df-model-toggle-body {
  padding: 0.6rem 0.75rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
  border-top: 1px solid var(--border);
}

[data-theme="light"] .df-model-toggle {
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .df-model-toggle > summary {
  background: rgba(0, 0, 0, 0.02);
}

@media (prefers-reduced-motion: reduce) {
  .df-model-toggle > summary::after { transition: none; }
}
