/* SimuloSchool design system — tokens and components from the approved design. */

:root {
  --ink: #182849;
  --ink-soft: #4a5578;
  --paper: #eff1ea;
  --paper-deep: #e4e7dd;
  --card: #ffffff;
  --line: #d9dccf;
  --marigold: #f2a93b;
  --marigold-deep: #d98f1e;
  --coral: #e8674b;
  --sage: #4c9a75;
  --sage-deep: #357753;
  --shadow: 0 20px 50px -20px rgba(24, 40, 73, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

a {
  text-decoration: none;
  color: inherit;
}

.logo {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.logo span {
  color: var(--marigold-deep);
}

/* Logo images carry an explicit height so the header does not reflow while
   they load. The source artwork is a stacked lockup, which goes illegible at
   header height — the tagline lands around 3px — so headers use a horizontal
   lockup built from the same mark and wordmark. */
.logo-h {
  height: 38px;
  width: auto;
  display: block;
}

/* Auth pages centre the logo with room to spare, so they show the stacked
   lockup at full strength. */
.logo-full {
  height: 84px;
  width: auto;
  display: block;
}

/* The footer sits on --ink, where the lockup's navy would disappear; it uses
   the white knockout instead. */
.logo-footer {
  height: 44px;
  width: auto;
  display: block;
}

.eyebrow {
  font-family: "Baloo 2", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--marigold-deep);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--marigold-deep);
  display: inline-block;
}

/* ---------- report-card signature component ---------- */
.report-card {
  background: var(--card);
  border-radius: 6px;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.report-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 10px;
  background-image: radial-gradient(circle, var(--paper) 3.5px, transparent 3.6px);
  background-size: 18px 10px;
  background-repeat: repeat-x;
  background-position: top center;
}

.stamp-tab {
  position: absolute;
  top: -14px;
  right: 28px;
  background: var(--marigold);
  color: var(--ink);
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  transform: rotate(4deg);
  box-shadow: 0 6px 14px -6px rgba(217, 143, 30, 0.6);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 26px;
  border-radius: 32px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--sage);
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(76, 154, 117, 0.55);
}

.btn-primary:hover {
  background: var(--sage-deep);
}

.nav-cta {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: "Inter", sans-serif;
}

.nav-cta:hover {
  background: #223462;
}

.error {
  color: var(--coral);
  font-size: 13.5px;
  margin-top: 12px;
}

/* ---------- header / nav ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(239, 241, 234, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  max-width: 1180px;
  margin: 0 auto;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.nav-upload {
  background: var(--marigold);
  color: var(--ink);
  padding: 9px 18px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 14px -6px rgba(217, 143, 30, 0.6);
}

.nav-upload:hover {
  background: var(--marigold-deep);
}

/* ---------- login page ---------- */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-inner {
  width: 100%;
  max-width: 400px;
}

.auth-inner .logo {
  justify-content: center;
  font-size: 26px;
  margin-bottom: 24px;
}

.auth-card {
  padding: 36px 32px 32px;
}

.auth-card h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

.auth-card .subtitle {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin-bottom: 26px;
}

form label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: "Inter", sans-serif;
  color: var(--ink);
}

form input:focus {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
  border-color: transparent;
}

form .btn {
  width: 100%;
  margin-top: 26px;
}

.microcopy {
  font-size: 12.5px;
  color: var(--ink-soft);
  opacity: 0.8;
  text-align: center;
  margin-top: 16px;
}

.hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 5px;
}

.auth-alt {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.auth-alt a {
  color: var(--sage-deep);
  font-weight: 600;
}

.auth-inner .logo {
  justify-content: center;
  font-size: 26px;
  margin-bottom: 24px;
}

/* ---------- lessons page ---------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

.page-head {
  padding: 64px 0 36px;
}

.page-head h2 {
  font-size: 38px;
}

.page-head p {
  color: var(--ink-soft);
  font-size: 16px;
  margin-top: 10px;
  max-width: 560px;
}

.video-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-bottom: 96px;
}

@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

.sim-card {
  overflow: hidden;
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sim-card:hover {
  transform: translateY(-4px);
}

.sim-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ink), #26386c);
}

.sim-thumb .grid-lines {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
}

.sim-thumb .mini-play {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--marigold);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 2;
  box-shadow: 0 0 0 7px rgba(242, 169, 59, 0.18);
  cursor: pointer;
}

.sim-body {
  padding: 16px 18px 20px;
}

.sim-body .subj {
  font-family: "Baloo 2", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--marigold-deep);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.sim-body h3 {
  font-size: 16px;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  margin-bottom: 4px;
}

.video-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ---------- admin: upload + pipeline ---------- */
.success {
  color: var(--sage-deep);
  font-size: 13.5px;
  margin-top: 12px;
}

.upload-card {
  padding: 32px 30px 26px;
  max-width: 620px;
  margin-bottom: 56px;
}

.upload-card h3 {
  font-size: 22px;
  margin-bottom: 4px;
}

.upload-card .btn {
  width: 100%;
  margin-top: 24px;
}

.upload-card .microcopy {
  margin-top: 14px;
}

.upload-card code {
  font-size: 12px;
  background: var(--paper-deep);
  padding: 2px 6px;
  border-radius: 4px;
}

.optional {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 12px;
}

form textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: "Inter", sans-serif;
  color: var(--ink);
  resize: vertical;
}

form textarea:focus {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
  border-color: transparent;
}

input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: "Inter", sans-serif;
  color: var(--ink-soft);
}

.section-title {
  font-size: 24px;
  margin-bottom: 18px;
}

