/* ═══ LessonLoop design system ═══
   cream #FDF8F0 · buttercream #FFF9E6 · coral #E8614D · forest #3D7B5F · charcoal #3A3238 */

:root {
  --cream: #FDF8F0;
  --buttercream: #FFF9E6;
  --coral: #E8614D;
  --coral-soft: #FBEAE6;
  --forest: #3D7B5F;
  --forest-soft: #E4F0EA;
  --charcoal: #3A3238;
  --ink-soft: #6E6469;
  --line: #EBE2D3;
  --card: #FFFFFF;
  --display: "Fraunces", Georgia, serif;
  --body: "DM Sans", -apple-system, sans-serif;
  --radius: 14px;
  --shadow: 0 2px 6px rgba(58,50,56,.06), 0 10px 28px rgba(58,50,56,.07);
  --ruled: repeating-linear-gradient(transparent, transparent 31px, #F0E6D4 31px, #F0E6D4 32px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--cream); }
body { font-family: var(--body); color: var(--charcoal); background: var(--cream); line-height: 1.55; }
.hidden { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; }
button { font-family: var(--body); cursor: pointer; }
input, select, textarea { font-family: var(--body); color: var(--charcoal); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 4px; }

.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--coral); margin-bottom: 10px;
}

/* ── Buttons ── */
.btn {
  border: none; border-radius: 999px; padding: 12px 24px; font-size: 15px; font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 4px 14px rgba(232,97,77,.3); }
.btn-primary:hover { background: #D6543F; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--charcoal); color: var(--charcoal); }
.btn-forest { background: var(--forest); color: #fff; }
.btn-forest:hover { background: #326650; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ── Onboarding ── */
.onboarding {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 80% 0%, var(--buttercream) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 100%, var(--coral-soft) 0%, transparent 55%),
    var(--cream);
}
.onboard-card {
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 48px; width: 100%; max-width: 620px; border: 1px solid var(--line);
}
.onboard-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; }
.logo-mark { font-size: 26px; }
.logo-type { font-family: var(--display); font-size: 24px; font-weight: 900; }
.logo-type em { font-style: italic; color: var(--coral); }
.onboard-card h1 { font-size: 34px; margin-bottom: 10px; }
.onboard-sub { color: var(--ink-soft); margin-bottom: 28px; }
.field-label { display: block; font-size: 13px; font-weight: 700; margin: 18px 0 8px; }
.text-input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 15px; background: var(--cream);
}
.text-input:focus { border-color: var(--coral); outline: none; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1.5px solid var(--line); background: var(--cream); border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 500; transition: all .15s ease;
}
.chip:hover { border-color: var(--coral); }
.chip.selected { background: var(--coral); border-color: var(--coral); color: #fff; font-weight: 600; }
.grade-grid .chip { min-width: 64px; justify-content: center; text-align: center; }
.standards-list { display: flex; flex-direction: column; gap: 10px; }
.standard-row {
  display: flex; align-items: flex-start; gap: 14px; border: 1.5px solid var(--line);
  border-radius: 14px; padding: 16px; cursor: pointer; transition: all .15s ease; background: var(--cream);
}
.standard-row:hover { border-color: var(--forest); }
.standard-row.selected { border-color: var(--forest); background: var(--forest-soft); }
.standard-row .check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; margin-top: 2px;
}
.standard-row.selected .check { background: var(--forest); border-color: var(--forest); animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.5); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.standard-row strong { display: block; font-size: 15px; }
.standard-row span.desc { font-size: 13px; color: var(--ink-soft); }
.onboard-nav { display: flex; justify-content: space-between; margin-top: 32px; }
.onboard-step { animation: slideIn .35s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ── App shell ── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--buttercream); border-right: 1px solid var(--line);
  padding: 28px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 0 12px 28px; }
