/*
  Disciplina pages — shared stylesheet
  Palette mirrors the main portfolio site.
*/

:root {
  --primary:      #149ddd;
  --primary-dark: #173b6c;
  --primary-mid:  #1f5297;
  --border:       #d0e8f5;
  --bg-section:   #f5f8fd;
  --text:         #272829;
  --text-muted:   #666;
  --shell-width:  1140px;
}

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

/*
  Estrutura comum a todas as páginas de disciplina e de aula:
  cabeçalho e rodapé com altura fixa e só a área central (main) rola.
*/
body {
  font-family: "Open Sans", sans-serif;
  color: var(--text);
  background: var(--bg-section);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: #37b3ed; }

/* ── Header ─────────────────────────────────────────── */
.disc-header {
  flex: none;
  background: #040b14;
  color: #fff;
  padding: 14px 0;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.disc-header-inner {
  max-width: var(--shell-width);
  height: 45px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-link {
  width: 168px;
  color: #a8a9b4;
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.back-link svg { flex-shrink: 0; }
.back-text { overflow: hidden; text-overflow: ellipsis; }
.back-link:hover { color: var(--primary); }
.back-link:hover svg { stroke: var(--primary); }

.disc-header-divider {
  width: 1px;
  height: 32px;
  background: #2c2f3f;
  flex-shrink: 0;
}

.disc-info { flex: 1; min-width: 0; }

.disc-title {
  font-family: "Raleway", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.disc-meta {
  font-size: 12px;
  line-height: 18px;
  color: #a8a9b4;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.disc-badge {
  display: inline-block;
  vertical-align: top;
  margin-right: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Main (área rolável) ─────────────────────────────── */
.disc-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  padding: 36px 24px 48px;
}

.disc-container {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Material groups ─────────────────────────────────── */
.material-group {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.material-group-title {
  font-family: "Raleway", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  padding: 14px 22px;
  background: var(--bg-section);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.material-icon {
  font-size: 20px;
  color: var(--primary);
  line-height: 1;
  flex-shrink: 0;
}

.material-list { list-style: none; }

.material-item { border-bottom: 1px solid #f0f5fb; }
.material-item:last-child { border-bottom: none; }

.material-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  color: var(--text);
  transition: background 0.15s;
}
.material-link:hover { background: #f0f7fd; color: var(--text); }
.material-link:hover .material-name { color: var(--primary); }

.material-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.material-type.arquivo { background: #dff3fc; color: #0d6e9a; }
.material-type.video   { background: #fde8d8; color: #b04010; }
.material-type.link    { background: #e4edf9; color: var(--primary-dark); }
.material-type.pdf     { background: #fce8e8; color: #a01010; }

.material-name { flex: 1; font-size: 14px; }

.material-empty {
  padding: 20px 22px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
}

/* ── Plano da disciplina ─────────────────────────────── */
.plan-body {
  padding: 18px 22px;
}

.plan-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ── Cronograma ──────────────────────────────────────── */
.schedule-wrapper {
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.schedule-table thead th {
  text-align: left;
  font-family: "Raleway", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-section);
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.schedule-th-week { width: 90px; }
.schedule-th-date { width: 90px; }

.schedule-table tbody td {
  padding: 11px 22px;
  border-bottom: 1px solid #f0f5fb;
  color: var(--text);
  vertical-align: middle;
}
.schedule-table tbody tr:last-child td { border-bottom: none; }
.schedule-table tbody tr:hover td { background: #f0f7fd; }

.schedule-table tbody td:last-child {
  white-space: nowrap;
}

.schedule-date {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
}

.schedule-week {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.schedule-holiday td { background: #f7f7f7; }
.schedule-holiday td:first-child .schedule-week { background: #8a8a8a; }
.schedule-holiday td:nth-child(2) { color: var(--text-muted); font-style: italic; }
.schedule-holiday .schedule-date { color: var(--text-muted); background: #eee; border-color: #e0e0e0; }

.schedule-eval td { background: #fff8e6; }
.schedule-eval td:first-child .schedule-week { background: #b8860b; }
.schedule-eval td:nth-child(2) { font-weight: 600; }
.schedule-eval .schedule-date {
  color: #fff;
  background: #b8860b;
  border-color: #b8860b;
  font-size: 13.5px;
}

.schedule-event td { background: #eaf6fb; }
.schedule-event td:first-child .schedule-week { background: #1f8aa8; }
.schedule-event td:nth-child(2) { font-style: italic; }
.schedule-event .schedule-date { color: #fff; background: #1f8aa8; border-color: #1f8aa8; }

.month-start td { border-top: 2px solid var(--primary-mid); }

/* ── Livros ──────────────────────────────────────────── */
.book-list { list-style: none; }

.book-item {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid #f0f5fb;
}
.book-item:last-child { border-bottom: none; }

.book-cover {
  width: 90px;
  height: auto;
  flex-shrink: 0;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.book-info { flex: 1; min-width: 0; }

.book-ref {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.book-ref strong { color: var(--text); }
.book-ref a { word-break: break-word; }

.book-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  transition: background 0.15s;
}
.book-open-btn:hover { background: var(--primary-mid); color: #fff; }
.book-open-btn i { font-size: 15px; }

.book-physical-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  background: var(--bg-section);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
}
.book-physical-note i { font-size: 15px; }

/* ── Footer ──────────────────────────────────────────── */
.disc-footer {
  flex: none;
  background: #040b14;
  color: #a8a9b4;
  text-align: center;
  padding: 14px 24px;
  font-size: 12px;
  line-height: 18px;
}
.disc-footer a { color: var(--primary); }

/* ── Video accordion ─────────────────────────────────── */
.video-accordion > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  color: var(--text);
  transition: background 0.15s;
}
.video-accordion > summary::-webkit-details-marker { display: none; }
.video-accordion > summary:hover { background: #f0f7fd; }
.video-accordion > summary:hover .material-name { color: var(--primary); }

.video-accordion-icon {
  margin-left: auto;
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}
details[open] .video-accordion-icon { transform: rotate(180deg); }

.video-accordion-body { padding: 0 22px 18px; }

.video-wrapper {
  position: relative;
  padding-top: 56.25%;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.video-facade {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.video-facade img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.2s;
}
.video-facade:hover img { opacity: 1; }
.video-play-btn {
  position: relative; z-index: 1;
  width: 68px; height: 48px;
  background: rgba(255,0,0,0.92);
  border: none; border-radius: 12px;
  cursor: pointer; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 14px rgba(0,0,0,0.5);
  transition: background 0.2s, transform 0.15s;
}
.video-facade:hover .video-play-btn { background: #ff0000; transform: scale(1.08); }
.video-play-btn svg { fill: #fff; width: 26px; height: 26px; }

/* ── Ementa accordion ────────────────────────────────── */
.ementa-section {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.ementa-item {
  border-bottom: 1px solid #f0f5fb;
}
.ementa-item:last-child { border-bottom: none; }

.ementa-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  color: var(--text);
  transition: background 0.15s;
  user-select: none;
}
.ementa-summary::-webkit-details-marker { display: none; }
.ementa-summary:hover { background: #f0f7fd; }
.ementa-summary:hover .ementa-item-title { color: var(--primary); }

.ementa-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.ementa-item-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s;
}

.ementa-chevron {
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ementa-item[open] .ementa-chevron { transform: rotate(180deg); }

.ementa-content {
  padding: 2px 22px 16px 60px;
}

.ementa-content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ementa-content ul li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
  line-height: 1.55;
}

.ementa-content ul li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

/* ── Aulas interativas ───────────────────────────────── */
.lesson-intro {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 16px 22px 4px;
}

.lesson-list {
  list-style: none;
  padding: 10px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.lesson-link:hover {
  background: #f0f7fd;
  color: var(--text);
  box-shadow: 0 4px 14px rgba(23,59,108,0.1);
  transform: translateY(-1px);
}
.lesson-link:hover .lesson-title { color: var(--primary); }

.lesson-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #0f1b2a;
  color: #7fd3ff;
  font-size: 22px;
  flex-shrink: 0;
}

.lesson-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.lesson-weeks {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.lesson-title {
  font-family: "Raleway", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  transition: color 0.15s;
}

.lesson-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.lesson-tag {
  font-size: 11px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  color: var(--primary-dark);
  border-radius: 10px;
  padding: 1px 8px;
}

.lesson-arrow { font-size: 22px; color: var(--text-muted); flex-shrink: 0; }

.schedule-lesson {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #dff3fc;
  color: #0d6e9a;
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  vertical-align: middle;
}
.schedule-lesson:hover { background: var(--primary); color: #fff; }
.schedule-lesson i { font-size: 13px; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  /* Cabeçalho compacto: voltar vira só ícone, título e meta em uma linha cada */
  .disc-header { padding: 10px 0; }
  .disc-header-inner { padding: 0 16px; gap: 12px; height: 42px; }
  .back-link {
    width: 32px;
    height: 32px;
    justify-content: center;
    border: 1px solid #2c2f3f;
    border-radius: 8px;
  }
  .back-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .disc-header-divider { display: none; }
  .disc-title { font-size: 16px; line-height: 21px; }
  .disc-meta { font-size: 11px; margin-top: 3px; }
  .disc-main { padding: 20px 12px 32px; }
  .disc-footer { padding: 10px 16px; font-size: 11px; }
  .material-group-title { font-size: 14px; padding: 12px 16px; }
  .material-link { padding: 12px 16px; }
  .material-empty { padding: 16px; }
  .video-accordion > summary { padding: 12px 16px; }
  .video-accordion-body { padding: 0 16px 16px; }
  .schedule-table thead th { padding: 10px 16px; }
  .schedule-table tbody td { padding: 10px 16px; }
  .plan-body { padding: 16px; }
  .book-item { padding: 16px; }
  .lesson-intro { padding: 14px 16px 2px; }
  .lesson-list { padding: 10px 16px 16px; }
  .lesson-link { padding: 12px; gap: 12px; }
  .lesson-icon { width: 38px; height: 38px; font-size: 19px; }
}

/* ── Cronograma: layout em cartões no mobile ─────────── */
@media (max-width: 600px) {
  .schedule-wrapper { overflow-x: visible; }
  .schedule-table,
  .schedule-table tbody { display: block; }
  .schedule-table thead { display: none; }

  .schedule-table tbody tr {
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-areas:
      "week theme"
      "week date";
    align-items: center;
    border-bottom: 1px solid #f0f5fb;
  }
  .schedule-table tbody tr:last-child { border-bottom: none; }
  .schedule-table tbody tr.month-start { border-top: 2px solid var(--primary-mid); }
  .month-start td { border-top: none; }

  .schedule-table tbody td {
    border-bottom: none;
    padding: 0 16px 0 0;
    min-width: 0;
  }
  .schedule-table tbody td:nth-child(1) {
    grid-area: week;
    padding: 12px 0 12px 16px;
    align-self: stretch;
    display: flex;
    align-items: center;
  }
  .schedule-table tbody td:nth-child(2) {
    grid-area: theme;
    padding-top: 12px;
    padding-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .schedule-table tbody td:nth-child(3) {
    grid-area: date;
    padding-top: 0;
    padding-bottom: 12px;
  }
  .schedule-table tbody td:nth-child(1) { padding-right: 0; }
  .schedule-date { font-size: 12px; padding: 2px 8px; }
  .schedule-lesson { margin-left: 0; margin-top: 6px; }
}

/* ── Telas baixas e impressão: volta à rolagem da página inteira ── */
@media (max-height: 480px) {
  body { height: auto; min-height: 100vh; overflow: visible; }
  .disc-main { overflow: visible; }
}
@media print {
  body { height: auto; overflow: visible; }
  .disc-main { overflow: visible; }
}

.disc-main:focus { outline: none; }