.pipeline-card {
  padding: 24px 22px 20px;
  margin-bottom: 16px;
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pipeline-head h4 {
  font-size: 18px;
}

.status-pill {
  font-family: "Baloo 2", sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-uploaded,
.status-processing {
  background: rgba(242, 169, 59, 0.16);
  color: var(--marigold-deep);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Live indicator: generation is actively running right now. */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--marigold-deep);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

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

.status-pending_review {
  background: rgba(24, 40, 73, 0.1);
  color: var(--ink);
}

.status-published {
  background: rgba(76, 154, 117, 0.14);
  color: var(--sage-deep);
}

.status-failed {
  background: rgba(232, 103, 75, 0.14);
  color: var(--coral);
}

.pipeline-card .video-meta {
  margin-top: 6px;
}

.pipeline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pipeline-actions .btn {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: var(--paper);
}

.btn-danger {
  background: transparent;
  color: var(--coral);
  border: 1px solid rgba(232, 103, 75, 0.35);
  margin-left: auto; /* keep destructive action away from the safe ones */
}

.btn-danger:hover {
  background: rgba(232, 103, 75, 0.08);
}

.review-list {
  list-style: none;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.review-question {
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

.review-question:last-child {
  border-bottom: none;
}

.review-q-text {
  font-size: 14.5px;
  font-weight: 500;
}

.tier {
  font-family: "Baloo 2", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 20px;
  margin-right: 6px;
}

.tier-easy {
  background: rgba(76, 154, 117, 0.14);
  color: var(--sage-deep);
}

.tier-medium {
  background: rgba(242, 169, 59, 0.18);
  color: var(--marigold-deep);
}

.tier-hard {
  background: rgba(232, 103, 75, 0.14);
  color: var(--coral);
}

.review-options {
  margin: 8px 0 0 20px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.review-options li {
  padding: 2px 0;
}

.review-options li.correct {
  color: var(--sage-deep);
  font-weight: 600;
}

.review-options li.correct::after {
  content: " ✓";
}

/* ---------- empty state ---------- */
.empty-card {
  max-width: 480px;
  margin: 24px auto 96px;
  padding: 40px 34px;
  text-align: center;
}

.empty-card .big-emoji {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-card h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.empty-card p {
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* ==========================================================================
   Responsive pass — phones and small tablets.
   Goals: nothing overflows horizontally, tap targets stay >= 44px, and
   text/padding scale down instead of the layout squeezing.
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%; /* stop iOS inflating text in landscape */
}

body {
  overflow-x: hidden; /* belt-and-braces against a stray wide child */
}

/* Long values (storage keys, emails) must wrap rather than widen the page. */
.video-meta,
.pipeline-head h4,
.review-q-text,
.t-name {
  overflow-wrap: anywhere;
}

/* Any table can exceed a phone's width — let it scroll inside its own box. */
table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .wrap {
    padding: 0 20px;
  }

  nav {
    padding: 14px 20px;
    gap: 10px;
  }

  .page-head {
    padding: 40px 0 26px;
  }

  .page-head h2 {
    font-size: 28px;
  }

  .section-title {
    font-size: 20px;
  }
}

@media (max-width: 600px) {
  /* Header: keep it one line by shrinking, not by overflowing. */
  .topbar,
  nav {
    padding: 12px 16px;
  }

  .logo {
    font-size: 18px;
  }

  .logo-h {
    height: 30px;
  }

  .logo-full {
    height: 66px;
  }

  .logo-footer {
    height: 38px;
  }

  .nav-right {
    gap: 8px;
    font-size: 13px;
  }

  /* The signed-in name is the first thing to go — the avatar/button matter more. */
  .nav-right #user-name {
    display: none;
  }

  .nav-cta,
  .nav-upload {
    padding: 9px 14px;
    font-size: 13px;
  }

  .wrap {
    padding: 0 16px;
  }

  .page-head {
    padding: 32px 0 20px;
  }

  .page-head h2 {
    font-size: 24px;
  }

  .page-head p {
    font-size: 14.5px;
  }

  /* Auth pages */
  .auth-page {
    padding: 20px 16px;
  }

  .auth-card {
    padding: 28px 20px 24px;
  }

  .auth-card h1 {
    font-size: 24px;
  }

  .auth-inner .logo {
    font-size: 22px;
    margin-bottom: 18px;
  }

  /* 16px inputs stop iOS Safari zooming in on focus. */
  form input,
  form textarea {
    font-size: 16px;
  }

  .upload-card {
    padding: 26px 18px 22px;
  }

  .upload-card h3 {
    font-size: 19px;
  }

  /* Admin pipeline */
  .pipeline-card {
    padding: 18px 16px 16px;
  }

  .pipeline-head {
    gap: 8px;
  }

  .pipeline-head h4 {
    font-size: 16px;
  }

  .pipeline-actions {
    gap: 8px;
  }

  /* Full-width, comfortably tappable buttons instead of a cramped row. */
  .pipeline-actions .btn {
    flex: 1 1 100%;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
  }

  /* The right-aligned delete button reads as misplaced once buttons stack. */
  .btn-danger {
    margin-left: 0;
  }

  .review-options {
    margin-left: 14px;
  }

  .empty-card {
    padding: 30px 20px;
  }

  .video-grid {
    gap: 12px;
    padding-bottom: 56px;
  }
}

@media (max-width: 380px) {
  .nav-cta,
  .nav-upload {
    padding: 8px 11px;
    font-size: 12.5px;
  }

  .logo {
    font-size: 17px;
  }

  .logo-h {
    height: 28px;
  }

  .page-head h2 {
    font-size: 22px;
  }
}
