/* ==========================================================================
   YouTube Automation Academy — offline course site v2
   Light, clean classroom layout: left sidebar + white content card.
   Fully offline: system fonts, no external resources.
   ========================================================================== */

:root {
  --bg: #f3f3f4;
  --card: #ffffff;
  --border: #e7e7ea;
  --border-2: #dcdce0;
  --text: #24262a;
  --text-2: #5d5f66;
  --text-3: #93959c;
  --green: #16a34a;
  --green-dark: #13833c;
  --green-soft: #e5f5eb;
  --cream: #fdf0d5;
  --cream-2: #f7e7bd;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(23, 24, 28, .04), 0 3px 12px rgba(23, 24, 28, .05);
  --shadow-hover: 0 2px 5px rgba(23, 24, 28, .06), 0 10px 26px rgba(23, 24, 28, .09);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: #cfe9d8; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

svg { display: block; }

/* ==========================================================================
   LAYOUT: sidebar + content (module & lesson pages)
   ========================================================================== */
.layout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

.content-col {
  padding: 26px 26px 60px 30px;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 14px 28px 20px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: #c9c9cf transparent;
}
.sidebar::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-thumb { background: #cfcfd6; border-radius: 8px; border: 3px solid var(--bg); }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sb-head { padding: 2px 8px 16px; }
.sb-course {
  display: block;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.25;
  color: var(--text);
}
.sb-course:hover { color: var(--green-dark); }
.sb-course .dot { color: var(--green); }

.sb-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pct-pill {
  flex: none;
  background: var(--green);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  border-radius: 999px;
  padding: 3px 9px;
  line-height: 1.2;
}
.track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #e3e3e7;
  overflow: hidden;
}
.track .fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 999px;
  transition: width .45s ease;
}
.sb-progress.done .pct-pill { background: var(--green-dark); }

/* module groups */
.sb-nav { border-top: 1px solid var(--border); padding-top: 12px; padding-bottom: 26px; }

.sb-group { margin-bottom: 2px; }
.sb-group-head {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px 9px 10px;
  border-radius: var(--radius-s);
  text-align: left;
}
.sb-group-head:hover { background: #ebebee; }
.sb-group-head.is-active { background: var(--cream); }
.sb-group-head.is-active:hover { background: var(--cream-2); }
.sbg-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.sbg-count {
  flex: none;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: #ebebee;
  border-radius: 999px;
  padding: 2px 8px;
}
.sbg-count.has-progress { background: var(--green-soft); color: var(--green-dark); }
.sbg-chevron { flex: none; margin-top: 3px; color: var(--text-3); transition: transform .2s ease; }
.sb-group.is-open .sbg-chevron { transform: rotate(90deg); }

.sb-lessons {
  display: none;
  padding: 2px 0 8px 6px;
}
.sb-group.is-open .sb-lessons { display: block; }

.sb-lesson {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-s);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.35;
}
.sb-lesson:hover { background: #ebebee; color: var(--text); }
.sb-lesson .sbl-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sb-lesson .sbl-ico { flex: none; width: 15px; height: 15px; color: #b6b8bf; }
.sb-lesson .sbl-ico svg, .sb-vt .sbl-ico svg { width: 15px; height: 15px; }
.sbl-ico .ico-check { display: none; color: var(--green); }
.sb-lesson.is-done .sbl-ico .ico-check, .sb-vt.is-done .sbl-ico .ico-check { display: block; }
.sb-lesson.is-done .sbl-ico .ico-dot, .sb-lesson.is-done .sbl-ico .ico-play,
.sb-vt.is-done .sbl-ico .ico-dot, .sb-vt.is-done .sbl-ico .ico-play { display: none; }
.sb-lesson.is-done { color: var(--text-2); }
.sb-lesson.is-active .sbl-ico .ico-check { color: #8a6d1a; }
.sb-lesson.is-active {
  background: var(--cream);
  color: var(--text);
  font-weight: 650;
}
.sb-lesson.is-active:hover { background: var(--cream-2); }
.sb-lesson.is-active .sbl-title { color: #3a3010; }

/* video tutorial final item */
.sb-vt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  padding: 10px 10px;
  border-radius: var(--radius-s);
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13.5px;
  font-weight: 700;
}
.sb-vt:hover { background: #d6efdf; }
.sb-vt .sbl-ico { width: 16px; height: 16px; flex: none; }
.sb-vt .sbl-title { flex: 1; }
.sb-vt.is-active { outline: 2px solid var(--green); outline-offset: -2px; }

/* ==========================================================================
   Mobile top bar + drawer
   ========================================================================== */
.topbar { display: none; }

@media (max-width: 940px) {
  .layout { display: block; min-height: auto; }
  .content-col { padding: 14px 14px 44px; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  .topbar .tb-menu {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg);
    display: grid;
    place-items: center;
    color: var(--text);
  }
  .topbar .tb-menu:active { background: var(--border); }
  .topbar .tb-menu svg { width: 20px; height: 20px; }
  .topbar .tb-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .tb-home {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg);
    display: grid;
    place-items: center;
    color: var(--text-2);
  }
  .topbar .tb-home svg { width: 19px; height: 19px; }

  .sb-head { padding: 2px 44px 16px 8px; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 302px;
    max-width: 86vw;
    z-index: 60;
    background: #fff;
    border-right: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(20, 21, 26, .18);
    transform: translateX(-104%);
    transition: transform .28s ease;
    padding-top: 16px;
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .sb-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-2);
  }
  .sb-close svg { width: 17px; height: 17px; }

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(22, 23, 26, .42);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  body.nav-open .backdrop { opacity: 1; pointer-events: auto; }
}

@media (min-width: 941px) {
  .sb-close { display: none; }
  .backdrop { display: none; }
}

/* ==========================================================================
   White page card (module + lesson content)
   ========================================================================== */
.page-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 30px 30px;
}

@media (max-width: 940px) {
  .page-card { padding: 18px 16px 22px; border-radius: 12px; }
}

/* crumb */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 6px;
}
.crumb a:hover { color: var(--green-dark); }
.crumb .crumb-sep { color: var(--border-2); }

