/* === Mini interactive demo inside the browser frame === */
.demo-app {
  display: flex;
  height: 420px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 11px;
  color: #2d2a26;
  background: #faf7f2;
  overflow: hidden;
  user-select: none;
}

/* Sidebar */
.demo-sidebar {
  width: 150px;
  background: #fff;
  border-right: 1px solid #e2ddd5;
  padding: 8px 0;
  flex-shrink: 0;
  overflow-y: auto;
}
.demo-search input {
  width: calc(100% - 16px);
  margin: 4px 8px 8px;
  padding: 5px 8px;
  border: 1px solid #e2ddd5;
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
  background: #faf7f2;
  outline: none;
}
.demo-nav-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding: 4px 10px 2px;
  font-weight: 600;
}
.demo-nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 5px 10px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 11px;
  color: #2d2a26;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.demo-nav-item:hover { background: #faf7f2; }
.demo-nav-item.active {
  background: #e6f2f2;
  color: #1e5f5f;
  font-weight: 600;
  border-left: 2px solid #2a7d7d;
}
.demo-nav-item span {
  font-size: 9px;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 8px;
  color: #64748b;
  font-weight: 600;
}
.demo-nav-item.active span { background: #2a7d7d; color: #fff; }

/* Main */
.demo-main {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  min-width: 0;
}

/* Spreadsheet */
.demo-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e2ddd5;
}
.demo-table th {
  background: #f5f1eb;
  padding: 6px 8px;
  text-align: left;
  font-size: 9px;
  font-weight: 700;
  color: #334155;
  border-bottom: 1px solid #e2ddd5;
}
.demo-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 10.5px;
  cursor: pointer;
  transition: background 0.1s;
}
.demo-table tr:hover td { background: #f0f9f9; }
.demo-table tr.active td { background: #e6f2f2; }
.demo-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
}
.demo-badge-diagnosed { background: #dbeafe; color: #1e40af; }
.demo-badge-imputed { background: #fef3c7; color: #92400e; }
.demo-badge-qdtp { background: #dcfce7; color: #166534; }
.demo-badge-supp { background: #fef3c7; color: #92400e; }
.demo-badge-sub { background: #fee2e2; color: #991b1b; }
.demo-readiness {
  display: flex;
  align-items: center;
  gap: 4px;
}
.demo-readiness-bar {
  width: 36px;
  height: 5px;
  background: #e2ddd5;
  border-radius: 3px;
  overflow: hidden;
}
.demo-readiness-fill { height: 100%; border-radius: 3px; }

/* Detail panel */
.demo-detail {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #e2ddd5;
  border-radius: 6px;
  overflow: hidden;
  animation: demo-slide-up 0.3s ease;
}
@keyframes demo-slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.demo-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2ddd5;
  background: #faf7f2;
}
.demo-back {
  background: #2a7d7d;
  color: #fff;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.demo-student-name { font-weight: 700; font-size: 12px; color: #1e293b; }
.demo-badges { display: flex; gap: 4px; margin-left: auto; }

/* Tabs */
.demo-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2ddd5;
  background: #fff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.demo-tab {
  padding: 6px 10px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 10px;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.demo-tab:hover { color: #2a7d7d; }
.demo-tab.active { color: #2a7d7d; border-bottom-color: #2a7d7d; font-weight: 700; }

/* Tab content */
.demo-tab-content {
  padding: 10px 12px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #475569;
  min-height: 140px;
  animation: demo-fade 0.2s ease;
}
@keyframes demo-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.demo-fact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.demo-fact {
  background: #faf7f2;
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid #2a7d7d;
}
.demo-fact-label { font-size: 8px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.demo-fact-value { font-weight: 700; color: #1e293b; font-size: 11px; }
.demo-note {
  padding: 6px 8px;
  margin-bottom: 6px;
  background: #faf7f2;
  border-radius: 4px;
  border-left: 2px solid #e2ddd5;
}
.demo-note-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #94a3b8;
  margin-bottom: 2px;
}
.demo-note-header strong { color: #1e293b; }
.demo-tracker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}
.demo-tracker-label { flex: 1; font-size: 10px; }
.demo-tracker-cell {
  width: 28px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-weight: 700;
  font-size: 10px;
  color: #1e293b;
}
.demo-readiness-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: linear-gradient(135deg, rgba(22,163,74,0.06), rgba(22,163,74,0.02));
  border-left: 3px solid #16a34a;
  border-radius: 6px;
  margin-bottom: 10px;
}

/* Diagnosis Support Triangle tab — diagnosis/impact header + MTSS triangle */
.demo-mtss-diagnosis {
  background: #faf7f2;
  border: 1px solid #e2ddd5;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 10px;
  color: #475569;
}
.demo-mtss-dx-row { margin-bottom: 5px; }
.demo-mtss-dx-impact div { padding: 1px 0; }

/* MTSS triangle (Diagnosis Support Triangle tab) — triangle on the left,
   tier breakdown on the right so it fills the wide panel. */
.demo-mtss-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}
.demo-mtss-aside { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.demo-mtss-triangle {
  position: relative;
  width: 230px;
  height: 190px;
  flex-shrink: 0;
}
/* Three non-overlapping horizontal bands so all tiers stay visible. */
.demo-mtss-tri { position: absolute; inset: 0; color: white; }
.demo-mtss-tri-3 { clip-path: polygon(50% 0%, 65.5% 31%, 34.5% 31%); background: #c92a2a; }
.demo-mtss-tri-2 { clip-path: polygon(33% 34%, 67% 34%, 81.5% 63%, 18.5% 63%); background: #e8800c; }
.demo-mtss-tri-1 { clip-path: polygon(17% 66%, 83% 66%, 100% 100%, 0% 100%); background: #2f9e44; }
.demo-mtss-tri-content {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  color: white;
  line-height: 1.05;
}
.demo-mtss-tri-3 .demo-mtss-tri-content { top: 16%; }
.demo-mtss-tri-2 .demo-mtss-tri-content { top: 42%; }
.demo-mtss-tri-1 .demo-mtss-tri-content { top: 75%; }
.demo-mtss-tri-label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; }
.demo-mtss-tri-3 .demo-mtss-tri-label { font-size: 7.5px; }
.demo-mtss-tri-2 .demo-mtss-tri-label { font-size: 9.5px; }
.demo-mtss-tri-1 .demo-mtss-tri-label { font-size: 11px; }
.demo-mtss-tri-count { font-weight: 800; line-height: 1; margin-top: 1px; }
.demo-mtss-tri-3 .demo-mtss-tri-count { font-size: 12px; }
.demo-mtss-tri-2 .demo-mtss-tri-count { font-size: 16px; }
.demo-mtss-tri-1 .demo-mtss-tri-count { font-size: 20px; }
.demo-mtss-tri-count small { font-weight: 500; opacity: 0.9; font-size: 0.5em; margin-left: 2px; }

.demo-mtss-cond {
  text-align: center;
  font-size: 10px;
  color: #475569;
}
.demo-mtss-cond strong { color: #1e293b; }
.demo-mtss-tiers { display: flex; flex-direction: column; gap: 4px; }
.demo-mtss-tier-block { border: 1px solid #e2e8f0; border-radius: 4px; overflow: hidden; }
.demo-mtss-tier-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  color: white;
  font-weight: 700;
  font-size: 9.5px;
}
.demo-mtss-tier-meta { font-weight: 600; opacity: 0.92; font-size: 8.5px; white-space: nowrap; }
.demo-mtss-tier-3 .demo-mtss-tier-head { background: #c92a2a; }
.demo-mtss-tier-2 .demo-mtss-tier-head { background: #e8800c; }
.demo-mtss-tier-1 .demo-mtss-tier-head { background: #2f9e44; }
.demo-mtss-tier-block ul {
  list-style: none;
  padding: 4px 8px;
  margin: 0;
  background: #fafbfc;
}
.demo-mtss-tier-block li {
  font-size: 9.5px;
  color: #1e293b;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.demo-mtss-empty { color: #94a3b8; font-style: italic; }
.demo-mtss-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.demo-readiness-score { font-size: 20px; font-weight: 800; color: #16a34a; }
.demo-readiness-text { font-size: 10px; color: #475569; }

/* Goals tab — goal planner cards like the real app */
.demo-goal-annual {
  background: linear-gradient(135deg, rgba(42,125,125,0.08), rgba(42,125,125,0.02));
  border-left: 3px solid #2a7d7d;
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 10px;
  font-size: 9.5px;
  color: #475569;
  line-height: 1.5;
}
.demo-goals-term { font-weight: 700; font-size: 11px; color: #1e293b; margin-bottom: 8px; }
.demo-goal-card {
  border: 1px solid #e2e8f0;
  border-left: 3px solid #1A7B8E;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #fff;
}
.demo-goal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.demo-goal-title { font-weight: 700; font-size: 10.5px; color: #1e293b; }
.demo-goal-domain { font-size: 8.5px; font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.demo-goal-level {
  margin-left: auto;
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.demo-goal-stars { letter-spacing: 0.5px; }
.demo-goal-field { font-size: 9.5px; color: #475569; line-height: 1.5; margin-bottom: 5px; }
.demo-goal-field:last-child { margin-bottom: 0; }
.demo-goal-label {
  display: block;
  font-weight: 700;
  color: #1e293b;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 1px;
}
.demo-goal-dc-row { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.demo-goal-dc { font-size: 8.5px; background: #f1f5f9; color: #475569; padding: 1px 8px; border-radius: 10px; }

/* Fake cursor */
.demo-cursor {
  position: absolute;
  top: 50%;
  left: 30%;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.demo-cursor.clicking { transform: scale(0.85); }

/* Generate report button */
.demo-report-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: #2a7d7d;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.demo-report-btn:hover { background: #1e5f5f; }
.demo-report-btn:disabled { opacity: 0.6; cursor: wait; }

/* MTSS triangle inside the generated PDF report */
.demo-report-mtss { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.demo-report-mtss-legend { align-self: stretch; font-size: 8.5px; color: #475569; line-height: 1.7; }
.demo-report-mtss-legend .demo-mtss-dot { display: inline-block; margin-right: 5px; vertical-align: middle; }
.demo-report-mtss-legend strong { color: #1e293b; }

/* Fake PDF report — slides out from below the browser frame like a printed page */
.demo-report {
  position: relative;
  z-index: 10;
  margin: 24px auto 0;
  max-width: 420px;
  transform-origin: top center;
  animation: demo-report-emerge 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes demo-report-emerge {
  0%   { opacity: 0; transform: translateY(-40px) scale(0.9) rotateX(8deg); }
  40%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0deg); }
}
.demo-report-page {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 20px 22px;
  box-shadow:
    0 8px 30px rgba(30,41,59,0.12),
    0 2px 6px rgba(30,41,59,0.06),
    4px 4px 0 rgba(226,221,213,0.4),
    8px 8px 0 rgba(226,221,213,0.2);
  position: relative;
}
/* Little PDF icon tab at the top */
.demo-report-page::before {
  content: '📄 PDF';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: #dc2626;
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px 4px 0 0;
  letter-spacing: 0.04em;
}
.demo-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 2px solid #2a7d7d;
  margin-bottom: 10px;
}
.demo-report-section {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.demo-report-section:last-of-type { border-bottom: none; }
.demo-report-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #2a7d7d;
  margin-bottom: 4px;
}
.demo-report-footer {
  display: flex;
  justify-content: space-between;
  font-size: 7px;
  color: #94a3b8;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid #e2ddd5;
}

/* Dismiss button */
.demo-report-dismiss {
  position: absolute;
  top: -12px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: white;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: background 0.15s, color 0.15s;
  z-index: 20;
}
.demo-report-dismiss:hover { background: #fee2e2; color: #dc2626; }

/* === Responsive — demo inside browser frame === */
@media (max-width: 640px) {
  .demo-app { height: 360px; font-size: 10px; }
  .demo-sidebar { display: none; }
  .demo-main { padding: 6px; }
  .demo-table th,
  .demo-table td { padding: 5px 6px; font-size: 9.5px; }
  /* Hide Readiness column on small screens */
  .demo-table th:last-child,
  .demo-table td:last-child { display: none; }
  .demo-detail-header { padding: 6px 8px; gap: 6px; flex-wrap: wrap; }
  .demo-student-name { font-size: 11px; }
  .demo-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .demo-tab { padding: 5px 8px; font-size: 9px; white-space: nowrap; }
  .demo-tab-content { padding: 8px; min-height: 100px; font-size: 9.5px; }
  .demo-mtss-wrap { grid-template-columns: 1fr; gap: 12px; }
  .demo-fact-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
  .demo-fact { padding: 4px 6px; }
  .demo-fact-label { font-size: 7px; }
  .demo-fact-value { font-size: 10px; }
  .demo-tracker-cell { width: 24px; height: 18px; font-size: 9px; }
  .demo-report { max-width: 300px; margin-top: 16px; }
  .demo-report-page { padding: 14px 16px; }
}

/* Container needs position:relative for the cursor */
#miniDemo { position: relative; overflow: hidden; }
