/* =====================================================================
   TeacherLife design system — the ONLY place colors, fonts and shared
   components are defined. Telegram-style neutral surfaces + one CINEMA
   GOLD accent family. Status colors (success/warning) are semantic only.
   No gradients, no emoji (inline SVG icons). Typing green/red live in
   play.html and are functional only.
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

/* ---------- tokens: light (default) ---------- */
:root {
  --bg: #F1F4F9;              /* page */
  --surface: #FFFFFF;         /* cards */
  --surface-2: #F6F8FB;       /* inset areas inside cards */
  --text: #0F1419;
  --muted: #707B87;
  --border: #E3E8EE;
  --accent: #9A6A00;          /* accent text, links, progress (dark gold for contrast on white) */
  --btn: #F0B429;             /* accent button background */
  --on-btn: #271C00;          /* text on accent button */
  --soft: #FBF0D7;            /* accent-soft background */
  --soft-ink: #7A5500;        /* text on accent-soft */
  --soft-border: #E8D194;
  --logo-color: #B8860B;       /* the PandType mark (dark gold on light) */
  --wl-dim: #7A5500; --wl-base: #B8860B; --wl-bright: #E8C97A;   /* mark/wordmark wave ramp */
  --success: #2E7D4F;          /* success text / icon */
  --success-soft: #E4F4E6;     /* success-soft background */
  --success-border: #BCE2C4;
  --warning: #F0B429;

  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar: 232px;
  color-scheme: light;
}

/* ---------- tokens: dark / Telegram night (manual, or system when not forced light) ---------- */
:root[data-theme="dark"] {
  --bg: #0E1621; --surface: #17212B; --surface-2: #1E2832; --text: #F2F5F8; --muted: #8794A3;
  --border: #2B3847; --accent: #F0B429; --btn: #F0B429; --on-btn: #271C00;
  --soft: #2E2410; --soft-ink: #F5C85C; --soft-border: #6B5618;
  --logo-color: #F0B429;
  --wl-dim: #8A6508; --wl-base: #F0B429; --wl-bright: #FFE08A;
  --success: #86D99A; --success-soft: #1B3021; --success-border: #2E5A3C;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1621; --surface: #17212B; --surface-2: #1E2832; --text: #F2F5F8; --muted: #8794A3;
    --border: #2B3847; --accent: #F0B429; --btn: #F0B429; --on-btn: #271C00;
    --soft: #2E2410; --soft-ink: #F5C85C; --soft-border: #6B5618;
  --logo-color: #F0B429;
  --wl-dim: #8A6508; --wl-base: #F0B429; --wl-bright: #FFE08A;
  --success: #86D99A; --success-soft: #1B3021; --success-border: #2E5A3C;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .head { font-family: var(--font-head); letter-spacing: -0.01em; line-height: 1.15; }
a { color: var(--accent); }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app shell: sidebar | (topbar / content + rail) ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 4px 8px 18px; }
.logo-mark { width: 56px; height: 37px; color: var(--logo-color); display: grid; place-items: center; }
.logo-mark svg { width: 100%; height: 100%; }

