/* ============================================================
   English Sentence Practice — Lesson pages (Stages 1–2)
   W3Schools-style layout: sticky lesson sidebar + content.
   Loaded only by blog/post.php, so other pages stay untouched.
   Brand green #28a745 matches the site theme-color.
   No JavaScript needed — pure CSS layout.
   ============================================================ */

.lesson-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 60vh;
}

/* ---------- Sidebar ---------- */
.lesson-sidebar {
  flex: 0 0 264px;
  width: 264px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 0 30px;
}

.lesson-sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 18px 14px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 10px;
}

.lesson-sidebar-head a {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
}

.lesson-sidebar-head a:hover { color: #28a745; }

.lesson-sidebar-head span {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

.lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #334155;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  border-left: 3px solid transparent;
}

.lesson-list a:hover {
  background: #eef2f7;
  color: #1e293b;
}

.lesson-list a.active {
  background: #e6f7ec;
  border-left-color: #28a745;
  color: #14532d;
  font-weight: 600;
}

.lesson-num {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lesson-list a.active .lesson-num {
  background: #28a745;
  color: #fff;
}

.lesson-title { overflow: hidden; }

.lesson-sidebar-empty {
  padding: 10px 18px;
  color: #94a3b8;
  font-size: 14px;
}

.lesson-sidebar-links {
  margin-top: 22px;
  padding: 16px 18px 0;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-sidebar-links a {
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
}

.lesson-sidebar-links a:hover { text-decoration: underline; }

/* ---------- Main content ---------- */
.lesson-main {
  flex: 1;
  min-width: 0;
  max-width: 780px;
  padding: 28px 40px 70px;
}

.lesson-crumbs {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 18px;
}

.lesson-crumbs a { color: #2563eb; text-decoration: none; }
.lesson-crumbs a:hover { text-decoration: underline; }
.lesson-crumbs span { margin: 0 4px; }

.lesson-eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #28a745;
  margin: 0 0 8px;
}

.lesson-main h1 {
  font-size: 32px;
  line-height: 1.25;
  color: #1e293b;
  margin: 0 0 10px;
}

.lesson-meta {
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 22px;
}

.lesson-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 28px;
  display: block;
}

/* Lesson body (admin HTML) */
.lesson-content {
  font-size: 17px;
  line-height: 1.8;
  color: #1e293b;
  overflow-wrap: break-word;
}

.lesson-content p { margin: 0 0 18px; }
.lesson-content h2 { font-size: 24px; margin: 34px 0 12px; }
.lesson-content h3 { font-size: 20px; margin: 28px 0 10px; }
.lesson-content ul, .lesson-content ol { margin: 0 0 18px 22px; }
.lesson-content li { margin-bottom: 8px; }
.lesson-content img { max-width: 100%; height: auto; border-radius: 8px; }
.lesson-content table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 15px; }
.lesson-content th, .lesson-content td { border: 1px solid #e2e8f0; padding: 9px 12px; text-align: left; }
.lesson-content th { background: #f8fafc; }
.lesson-content blockquote {
  border-left: 4px solid #28a745;
  background: #f8fafc;
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
}
.lesson-content a { color: #2563eb; }

/* ---------- Prev / Next ---------- */
.lesson-prevnext {
  display: flex;
  gap: 14px;
  margin: 44px 0 10px;
}

.lesson-prevnext > span { flex: 1; }

.lesson-nav-card {
  flex: 1;
  display: block;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: #1e293b;
}

.lesson-nav-card:hover { border-color: #28a745; }

.lesson-nav-card span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #28a745;
  margin-bottom: 5px;
}

.lesson-nav-card strong { font-size: 15px; line-height: 1.4; }
.lesson-nav-card.next { text-align: right; }

/* ---------- Related lessons ---------- */
.lesson-related { margin-top: 40px; }
.lesson-related h2 { font-size: 21px; margin: 0 0 14px; color: #1e293b; }

.lesson-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.lesson-related-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: #1e293b;
  display: block;
}

.lesson-related-card:hover { border-color: #28a745; }

.lesson-related-num {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #28a745;
  margin-bottom: 6px;
}

.lesson-related-card strong { font-size: 15px; line-height: 1.45; }

/* ---------- Buttons ---------- */
.lesson-btn {
  display: inline-block;
  margin-top: 26px;
  background: #28a745;
  color: #fff !important;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  padding: 11px 20px;
  border-radius: 8px;
}

.lesson-btn:hover { background: #218838; }

/* ---------- 404 page ---------- */
.notfound-wrap {
  max-width: 640px;
  margin: 70px auto;
  padding: 0 20px 70px;
  text-align: center;
}

.notfound-wrap h1 { font-size: 30px; color: #1e293b; margin-bottom: 12px; }
.notfound-wrap p { color: #64748b; font-size: 16px; line-height: 1.7; }

.notfound-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 26px;
}

.notfound-links a {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 16px;
  color: #2563eb;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.notfound-links a:hover { border-color: #28a745; }

.notfound-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 20px;
  border-top: 1px solid #e2e8f0;
}

.notfound-footer a { color: #2563eb; text-decoration: none; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .lesson-layout { flex-direction: column; }

  .lesson-sidebar {
    flex: none;
    width: 100%;
    height: auto;
    max-height: 250px;
    position: static;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 0;
  }

  .lesson-main { padding: 22px 20px 60px; max-width: 100%; }
  .lesson-main h1 { font-size: 26px; }
  .lesson-content { font-size: 16px; }
  .lesson-prevnext { flex-direction: column; }
  .lesson-nav-card.next { text-align: left; }
}

/* ============================================================
   Stage 2 — Lessons hub, homepage lessons, quiz template
   ============================================================ */

/* ---------- Lessons hub ---------- */
.hub-intro {
  color: #475569;
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 24px;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.hub-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hub-card:hover { border-color: #28a745; }

.hub-card-img img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #f1f5f9;
}

.hub-card-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }

.hub-card-num {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #28a745;
  margin-bottom: 6px;
}

.hub-card h2 { font-size: 17px; line-height: 1.4; margin: 0 0 8px; }
.hub-card h2 a { color: #1e293b; text-decoration: none; }
.hub-card h2 a:hover { color: #28a745; }

.hub-card p { font-size: 14px; color: #64748b; line-height: 1.55; margin: 0 0 12px; flex: 1; }

.hub-card-meta { font-size: 13px; color: #94a3b8; }
.hub-card-meta a { color: #2563eb; text-decoration: none; font-weight: 600; }
.hub-card-meta a:hover { text-decoration: underline; }

.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 34px 0 10px;
}

.blog-pagination a {
  padding: 8px 14px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1e293b;
  text-decoration: none;
  font-size: 14px;
}

.blog-pagination a.active { background: #28a745; color: #fff; }

.blog-empty { text-align: center; padding: 70px 20px; color: #94a3b8; }

/* ---------- Homepage lessons section ---------- */
.home-lessons {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 28px;
  margin: 34px 0;
}

.home-lessons h2 { margin-top: 0; }
.home-lessons > p { color: #475569; line-height: 1.7; }

.home-lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 20px 0 6px;
}

.home-lesson-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: #1e293b;
  display: block;
}

.home-lesson-card:hover { border-color: #28a745; }

.home-lesson-num {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #28a745;
  margin-bottom: 6px;
}

.home-lesson-card strong { font-size: 15px; line-height: 1.45; display: block; }

.home-lesson-ex {
  display: block;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin-top: 6px;
}

/* ---------- Quiz template additions ---------- */
.quiz-crumbs {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 14px;
}

.quiz-crumbs a { color: #2563eb; text-decoration: none; }
.quiz-crumbs a:hover { text-decoration: underline; }
.quiz-crumbs span { margin: 0 4px; }

.quiz-howto {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 14px;
  color: #475569;
  margin: 6px 0 20px;
}

.quiz-howto strong { color: #28a745; }

.lessons-cta {
  background: #e6f7ec;
  border: 1px solid #bbe7c8;
  border-radius: 12px;
  padding: 24px 26px;
  margin: 34px 0 10px;
}

.lessons-cta h2 { margin: 0 0 8px; font-size: 21px; color: #14532d; }
.lessons-cta p { color: #475569; line-height: 1.65; margin: 0 0 12px; }
.lessons-cta .lesson-btn { margin-top: 4px; }

@media (max-width: 900px) {
  .home-lessons { padding: 20px; }
}