/* lesson header */
.lesson-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.lesson-head h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
}
@media (max-width: 940px) { .lesson-head h1 { font-size: 21px; } }

/* circular complete toggle (top-right, like the reference) */
.done-toggle {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  background: #fff;
  display: grid;
  place-items: center;
  color: #c3c4c9;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.done-toggle svg { width: 18px; height: 18px; }
.done-toggle:hover { border-color: var(--green); color: var(--green); }
.done-toggle:active { transform: scale(.94); }
.done-toggle.is-done {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ==========================================================================
   Video embed (poster facade -> Google Drive iframe on click)
   ========================================================================== */
.video-embed {
  position: relative;
  margin: 4px 0 22px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #101114;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.video-embed img.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}
@media (hover: hover) {
  .video-embed:hover img.poster { transform: scale(1.025); filter: brightness(1.08); }
}
.v-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(14, 15, 18, .78);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: .02em;
}
.v-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(12, 13, 16, .58);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .25), 0 6px 18px rgba(0, 0, 0, .25);
  transition: transform .18s ease, background .18s ease;
}
.v-play svg { width: 26px; height: 26px; margin-left: 3px; }
@media (hover: hover) {
  .video-embed:hover .v-play { transform: translate(-50%, -50%) scale(1.07); background: rgba(12, 13, 16, .74); }
}
.video-embed.is-loaded { cursor: default; }
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.v-note {
  margin: -12px 0 22px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ==========================================================================
   Lesson content typography
   ========================================================================== */
.content {
  font-size: 16px;
  line-height: 1.72;
  color: #33312e;
  word-wrap: break-word;
}
.content p { margin: 0 0 1.05em; }
.content p:last-child { margin-bottom: 0; }
.content h3 {
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -.014em;
  margin: 1.6em 0 .55em;
  line-height: 1.3;
}
.content h4 {
  font-size: 16.5px;
  font-weight: 720;
  margin: 1.5em 0 .5em;
  letter-spacing: -.008em;
}
.content h3:first-child, .content h4:first-child { margin-top: .2em; }
.content ul, .content ol { margin: 0 0 1.1em; padding-left: 1.45em; }
.content li { margin: .42em 0; }
.content li p { margin: 0; display: inline; }
.content strong { font-weight: 680; color: #161514; }
.content em { font-style: italic; }
.content a {
  color: #0f7a3d;
  font-weight: 560;
  text-decoration: underline;
  text-decoration-color: #bfe3cd;
  text-underline-offset: 2.5px;
}
.content a:hover { color: #0b5c2f; background: #e9f7ef; }
.content img {
  border-radius: 10px;
  margin: 1.15em 0;
  border: 1px solid #e8e5e0;
  max-width: 100%;
  height: auto;
}
.content blockquote {
  margin: 1.2em 0;
  padding: 14px 18px;
  background: #f7f5f1;
  border-left: 4px solid var(--green);
  border-radius: 0 10px 10px 0;
  color: #40403d;
}
.content blockquote p { margin: 0 0 .5em; }
.content blockquote p:last-child { margin-bottom: 0; }
.content blockquote strong { color: #1c3a26; }
.content hr { border: none; border-top: 1px solid #e7e4df; margin: 1.6em 0; }

@media (max-width: 940px) {
  .content { font-size: 15.5px; }
}

/* missing lesson notice (light, not dark) */
.missing-note {
  margin: 6px 0 10px;
  padding: 18px 20px;
  background: #fdf6e3;
  border: 1px solid #eddbaa;
  border-left: 4px solid #d9b83c;
  border-radius: 10px;
  color: #5d4d1c;
  font-size: 15px;
}
.missing-note strong { color: #4a3d13; }

/* ==========================================================================
   Lesson actions + prev/next navigation
   ========================================================================== */
.lesson-actions { margin: 26px 0 4px; }
.complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--green);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.complete-btn svg { width: 16px; height: 16px; }
.complete-btn .cb-do { display: inline-flex; align-items: center; gap: 8px; }
.complete-btn:hover { background: var(--green-soft); box-shadow: var(--shadow); }
.complete-btn:active { transform: translateY(1px); }
.complete-btn.is-done {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.complete-btn.is-done:hover { background: var(--green-dark); }
.cb-done { display: none; }
.complete-btn.is-done .cb-do { display: none; }
.complete-btn.is-done .cb-done { display: inline-flex; align-items: center; gap: 8px; }

.lesson-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.nav-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: #fff;
  box-shadow: var(--shadow);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.nav-link:hover { border-color: #bfbfc6; box-shadow: var(--shadow-hover); }
.nav-link.next { text-align: right; }
.nav-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-label svg { width: 13px; height: 13px; }
.nav-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 700px) {
  .lesson-nav { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Module page
   ========================================================================== */
.cat-banner {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.cat-banner img { width: 100%; height: 230px; object-fit: cover; }
@media (max-width: 940px) { .cat-banner img { height: 140px; } }

.cat-head { margin: 0 0 6px; padding: 0 2px; }
.cat-head h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.cat-desc {
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 15px;
  max-width: 640px;
}
.cat-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  max-width: 420px;
}
.cat-progress .card-count {
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 600;
  flex: none;
}

/* lesson rows */
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { margin: 0; }
.lesson-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: var(--radius-s);
  transition: background .14s ease;
}
.lesson-row:hover { background: #f4f4f6; }
.lesson-row + .lesson-row { margin-top: 2px; }
.lesson-row .num {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #f0f0f2;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 50%;
}
.lesson-row.is-done .num { background: var(--green-soft); color: var(--green-dark); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  display: block;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}
.row-sub { display: block; margin-top: 3px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 650;
  border-radius: 999px;
  padding: 2.5px 9px;
  background: #f0f0f2;
  color: var(--text-2);
}
.tag svg { width: 11px; height: 11px; }
.tag-video { background: var(--green-soft); color: var(--green-dark); }
.tag-missing { background: #fdf6e3; color: #8a6d1a; }
.row-check { flex: none; width: 18px; height: 18px; color: #d4d5da; }
.lesson-row.is-done .row-check { color: var(--green); }
.row-arrow { flex: none; color: #c0c1c7; }
.row-arrow svg { width: 16px; height: 16px; }
.lesson-row:hover .row-arrow { color: var(--text-2); }

/* ==========================================================================
   HOMEPAGE — course collection
   ========================================================================== */
.home-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 30px 24px 70px;
}
.site-head { padding: 6px 2px 24px; }
.site-title {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.site-title .dot { color: var(--green); }
.site-sub {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text-3);
  font-weight: 550;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 18px;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #d3d3d9;
  transform: translateY(-2px);
}
.card-img { position: relative; aspect-ratio: 1400 / 721; overflow: hidden; }
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.card:hover .card-img img { transform: scale(1.03); }
.card-img .vt-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 16, 20, .72);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.card-img .vt-badge svg { width: 11px; height: 11px; }
.card-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 750;
  letter-spacing: -.012em;
  line-height: 1.3;
}
.card-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-progress {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-progress .card-count {
  flex: none;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}
.card-progress .track { height: 7px; }

@media (max-width: 640px) {
  .home-wrap { padding: 22px 14px 54px; }
  .site-head { padding: 2px 0 16px; }
  .site-title { font-size: 19.5px; }
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
}

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