/* ---------- animated dotted mark + wordmark shimmer ---------- */
.wl-mark { display: block; width: 100%; height: 100%; }
.wl-mark .wl-dot {
  fill: var(--logo-color);
  transform-box: fill-box; transform-origin: center;
  animation: wl-wave 2.8s ease-in-out infinite;
}
/* golden wave: dim -> gold -> bright with a pulse and a soft glow at the peak */
@keyframes wl-wave {
  0%, 100% { fill: var(--wl-dim); transform: scale(1); filter: none; }
  45%      { fill: var(--wl-base); }
  60%      { fill: var(--wl-bright); transform: scale(1.25); filter: drop-shadow(0 0 1.3px var(--wl-bright)); }
  80%      { fill: var(--wl-base); }
}
/* rare spark: one dot flashes near-white on top of the wave */
.wl-mark .wl-dot.wl-spark { animation: wl-spark .7s ease-out; animation-delay: 0s !important; }
@keyframes wl-spark {
  0%, 100% { fill: var(--wl-base); transform: scale(1); filter: none; }
  35%      { fill: #FFF6DC; transform: scale(1.6); filter: drop-shadow(0 0 2.6px #FFF6DC); }
}
.logo-word {
  font-family: var(--font-head); font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--wl-dim), var(--wl-base), var(--wl-bright), var(--wl-base), var(--wl-dim));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: wl-shimmer 8s linear infinite, wl-breathe 4s ease-in-out infinite;
}
@keyframes wl-shimmer { from { background-position: 0% 0; } to { background-position: 200% 0; } }
@keyframes wl-breathe {
  0%, 100% { filter: none; }
  50%      { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--wl-base) 50%, transparent)); }
}
@media (prefers-reduced-motion: reduce) {
  .wl-mark .wl-dot { animation: none; fill: var(--logo-color); }
  .logo-word { animation: none; }
}
.side-group { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.side-link .icon { color: var(--muted); }
.side-link:hover { background: var(--surface-2); }
.side-link[aria-current] { background: var(--soft); color: var(--soft-ink); }
.side-link[aria-current] .icon { color: var(--soft-ink); }
.side-link.locked { color: var(--muted); cursor: default; }
/* module label (not a location): styled exactly like inactive items; small gold dot = module is live */
.side-link .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--btn); flex: none; margin-right: -4px; }
.side-link.locked:hover { background: none; }
.side-link small { margin-left: auto; font-size: 11px; color: var(--muted); }
.side-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px;
}
.search .icon { color: var(--muted); }
.search input { flex: 1; border: 0; background: none; color: var(--text); font: inherit; padding: 9px 0; outline: none; min-width: 0; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 26px 28px 40px; flex: 1; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.page-title { font-size: 30px; margin: 4px 0 6px; }
.page-lead { color: var(--muted); margin: 0 0 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-head h2 { font-size: 21px; margin: 0; }

/* ---------- language pill + dropdown ---------- */
.lang { position: relative; }
.pill {
  height: 36px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.menu button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 0; background: none; color: var(--text); font-size: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left;
}
.menu button:hover { background: var(--surface-2); }
.menu button .icon { color: var(--accent); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer; text-decoration: none;
  padding: 11px 20px; font-size: 15px; font-weight: 700; line-height: 1;
  background: var(--btn); color: var(--on-btn);
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; filter: none; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.soft { background: var(--soft); color: var(--soft-ink); border-color: var(--soft-border); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.lg { padding: 15px 26px; font-size: 16px; }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 18px 20px; }
.card.soft { background: var(--soft); border-color: var(--soft-border); }
.card.soft .kicker, .card.soft h3 { color: var(--soft-ink); }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  text-decoration: none;
}
a.chip:hover { border-color: var(--accent); }
.chip small { color: var(--muted); font-size: 12px; }
.chip .x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; display: grid; place-items: center; }
.chip .x:hover { color: var(--text); }
.chip .x .icon { width: 14px; height: 14px; }
/* status chips: semantic only, always with a label */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; border: 1px solid; }
.status.good { color: var(--success); border-color: var(--success-border); background: var(--success-soft); }
.status.warn { color: var(--text); border-color: var(--warning); background: color-mix(in srgb, var(--warning) 18%, transparent); }
.status.info { color: var(--soft-ink); border-color: var(--soft-border); background: var(--soft); }
.bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* stat tile */
.tile { padding: 14px 16px; }
.tile b { display: block; font-family: var(--font-head); font-size: 26px; font-weight: 700; line-height: 1.2; }
.tile span { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles .tile:first-child { grid-column: 1 / -1; }

/* ---------- small tooltip (onboarding etc.) ---------- */
.tip {
  position: fixed; z-index: 20; max-width: min(90vw, 520px);
  display: flex; align-items: center; gap: 12px; white-space: nowrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.tip b { color: var(--accent); font-weight: 700; }
.tip button {
  border: 0; background: var(--btn); color: var(--on-btn); font-weight: 700; font-size: 13px;
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
}

.empty { padding: 36px 24px; text-align: center; }
.empty p { color: var(--muted); margin: 0 0 18px; }
.site-footer { padding: 18px 28px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- narrow screens: sidebar becomes a top strip, rail stacks below ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center; gap: 4px;
    overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .logo { padding: 4px 8px 4px 0; }
  .logo-word { display: none; }
  .side-group { display: none; }
  .side-link { white-space: nowrap; padding: 7px 10px; }
  .side-link.locked { display: none; }
  .side-bottom { margin: 0; padding: 0; border: 0; }
  .topbar { padding: 10px 14px; position: static; }
  .content { padding: 18px 14px 32px; }
}
