/* Курс «Английский с нуля за 20 уроков»: плашка урока, аудио, упражнения, навигация.
   Подключается только на страницах уроков и хаба (templates/articles/post_detail.html). */

/* ---------- Плашка «Урок N из 20» ---------- */
.bg-badge { max-width: 520px; margin-bottom: 16px; }
.bg-badge-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.bg-badge-course {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: #edf9f1; color: #198754; font-size: 13px; font-weight: 700;
  text-decoration: none;
}
.bg-badge-course:hover { background: #dff3e7; color: #146c43; }
.bg-badge-num { font-size: 13px; font-weight: 700; color: #5b6b62; }
.bg-progress { height: 6px; border-radius: 999px; background: #e3efe7; overflow: hidden; }
.bg-progress span { display: block; height: 100%; border-radius: 999px; background: #198754; }

/* ---------- Текст урока ---------- */
.bg-course .bg-answer { font-size: 1.1em; color: #17231d; }
.bg-course h2 { scroll-margin-top: 80px; }
.bg-course [lang="en"] { font-family: inherit; }

.bg-box {
  background: #f6f8f7; border-radius: 18px; padding: 16px 20px; margin: 22px 0;
}
.bg-box > :last-child { margin-bottom: 0; }
.bg-box-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: #198754; margin-bottom: 10px;
}
.bg-learn { background: linear-gradient(135deg, #e9f8ef 0%, #fdf6e7 100%); border: 1px solid #dcefe3; }
.bg-learn ul { margin: 0; }
.bg-tip { background: #e7f0ff; }
.bg-tip .bg-box-title { color: #0d6efd; }
.bg-remember { background: #fffaf0; border: 2px dashed #f0c36d; }
.bg-remember .bg-box-title { color: #a85d00; }

/* ---------- Кнопка ▶ (аудио) ---------- */
.bg-say {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: 0 0 30px;
  margin: 0 4px; padding: 0; vertical-align: middle;
  border: 0; border-radius: 50%;
  background: #198754; color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.bg-say::before {
  content: ""; width: 0; height: 0; margin-left: 3px;
  border-left: 10px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.bg-say:hover { background: #146c43; transform: scale(1.08); }
.bg-say:focus-visible { outline: 3px solid #9fd8b8; outline-offset: 2px; }
.bg-say.is-playing { background: #d9480f; }
.bg-say.is-playing::before { width: 10px; height: 10px; margin-left: 0; border: 0; background: #fff; border-radius: 2px; }

/* ---------- Таблицы ---------- */
.bg-table-wrap { overflow-x: auto; border: 1px solid #e3efe7; border-radius: 16px; margin: 0 0 20px; }
.bg-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; margin: 0; }
.bg-table th {
  padding: 10px 12px; text-align: left; font-size: 14px; color: #fff; background: #198754; white-space: nowrap;
}
.bg-table td { padding: 8px 12px; border-top: 1px solid #e3efe7; vertical-align: middle; }
.bg-table tr:nth-child(even) td { background: #fafcfb; }
.bg-table .bg-big { font-size: 22px; font-weight: 800; color: #17231d; white-space: nowrap; }
.bg-table .bg-tr { color: #6f42c1; white-space: nowrap; }
.bg-table .bg-ru { color: #5b6b62; }
.bg-table td.bg-play { width: 44px; text-align: center; }

/* ---------- Примеры: английский + ▶ + перевод ---------- */
.bg-examples { list-style: none; padding: 0 !important; margin: 0 0 18px; }
.bg-examples li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid #eef3f0; margin: 0 !important;
}
.bg-examples li:last-child { border-bottom: 0; }
.bg-examples .bg-say { margin: 0; }
.bg-examples .bg-ex-text { flex: 1; min-width: 0; }
.bg-examples .bg-en { display: block; font-weight: 600; color: #17231d; }
.bg-examples .bg-ru { display: block; font-size: 15px; color: #5b6b62; }

/* ---------- Диалог ---------- */
.bg-dialog { border-left: 4px solid #198754; padding-left: 14px; margin: 0 0 18px; }
.bg-dialog .bg-examples li { border-bottom: 0; padding: 5px 0; }
.bg-who { font-weight: 800; color: #198754; margin-right: 4px; }

/* ---------- Частые ошибки ---------- */
.bg-mistakes { list-style: none; padding: 0 !important; margin: 0 0 18px; }
.bg-mistakes li { padding: 10px 14px; border-radius: 14px; background: #fafcfb; border: 1px solid #eef3f0; margin-bottom: 10px !important; }
.bg-wrong { color: #b02a37; text-decoration: line-through; text-decoration-thickness: 1px; font-weight: 600; }
.bg-right { color: #146c43; font-weight: 700; }
.bg-mistakes small { display: block; color: #5b6b62; font-size: 14px; margin-top: 4px; }

/* ---------- Упражнение ---------- */
.bg-exercise { background: #fff; border: 1px solid #e3efe7; border-radius: 20px; padding: 18px 20px; margin: 22px 0; box-shadow: 0 6px 18px rgba(15, 80, 50, .06); }
.bg-exercise ol { margin-bottom: 14px; }
.bg-exercise li { margin-bottom: 8px; }
.bg-gap { display: inline-block; min-width: 54px; border-bottom: 2px solid #9fd8b8; margin: 0 2px; }
.bg-course details {
  border: 1px solid #dcefe3; border-radius: 14px; padding: 10px 14px; margin: 0 0 12px; background: #f6fbf8;
}
.bg-course details > summary { cursor: pointer; font-weight: 700; color: #198754; }
.bg-course details[open] > summary { margin-bottom: 8px; }
.bg-course details ol, .bg-course details ul { margin-bottom: 0; }

/* ---------- FAQ ---------- */
.bg-faq details { background: #fff; }
.bg-faq details > summary { color: #17231d; }

/* ---------- Призыв ---------- */
.bg-cta {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(135deg, #e9f8ef 0%, #e7f0ff 100%);
  border-radius: 20px; padding: 18px 20px; margin: 26px 0;
}
.bg-cta-text { flex: 1 1 260px; }
.bg-cta-text strong { display: block; font-size: 17px; }
.bg-course .bg-cta a.bg-cta-btn {
  display: inline-block; padding: 9px 16px; border-radius: 999px; border: 0;
  background: #198754; color: #fff; font-weight: 700; white-space: nowrap;
}
.bg-course .bg-cta a.bg-cta-btn:hover { background: #146c43; }

/* ---------- Оглавление в хабе ---------- */
.bg-lessons { list-style: none; padding: 0 !important; margin: 8px 0 12px; counter-reset: none; }
.bg-lessons .bg-lesson {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 0 0 6px !important;
  border: 1px solid #e3efe7; border-radius: 14px; background: #fff;
}
.bg-lesson-num {
  flex: 0 0 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #198754; color: #fff; font-weight: 800; font-size: 14px;
}
.bg-lesson a { flex: 1; font-weight: 600; border-bottom: 0 !important; }
.bg-lesson-soon { background: #fafcfb; }
.bg-lesson-soon .bg-lesson-num { background: #c9d6cf; }
.bg-lesson-title { flex: 1; color: #5b6b62; }
.bg-lesson-tag { font-size: 12px; font-weight: 700; color: #a85d00; background: #fdf3e1; border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.bg-lessons-note { font-size: 15px; color: #5b6b62; }

/* ---------- Навигация между уроками ---------- */
.bg-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch;
  margin: 32px 0 8px; padding-top: 20px; border-top: 1px solid #e3efe7;
}
.bg-nav-first .bg-nav-next { grid-column: 1 / -1; }
.bg-nav-btn, .bg-nav-soon {
  display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 100%; min-height: 76px;
  padding: 12px 18px; border-radius: 16px; border: 1px solid #dcefe3; background: #fff;
  color: #17231d; text-decoration: none; transition: border-color .15s ease, background .15s ease;
}
.bg-nav-btn:hover { border-color: #198754; background: #f6fbf8; color: #17231d; }
.bg-nav-btn small, .bg-nav-soon small { font-size: 13px; font-weight: 700; color: #5b6b62; }
.bg-nav-btn span { font-weight: 600; line-height: 1.3; }
.bg-nav-btn-main { background: #198754; border-color: #198754; color: #fff; }
.bg-nav-btn-main small { color: #d8f3e4; }
.bg-nav-btn-main:hover { background: #146c43; border-color: #146c43; color: #fff; }
.bg-nav-next { text-align: right; }
.bg-nav-first .bg-nav-next { text-align: left; }
.bg-nav-soon { background: #fafcfb; }
.bg-nav-soon a { font-weight: 700; color: #198754; text-decoration: none; }
.bg-nav-all { grid-column: 1 / -1; display: flex; justify-content: center; }
.bg-nav-all-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 18px; border-radius: 16px;
  border: 1px solid #dcefe3; background: #f6fbf8; color: #198754; font-weight: 700; text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.bg-nav-all-btn:hover { border-color: #198754; background: #edf9f1; color: #146c43; }

@media (max-width: 640px) {
  .bg-nav { grid-template-columns: 1fr; }
  .bg-nav-next { order: -1; text-align: left; }
  .bg-table { font-size: 14px; }
  .bg-table th, .bg-table td { padding: 7px 8px; }
  .bg-table .bg-big { font-size: 19px; }
  .bg-exercise, .bg-box { padding: 14px 14px; }
}

/* Ссылка на ещё не вышедший урок показывается простым текстом */
.bg-soon-link { border-bottom: 1px dashed #c9d6cf; cursor: help; }
