/* ============================================================
   sidebar.css — Sidebar de matérias (Aba Conteúdos)
   ============================================================ */

/* --- Layout da aba conteúdos --- */
#tab-conteudos.active {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--header-height) - var(--tab-nav-height));
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - var(--header-height) - var(--tab-nav-height));
  overflow-y: auto;
  position: sticky;
  top: calc(var(--header-height) + var(--tab-nav-height));
  max-height: calc(100vh - var(--header-height) - var(--tab-nav-height));
}

.sidebar-header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.sidebar-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-family: 'Source Sans 3', sans-serif;
}

.sidebar-list {
  padding: 8px 0;
}

/* --- Item de matéria na sidebar --- */
.sidebar-subject {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  user-select: none;
}

.sidebar-subject:hover:not(.active) {
  background: var(--bg);
  border-left-color: var(--border-strong);
}

.sidebar-subject.active {
  border-left-color: var(--accent);
  background: var(--accent-light);
}

.sidebar-subject.active .sidebar-subject-name {
  color: #065f46;
  font-weight: 700;
}

.sidebar-subject.active .sidebar-subject-icon {
  opacity: 1;
}

.sidebar-subject.active .sidebar-count {
  background: var(--accent);
  color: var(--white);
}

/* Ícone da matéria */
.sidebar-subject-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

/* Texto da matéria */
.sidebar-subject-info {
  flex: 1;
  min-width: 0;
}

.sidebar-subject-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  transition: color var(--transition);
  font-family: 'Source Sans 3', sans-serif;
}

.sidebar-subject-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Badge com número de tópicos */
.sidebar-count {
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
  font-family: 'Source Sans 3', sans-serif;
}

/* --- Divisor entre grupos de matérias --- */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

/* --- Rótulo de categoria (ex: Conhecimentos Específicos) --- */
.sidebar-category-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  padding: 18px 22px 8px;
  font-family: 'Source Sans 3', sans-serif;
}

/* --- Footer da sidebar --- */
.sidebar-footer {
  display: none;
}

/* --- Área de conteúdo (à direita da sidebar) --- */
.content-area {
  flex: 1;
  min-width: 0;
  padding: 28px 36px;
  max-height: calc(100vh - var(--header-height) - var(--tab-nav-height));
  overflow-y: auto;
}

.content-header {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border);
}

.content-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.content-subject-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-subject-icon {
  font-size: 1.7rem;
}

.content-subject-name {
  font-size: 1.4rem;
  font-weight: 900;
  color: #000000;
  letter-spacing: -0.02em;
  font-family: 'Source Sans 3', sans-serif;
}

.content-header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.content-stat-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Source Sans 3', sans-serif;
}

.content-stat-chip strong {
  color: var(--text);
  font-weight: 700;
}

.content-header-desc {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 720px;
  line-height: 1.65;
}

/* --- Responsivo --- */
@media (max-width: 1024px) {
  .sidebar {
    width: 230px;
    min-width: 230px;
  }

  .content-area {
    padding: 20px 22px;
  }
}

@media (max-width: 768px) {
  #tab-conteudos {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    min-height: auto;
    max-height: none;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar-list {
    display: flex;
    padding: 8px 12px;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .sidebar-subject {
    flex-direction: column;
    text-align: center;
    padding: 10px 14px;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-md);
    gap: 4px;
    flex-shrink: 0;
  }

  .sidebar-subject.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
    background: var(--accent-light);
  }

  .sidebar-subject-sub {
    display: none;
  }

  .sidebar-header,
  .sidebar-divider,
  .sidebar-footer,
  .sidebar-category-label {
    display: none;
  }

  .content-area {
    max-height: none;
    padding: 16px;
  }

  .content-subject-name {
    font-size: 1.15rem;
  }
}
