/* /resources/style.css — Shared styles for all pages inside /resources/ */

:root {
  --rp: #f79522;
  --rp-dk: #F68A0A;
  --rb: #e5e7eb;
  --rt: #1f2937;
  --rm: #4b5563;
  --rl: #f9fafb;
  --rol: #fff4e6;
  --rhov: #f7f2ed;
  --rrad: 12px;
  --rshad: 0 4px 12px rgba(0,0,0,.08);
}

/* ── TREE WIDGET (grade overview pages) ─────────────────────────── */
.tree {
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--rb);
  border-radius: var(--rrad);
  padding: 8px 0;
  box-shadow: var(--rshad);
  margin-bottom: 2rem;
}
.tree-node { margin: 2px 0; }
.node-header {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--rt);
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.node-header:hover {
  color: var(--rp-dk);
  background-color: var(--rhov);
  border-left: 4px solid var(--rp-dk);
  padding-left: 16px;
}
.node-header::before {
  content: "›";
  color: var(--rp);
  margin-right: 10px;
  font-size: 1.1rem;
  transition: transform .25s ease;
}
.node-header.expanded::before { transform: rotate(90deg); }
.node-children { display: none; padding-left: 32px; }
.node-children.show { display: block; }
.node-item {
  padding: 10px 20px;
  color: var(--rm);
  cursor: pointer;
  transition: all .2s;
}
.node-item:hover {
  padding-left: 28px;
  color: var(--rp-dk);
  background-color: var(--rol);
}

/* ── TOPIC PAGE BASE ─────────────────────────────────────────────── */
.topic-page { max-width: none; }

/* Desktop: topic pages have no sidebar — expand content to fill ~80% of viewport */
@media (min-width: 769px) {
  .main-layout > .content.topic-page {
    width: 100%;
    padding: 32px 10%;
    box-sizing: border-box;
  }
}
.topic-page h1 { font-size: 2rem; color: var(--rt); margin-bottom: .5rem; line-height: 1.25; }
.topic-page h2 {
  font-size: 1.4rem;
  color: var(--rp-dk);
  margin: 2rem 0 .9rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid #ffe9c8;
}
.topic-page h3 { font-size: 1.05rem; color: var(--rt); margin: 1rem 0 .4rem; font-weight: 600; }

.topic-intro {
  font-size: 1.05rem;
  color: var(--rm);
  line-height: 1.75;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--rp);
  padding: .6rem 1rem;
  background: #fffbf5;
  border-radius: 0 8px 8px 0;
}

/* ── CONCEPT BOX ─────────────────────────────────────────────────── */
.concept-box {
  background: linear-gradient(135deg,#fff8f0,#fff);
  border: 1px solid #f5c47a;
  border-left: 5px solid var(--rp);
  border-radius: var(--rrad);
  padding: 1.25rem 1.5rem;
  margin: .75rem 0 1.25rem;
  line-height: 1.85;
  color: var(--rt);
}
.key-term {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-weight: 700;
  font-size: inherit;
}

/* ── TIP BOX ─────────────────────────────────────────────────────── */
.tip-box {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-left: 5px solid #3b82f6;
  border-radius: var(--rrad);
  padding: .9rem 1.25rem;
  margin: 1rem 0;
  font-size: .95rem;
  color: #1e40af;
}

/* ── EXAMPLE CARDS ───────────────────────────────────────────────── */
.example-card {
  background: #fff;
  border: 1px solid var(--rb);
  border-radius: var(--rrad);
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.example-header {
  background: #f3f4f6;
  color: #1f2937;
  padding: .55rem 1.25rem;
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .03em;
  border-bottom: 1px solid #d1d5db;
}
.example-body {
  padding: 1.1rem 1.4rem;
  font-size: .98rem;
  line-height: 1.8;
  color: var(--rt);
}

/* ── MATHS DISPLAY ───────────────────────────────────────────────── */
.math-stmt {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  margin: .85rem 0;
  padding: .65rem 1rem;
  background: var(--rl);
  border-radius: 8px;
  letter-spacing: .04em;
  color: var(--rt);
}
.step-list { list-style: none; padding: 0; margin: .6rem 0; }
.step-list li {
  padding: .3rem 0 .3rem 1.6rem;
  position: relative;
  line-height: 1.65;
  color: var(--rt);
}
.step-list li::before {
  content: "▶";
  position: absolute;
  left: 0;
  color: var(--rp);
  font-size: .75rem;
  top: .52rem;
}

/* ── VISUAL BOX ──────────────────────────────────────────────────── */
.visual-box {
  background: var(--rl);
  border: 2px dashed var(--rb);
  border-radius: var(--rrad);
  padding: 1.1rem;
  text-align: center;
  margin: .75rem 0;
}
.emoji-row {
  font-size: 1.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  line-height: 2.2;
}
.emoji-group {
  display: inline-flex;
  gap: .1rem;
  padding: .2rem .45rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--rb);
}
.op-sym {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--rp);
  padding: 0 .4rem;
  align-self: center;
}