.sidebar-brand .logo-type { font-size: 20px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  text-decoration: none; font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  transition: all .15s ease;
}
.sidebar-nav a:hover { background: rgba(232,97,77,.08); color: var(--charcoal); }
.sidebar-nav a.active { background: var(--coral); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(232,97,77,.28); }
.nav-ico { font-size: 17px; }
.sidebar-foot { padding: 12px; }
.plan-meter { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; font-size: 12.5px; }
.plan-meter .bar { height: 6px; background: var(--line); border-radius: 3px; margin: 8px 0; overflow: hidden; }
.plan-meter .bar i { display: block; height: 100%; background: var(--coral); border-radius: 3px; transition: width .4s ease; }
.plan-meter a { color: var(--coral); font-weight: 600; text-decoration: none; }

.main { flex: 1; padding: 40px 48px; max-width: 1100px; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 34px; margin-bottom: 6px; }
.page-head p { color: var(--ink-soft); max-width: 60ch; }

/* ── Dashboard / trends ── */
.dash-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.filter-pill {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 500; transition: all .15s ease;
}
.filter-pill.active { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.safe-toggle {
  margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  color: var(--forest); background: var(--forest-soft); padding: 8px 14px; border-radius: 999px;
}
.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.trend-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); position: relative; transition: transform .2s ease, box-shadow .2s ease;
  display: flex; flex-direction: column; gap: 10px;
}
.trend-card::before {
  content: ""; position: absolute; top: -1px; left: 22px; right: 22px; height: 4px;
  background: var(--coral); border-radius: 0 0 4px 4px; opacity: 0; transition: opacity .2s ease;
}
.trend-card:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(58,50,56,.08), 0 18px 40px rgba(58,50,56,.1); }
.trend-card:hover::before { opacity: 1; }
.trend-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.trend-tag { background: var(--buttercream); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.trend-heat { color: var(--coral); font-weight: 700; }
.trend-card h3 { font-size: 19px; }
.trend-card p { font-size: 13.5px; color: var(--ink-soft); flex: 1; }
.trend-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.safe-badge { font-size: 11.5px; font-weight: 700; color: var(--forest); display: flex; align-items: center; gap: 5px; }

/* ── Generator ── */
.gen-wrap { max-width: 720px; }
.gen-panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.gen-trend-recap {
  display: flex; gap: 14px; background: var(--buttercream); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-bottom: 24px; align-items: center;
}
.gen-trend-recap .emoji { font-size: 30px; }
.gen-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.select-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14.5px; background: var(--cream); appearance: auto;
}
.gen-loading { text-align: center; padding: 60px 20px; }
.gen-loading .spinner {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 20px;
  border: 4px solid var(--coral-soft); border-top-color: var(--coral); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-loading p { font-family: var(--display); font-size: 20px; font-style: italic; }
.gen-loading small { color: var(--ink-soft); }

/* ── Editor ── */
.editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.editor-head input.title-input {
  font-family: var(--display); font-size: 30px; font-weight: 700; border: none; background: transparent;
  border-bottom: 2px dashed transparent; width: 100%; padding: 4px 0;
}
.editor-head input.title-input:hover, .editor-head input.title-input:focus { border-bottom-color: var(--line); outline: none; }
.editor-actions { display: flex; gap: 10px; flex-shrink: 0; }
.standards-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.standard-pill {
  font-size: 12px; font-weight: 700; background: var(--forest-soft); color: var(--forest);
  border-radius: 999px; padding: 5px 12px; display: inline-flex; align-items: center; gap: 5px;
}
.editor-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 0; }
.editor-tab {
  background: transparent; border: none; padding: 12px 18px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -2px; display: flex; gap: 7px; align-items: center;
}
.editor-tab:hover { color: var(--charcoal); }
.editor-tab.active { color: var(--coral); border-bottom-color: var(--coral); }
.tab-done { color: var(--forest); font-size: 13px; animation: pop .3s ease; }
.editor-paper {
  background: #fff; border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow); padding: 36px 44px; position: relative;
}
.editor-paper::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 28px; width: 1px; background: rgba(232,97,77,.25);
}
.editor-paper textarea {
  width: 100%; min-height: 340px; border: none; resize: vertical; font-size: 15px;
  line-height: 32px; background: var(--ruled); background-attachment: local; padding-left: 12px;
}
.editor-paper textarea:focus { outline: none; }
.section-hint { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 12px; font-style: italic; }
.mark-done-row { margin-top: 16px; display: flex; justify-content: flex-end; }

