/* =========================================================
   Lesson Plan Generator — design system
   Premium, professional, classroom-friendly.
   ========================================================= */
:root {
  --navy: #16263f;
  --indigo: #2b3a67;
  --blue: #2a6f97;
  --accent: #14a08a;
  --accent-2: #2a9d8f;
  --bg: #eef2f7;
  --bg-2: #f7f9fc;
  --panel: #ffffff;
  --line: #e2e8f0;
  --line-soft: #eef2f6;
  --text: #1b2733;
  --muted: #67788a;
  --ring: rgba(42, 111, 151, .18);
  --shadow-sm: 0 1px 2px rgba(16, 36, 64, .06);
  --shadow-md: 0 6px 20px rgba(16, 36, 64, .08);
  --shadow-lg: 0 16px 40px rgba(16, 36, 64, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --head-font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --body-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body-font);
  background:
    radial-gradient(1100px 480px at 88% -8%, rgba(42, 157, 143, .10), transparent 60%),
    radial-gradient(900px 420px at -6% 4%, rgba(43, 58, 103, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-family: var(--head-font); letter-spacing: -.01em; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 26px;
  background: linear-gradient(120deg, var(--navy) 0%, var(--indigo) 55%, var(--blue) 120%);
  color: #fff;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo {
  font-size: 26px;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 13px;
  backdrop-filter: blur(6px);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 800; }
.topbar .sub { margin: 3px 0 0; font-size: 12px; opacity: .8; font-weight: 500; }

.badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.badge-demo { background: linear-gradient(135deg, #ffd166, #ffb84d); color: #5a3e00; }
.badge-live { background: linear-gradient(135deg, #14a08a, #2a9d8f); color: #fff; }

/* ---------- Welcome banner ---------- */
.welcome {
  max-width: 1200px;
  margin: 22px auto 0;
  padding: 0 22px;
}
.welcome-inner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff, #eef6fb);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px 18px 24px;
  box-shadow: var(--shadow-sm);
}
.welcome-inner::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(var(--accent), var(--blue));
}
.welcome-greet {
  margin: 0;
  font-family: var(--head-font);
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
}
.welcome-date {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.welcome-quote {
  margin: 10px 0 0;
  font-size: 13.5px;
  font-style: italic;
  color: var(--blue);
  line-height: 1.5;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 22px;
  padding: 22px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-md);
}
.form-panel { position: sticky; top: 92px; }
@media (max-width: 880px) {
  .form-panel { position: static; }
}

/* ---------- Form ---------- */
.form-panel h2 { margin: 0 0 4px; font-size: 19px; font-weight: 800; color: var(--navy); }
.form-panel .hint { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

#planForm label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--navy);
  letter-spacing: .01em;
}
#planForm input,
#planForm textarea {
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--bg-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#planForm input::placeholder,
#planForm textarea::placeholder { color: #9aa9b8; }
#planForm input:focus,
#planForm textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--ring);
}
#planForm textarea { resize: vertical; }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
.req { color: #e63946; }
.opt { color: var(--muted); font-weight: 400; }

.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--head-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20, 160, 138, .28);
  transition: transform .08s, box-shadow .18s, filter .18s;
}
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 10px 24px rgba(20, 160, 138, .36); }
.btn-primary:active { transform: translateY(1px) scale(.995); }
.btn-primary:disabled { background: #9bbdb8; box-shadow: none; cursor: progress; }

.status-msg { margin: 13px 0 0; font-size: 13px; color: var(--blue); min-height: 18px; font-weight: 500; }

/* ---------- Output ---------- */
.output-panel { min-height: 440px; }
.output-actions {
  display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--line-soft);
}
.btn-out {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--navy);
  font-family: var(--head-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn-out:hover { background: #f0f6fb; border-color: var(--blue); box-shadow: var(--shadow-md); }
.btn-out:active { transform: translateY(1px); }

.empty-state {
  text-align: center;
  padding: 86px 20px;
  color: var(--muted);
}
.empty-state .big-emoji {
  font-size: 46px; display: grid; place-items: center;
  width: 92px; height: 92px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #eef6fb, #e6f3f0);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.empty-state p { margin: 6px 0; font-size: 15px; }
.empty-state .hint { font-size: 13px; }

/* ---------- The Document ---------- */
.plan-doc {
  font-family: var(--body-font);
  color: var(--text);
  line-height: 1.6;
}
.doc-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--navy);
}
.doc-title + .doc-header { margin-top: 18px; }
.doc-header {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13.5px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.doc-header th, .doc-header td {
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.doc-header th {
  background: #eef3f7;
  width: 36%;
  font-weight: 700;
  color: var(--navy);
}
.section-head {
  position: relative;
  background: linear-gradient(120deg, var(--navy), var(--indigo));
  color: #fff;
  padding: 9px 14px 9px 18px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  margin: 26px 0 14px;
  box-shadow: var(--shadow-sm);
}
.section-head::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.field-block {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.field-block h4 {
  margin: 0 0 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--blue);
}
.field-block > div { font-size: 14px; }
.field-block ul { margin: 4px 0; padding-left: 20px; }
.field-block li { margin-bottom: 5px; }

/* ---------- Rubric table ---------- */
.rubric-title { font-weight: 700; margin: 2px 0 9px; font-size: 13px; color: var(--navy); }
.rubric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.rubric-table th, .rubric-table td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: left;
  vertical-align: top;
}
.rubric-table thead th,
.rubric-table tr:first-child th { background: linear-gradient(120deg, var(--navy), var(--indigo)); color: #fff; }
.rubric-table tr th:first-child { width: 20%; background: #eef3f7; color: var(--navy); }
.rubric-table tr:first-child th:first-child { background: var(--navy); color: #fff; }
.rubric-table tbody tr:nth-child(even) td { background: #f7fafc; }

/* ---------- Slides ---------- */
.btn-slides {
  margin-left: auto;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  color: #fff; border-color: transparent;
}
.btn-slides:hover { filter: brightness(1.06); color: #fff; }

.slides-wrap {
  max-width: 1200px;
  margin: 4px auto 28px;
  padding: 0 22px;
}
.slides-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.slides-bar h2 { margin: 0; font-size: 19px; font-weight: 800; color: var(--navy); }
.slides-bar .hint { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.slides-actions { display: flex; gap: 10px; }

.slides-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

/* One slide = clean 16:9 card. --slide-primary set inline per theme. */
.slide-card {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.slide-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.slide-card .slide-no {
  position: absolute;
  bottom: 8px; right: 12px;
  font-size: 10px; color: #b3bfcb;
}
.slide-card .slide-accent {
  width: 46px; height: 4px; border-radius: 3px;
  background: var(--slide-primary, #1d3557);
  margin-bottom: 11px;
}
.slide-card h3 {
  margin: 0 0 9px;
  font-size: 15px;
  font-weight: 800;
  color: var(--slide-primary, #1d3557);
  line-height: 1.25;
}
.slide-card ul { margin: 0; padding-left: 18px; }
.slide-card li { font-size: 11.5px; margin-bottom: 5px; color: #2a3744; line-height: 1.4; }
.slide-card p.slide-sub { font-size: 12px; color: var(--muted); margin: 2px 0; }

/* Title slide variant */
.slide-card.title-slide {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(145deg, var(--slide-primary, #1d3557), rgba(0, 0, 0, .25));
}
.slide-card.title-slide h3 { color: #fff; font-size: 19px; }
.slide-card.title-slide p.slide-sub { color: rgba(255, 255, 255, .88); }
.slide-card.title-slide .slide-accent { background: rgba(255, 255, 255, .75); margin: 0 auto 12px; }

/* References slide variant */
.slide-card.ref-slide li { font-size: 11px; color: #44535f; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 26px 20px;
  color: var(--muted);
  font-size: 12.5px;
}
.footer p { margin: 4px 0; }
.footer-by {
  font-family: var(--head-font);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 11px;
  background: linear-gradient(120deg, var(--indigo), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Print ---------- */
@media print {
  .topbar, .welcome, .form-panel, .output-actions, .footer, #modeBadge, .slides-wrap { display: none !important; }
  body { background: #fff; }
  .layout { display: block; padding: 0; max-width: none; }
  .output-panel { border: none; box-shadow: none; padding: 0; }
  .panel { box-shadow: none; border: none; }
  .field-block { background: #fff; border: none; padding: 0 0 0 2px; break-inside: avoid; }
  .section-head, .rubric-table thead th, .rubric-table tr:first-child th {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .rubric-table, .doc-header { break-inside: avoid; }
}