/* Number grid */
.num-grid {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: .45rem;
  max-width: 300px;
  margin: .5rem auto;
}
.num-tile {
  background: var(--rp);
  color: #fff;
  border-radius: 8px;
  padding: .55rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 2px 4px rgba(247,149,34,.3);
}
.num-tile.alt { background: #3b82f6; }

/* Number line */
.num-line {
  display: flex;
  align-items: flex-end;
  overflow-x: auto;
  padding: .5rem .5rem .25rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--rb);
  margin: .5rem 0;
}
.nl-u { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.nl-d { height: 2px; width: 36px; background: var(--rt); }
.nl-t { width: 2px; height: 10px; background: var(--rt); }
.nl-n { font-size: .78rem; font-weight: 600; margin-top: 3px; color: var(--rt); }
.nl-hl .nl-n { color: var(--rp); font-size: .9rem; }
.nl-hl .nl-t { background: var(--rp); width: 3px; height: 14px; }

/* CSS Shapes */
.shapes-row {
  display: flex;
  gap: 1.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.shape-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--rm);
}
.sh-circle { width: 70px; height: 70px; border-radius: 50%; background: #f79522; }
.sh-square { width: 70px; height: 70px; background: #22c55e; }
.sh-rect   { width: 110px; height: 55px; background: #3b82f6; border-radius: 4px; }
.sh-triangle {
  width: 0; height: 0;
  border-left: 38px solid transparent;
  border-right: 38px solid transparent;
  border-bottom: 66px solid #a855f7;
}

/* Fraction visual */
.frac-row { display: flex; gap: 3px; justify-content: center; margin: .75rem 0; }
.frac-seg {
  height: 48px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #374151;
  font-weight: 700; font-size: .78rem;
  border-radius: 4px;
}
.frac-fill  { background: var(--rp); color: #fff; }
.frac-empty { background: #e5e7eb; color: var(--rm); }

/* Multiplication array */
.array-wrap { display: inline-flex; flex-direction: column; gap: 5px; }
.array-row  { display: flex; gap: 5px; }
.array-dot  { width: 22px; height: 22px; background: var(--rp); border-radius: 50%; }

/* Pattern row */
.pattern-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
  margin: .75rem 0;
}
.pat-item {
  width: 36px; height: 36px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  border: 2px solid var(--rb);
}
.pat-a { background: #fde68a; }
.pat-b { background: #a5f3fc; }
.pat-c { background: #bbf7d0; }
.pat-q { background: #f1f5f9; border: 2px dashed var(--rm); color: var(--rm); font-size: .85rem; }

/* Bar / ruler */
.ruler-bar {
  display: flex;
  align-items: stretch;
  height: 40px;
  border: 2px solid var(--rt);
  border-radius: 4px;
  overflow: hidden;
  max-width: 360px;
  margin: .5rem auto;
}
.ruler-unit {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  border-right: 1px solid var(--rb);
  color: var(--rt);
}
.ruler-unit:nth-child(odd)  { background: #fff; }
.ruler-unit:nth-child(even) { background: var(--rl); }
.ruler-unit:last-child { border-right: none; }

/* ── PRACTICE SECTION ────────────────────────────────────────────── */
.practice-section {
  background: var(--rl);
  border-radius: var(--rrad);
  padding: 1.4rem 1.5rem;
  margin: 2rem 0;
}
.practice-section > h2 { margin-top: 0; }
.practice-intro { color: var(--rm); font-size: .92rem; margin-bottom: 1.1rem; }
.pq {
  background: #fff;
  border: 1px solid var(--rb);
  border-radius: 8px;
  padding: .9rem 1.15rem;
  margin-bottom: .9rem;
}
.pq p { margin: 0 0 .65rem; font-size: .98rem; color: var(--rt); font-weight: 500; }
.pq-num { color: var(--rp); font-weight: 700; margin-right: .25rem; }
.reveal-btn {
  background: var(--rp);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .35rem .9rem;
  font-size: .82rem;
  cursor: pointer;
  transition: background .18s;
  font-weight: 600;
}
.reveal-btn:hover { background: var(--rp-dk); }
.answer-box {
  display: none;
  margin-top: .7rem;
  padding: .65rem 1rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-weight: 600;
  color: #166534;
  font-size: .92rem;
}

/* ── KEY POINTS ──────────────────────────────────────────────────── */
.key-points-box {
  background: var(--rol);
  border: 1px solid #f5c47a;
  border-radius: var(--rrad);
  padding: 1.1rem 1.4rem;
  margin: 1.5rem 0;
}
.key-points-box h2 { margin-top: 0; color: var(--rt); border-bottom-color: rgba(247,149,34,.25); }
.key-points-box ul { margin: 0; padding-left: 1.2rem; line-height: 2.1; color: var(--rt); }
.key-points-box li::marker { color: var(--rp); }

/* ── DATA TABLE ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .93rem; }
.data-table th { background: #f3f4f6; color: #1f2937; padding: .55rem 1rem; text-align: left; font-weight: 700; border-bottom: 2px solid #d1d5db; }
.data-table td { padding: .55rem 1rem; border-bottom: 1px solid var(--rb); color: var(--rt); }
.data-table tr:nth-child(even) td { background: var(--rl); }

/* ── OVERRIDE ALL TABLE HEADERS (covers per-page inline styles too) ── */
table th {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #d1d5db !important;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .topic-page h1  { font-size: 1.5rem; }
  .topic-page h2  { font-size: 1.2rem; }
  .math-stmt      { font-size: 1.2rem; }
  .emoji-row      { font-size: 1.5rem; }
  .num-grid       { grid-template-columns: repeat(4,1fr); max-width: 240px; }
  .shapes-row     { gap: 1rem; }
  .example-body   { padding: .8rem 1rem; }
  .practice-section { padding: 1rem; }
}
