/* ──────────────────────────────────────────────────────────────────────────
   Shared stylesheet for ELA unit menu/index pages.
   Per-page theme via CSS custom properties set by index-engine.js:
     --hgrad-start, --hgrad-end  → header gradient
     --toggle                    → toggle switch when checked
   ────────────────────────────────────────────────────────────────────────── */
:root { --hgrad-start: #3C3489; --hgrad-end: #6C5CE7; --toggle: #3C3489; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f4f6fa; min-height: 100vh; }

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--hgrad-start) 0%, var(--hgrad-end) 100%);
  color: white; padding: 36px 24px 28px; text-align: center; position: relative;
}
.title-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
header h1 { font-size: 2.2rem; letter-spacing: .5px; margin-bottom: 0; }
header p  { font-size: 1rem; opacity: .85; }

#teacherBtn {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.45);
  color: white; padding: 7px 13px; border-radius: 8px; cursor: pointer;
  font-size: .85rem; display: flex; align-items: center; gap: 6px; transition: background .2s;
}
#teacherBtn:hover { background: rgba(255,255,255,.30); }

.unit-link {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.45);
  color: white; padding: 7px 13px; border-radius: 8px; font-size: .85rem;
  text-decoration: none; transition: background .2s; white-space: nowrap;
}
.unit-link:hover { background: rgba(255,255,255,.30); }

/* ── Teacher panel ── */
#teacherPanel { display: none; background: #fff8e1; border-bottom: 2px dashed #f0c040; padding: 18px 32px 20px; }
#teacherPanel.open { display: block; }
#teacherPanel h2 { font-size: 1rem; color: #7a5800; margin-bottom: 12px; }
.tp-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: white; border: 1px solid #e8e0c8; border-radius: 8px; margin-bottom: 8px; max-width: 600px; }
.tp-row label { flex: 1; font-size: .95rem; color: #333; cursor: pointer; }
.tp-row .tp-topic { font-size: .8rem; color: #888; margin-left: 4px; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; transition: .3s; }
.slider:before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--toggle); }
input:checked + .slider:before { transform: translateX(20px); }

/* ── Card grid ── */
main { max-width: 860px; margin: 36px auto; padding: 0 20px; }
#cardGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }

.card {
  background: white; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.08);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .18s, box-shadow .18s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.13); }
.card-banner { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 2.8rem; }
.card-body { padding: 16px 18px 20px; flex: 1; }
.card-body h3 { font-size: 1.05rem; margin-bottom: 6px; color: #222; }
.card-body p  { font-size: .84rem; color: #666; line-height: 1.5; }
.card-tag { display: inline-block; margin-top: 10px; font-size: .75rem; padding: 3px 9px; border-radius: 20px; font-weight: 600; letter-spacing: .3px; }

#emptyMsg { display: none; text-align: center; color: #aaa; padding: 60px 20px; font-size: 1rem; }
#emptyMsg span { font-size: 2.5rem; display: block; margin-bottom: 10px; }