/* ── Calendar ── */
.week-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.week-nav h2 { font-size: 20px; }
.cal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 220px; }
.cal-day.today { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.cal-day-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.cal-day-date { font-family: var(--display); font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.cal-plan {
  background: var(--buttercream); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 12.5px; margin-bottom: 8px; cursor: pointer; transition: transform .15s ease;
}
.cal-plan:hover { transform: translateY(-2px); }
.cal-plan strong { display: block; font-size: 13px; }
.cal-empty { font-size: 12px; color: var(--ink-soft); font-style: italic; }

/* ── Library ── */
.lib-toolbar { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.lib-toolbar .text-input { max-width: 320px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.lib-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.lib-card h3 { font-size: 17px; }
.lib-author { font-size: 12.5px; color: var(--ink-soft); }
.lib-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-soft); margin-top: auto; padding-top: 10px; }

/* ── Templates ── */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.pack-card {
  border-radius: 18px; padding: 26px; color: #fff; display: flex; flex-direction: column; gap: 8px;
  min-height: 200px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.pack-card h3 { font-size: 21px; }
.pack-card p { font-size: 13.5px; opacity: .92; flex: 1; }
.pack-price { font-weight: 700; font-size: 14px; }
.pack-card .btn { align-self: flex-start; background: #fff; }
.pack-premium-tag { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.25); border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 700; }

/* ── Billing ── */
.price-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 760px; }
.price-card { background: var(--card); border: 1.5px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.price-card.hero { border-color: var(--coral); position: relative; }
.price-card .badge { position: absolute; top: -13px; left: 28px; background: var(--coral); color: #fff; font-size: 11.5px; font-weight: 700; padding: 5px 14px; border-radius: 999px; }
.price-num { font-family: var(--display); font-size: 44px; font-weight: 900; }
.price-num small { font-size: 15px; font-weight: 500; color: var(--ink-soft); font-family: var(--body); }
.price-feats { list-style: none; margin: 20px 0 26px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.price-feats li::before { content: "✓  "; color: var(--forest); font-weight: 700; }

/* ── Profile ── */
.profile-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); margin-bottom: 28px; display: flex; gap: 20px; align-items: center; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--coral); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 26px; font-weight: 700; }
.plan-rows { display: flex; flex-direction: column; gap: 12px; }
.plan-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.plan-row .grow { flex: 1; }
.plan-row h3 { font-size: 16px; }
.plan-row .meta { font-size: 12.5px; color: var(--ink-soft); }

/* ── Export / print ── */
.export-sheet {
  background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow);
  max-width: 740px; padding: 56px 64px; margin-top: 8px;
}
.export-sheet h1 { font-size: 28px; margin-bottom: 4px; }
.export-sheet .export-meta { font-size: 13px; color: var(--ink-soft); margin-bottom: 24px; }
.export-sheet h2 { font-size: 17px; margin: 26px 0 8px; color: var(--coral); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.export-sheet .body-text { white-space: pre-wrap; font-size: 14px; }
.export-bar { display: flex; gap: 12px; margin-bottom: 20px; }

/* ── Empty states / toast ── */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-soft); }
.empty .big { font-size: 44px; margin-bottom: 12px; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 80px); background: var(--charcoal);
  color: #fff; padding: 13px 24px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; transition: all .3s ease; z-index: 99; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .sidebar-brand { padding: 0 12px 0 0; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-nav a { padding: 8px 12px; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 24px 18px; }
  .cal-grid { grid-template-columns: 1fr; }
  .gen-row, .price-cards { grid-template-columns: 1fr; }
  .editor-paper { padding: 24px 20px; }
  .onboard-card { padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Print (PDF export) ── */
@media print {
  .sidebar, .export-bar, .toast, .page-head p { display: none !important; }
  .main { padding: 0; max-width: none; }
  .export-sheet { box-shadow: none; border: none; padding: 0; max-width: none; }
  body, html { background: #fff; }
}
