/* ================================================================
   Canvas LMS–inspired design system — index / course home page
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

:root {
  --nav-bg:          #394B59;
  --course-color:    #2B7A6F;
  --course-dark:     #1F6059;
  --link:            #0770A3;
  --bg:              #F2F2F2;
  --white:           #FFFFFF;
  --text:            #2D2D2D;
  --muted:           #5F6E7A;
  --border:          #C7CDD1;
  --border-light:    #E5E9EC;
  --green:           #127A2A;
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.10);
  --shadow:          0 2px 8px rgba(0,0,0,0.10);
  --radius:          4px;
  --radius-md:       6px;
  --radius-lg:       8px;
  --sidenav-w:       200px;
  --topbar-h:        56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Lato", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ────────────────────────────────────────── */
.canvas-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  z-index: 200;
  box-shadow: 0 2px 4px rgba(0,0,0,0.28);
}

.topbar-brand {
  width: var(--sidenav-w);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-brand-icon {
  width: 34px; height: 34px;
  background: var(--course-color);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.topbar-brand-name {
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}

.topbar-crumb {
  flex: 1;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.topbar-crumb a { color: rgba(255,255,255,0.8); text-decoration: none; }
.topbar-crumb a:hover { color: white; text-decoration: underline; }
.topbar-crumb .sep { color: rgba(255,255,255,0.35); }
.topbar-crumb .current { color: rgba(255,255,255,0.95); font-weight: 700; }

.topbar-right {
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #5A8FA3;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  cursor: pointer;
  user-select: none;
}

/* ── Shell Layout ───────────────────────────────────── */
.canvas-shell {
  display: block;
  min-height: 100vh;
  padding-top: 0;
}

/* ── Botão Voltar (dentro do header) ────────────────── */
.banner-back {
  position: absolute;
  top: 14px;
  right: 32px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: var(--radius-md, 6px);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.12s;
}
.banner-back:hover { background: rgba(255,255,255,0.3); text-decoration: none; color: #fff; }

/* ── Sidenav ────────────────────────────────────────── */
.canvas-sidenav {
  width: var(--sidenav-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidenav-course {
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--course-color);
  color: white;
  line-height: 1.35;
}

.sidenav-nav { list-style: none; }
.sidenav-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.sidenav-nav li a:hover { background: #F0F2F4; text-decoration: none; }
.sidenav-nav li a.active {
  border-left-color: var(--course-color);
  background: rgba(43,122,111,0.07);
  color: var(--course-color);
  font-weight: 700;
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; opacity: 0.8; }

/* ── Main ───────────────────────────────────────────── */
.canvas-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--white);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.09));
}

/* ── Course Header ──────────────────────────────────── */
.course-header {
  background: var(--course-color);
  color: white;
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.course-header.scrolled { padding-top: 12px; padding-bottom: 12px; }
.course-header::before {
  content: "";
  position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}
.course-header::after {
  content: "";
  position: absolute; right: 80px; bottom: -80px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}
.course-eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.82;
  margin-bottom: 6px;
}
.course-header h1 {
  font-size: clamp(1.3rem, 2.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
  font-family: "Lato", sans-serif;
}
.course-header-desc {
  font-size: 0.88rem;
  opacity: 0.85;
  max-width: 580px;
  margin-bottom: 14px;
  max-height: 60px; overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-bottom 0.25s ease;
}
.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.82rem;
  opacity: 0.9;
  max-height: 80px; overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}
.course-header.scrolled .course-header-desc,
.course-header.scrolled .course-meta {
  max-height: 0; opacity: 0; margin-bottom: 0; margin-top: 0;
}
.course-meta span { display: flex; align-items: center; gap: 5px; }

/* ── Content Wrapper ────────────────────────────────── */
.content-area {
  padding: 24px 32px;
  max-width: 1120px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Module Groups ──────────────────────────────────── */
.module-group {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.module-group-header {
  background: #F5F6F7;
  border-bottom: 1px solid var(--border);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.module-expand { color: var(--muted); font-size: 11px; }
.module-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.module-count {
  font-size: 0.76rem;
  color: var(--muted);
  background: #E8EAEC;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Module Items ───────────────────────────────────── */
.module-items { list-style: none; }

.module-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 36px;
  border-bottom: 1px solid var(--border-light);
  min-height: 46px;
  transition: background 0.1s;
}
.module-item:last-child { border-bottom: none; }
.module-item:hover:not(.locked-item) { background: #F7F9FB; }
.module-item.locked-item { opacity: 0.6; }

.item-status {
  width: 13px; height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.item-status.available { border-color: var(--green); background: white; }
.item-status.locked    { border-color: #BABEC3; background: #E8EAEC; }

.item-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--muted);
}

.item-body { flex: 1; min-width: 0; }

.item-title {
  font-size: 0.9rem;
  color: var(--link);
  display: block;
  text-decoration: none;
  line-height: 1.35;
}
.item-title:hover { text-decoration: underline; }
.item-title.locked-item { color: var(--muted); pointer-events: none; cursor: default; }

.item-sub {
  font-size: 0.77rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.3;
}

.item-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Canvas Tags ────────────────────────────────────── */
.ctag {
  font-size: 0.71rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.ctag--blue   { background: #E5F0FA; color: #0562AC; border-color: #C2DCF5; }
.ctag--green  { background: #E5F6E8; color: #127A2A; border-color: #BCDFBF; }
.ctag--orange { background: #FEF0E6; color: #A83B00; border-color: #F5C6A0; }
.ctag--gray   { background: #F0F0F0; color: #666;    border-color: #DCDCDC; }

/* ── Footer ─────────────────────────────────────────── */
.canvas-footer {
  padding: 18px 32px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--white);
  margin-top: auto;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .canvas-sidenav { display: none; }
  :root { --sidenav-w: 0px; }
  .content-area { padding: 16px; }
  .course-header { padding: 20px 16px; }
  .item-tags { display: none; }
  .module-item { padding-left: 20px; }
}
