/* ============================================
   LDPERJ - Oficina Online (curso) - Layout profissional
   Referências: Coursera, Udemy, Alura
   ============================================ */

.oficina-wrap {
  padding: 0;
  min-height: calc(100vh - var(--header-height) - var(--top-bar-height));
}

/* Mobile: coluna única – curso em cima, progresso e módulos embaixo; tudo na mesma rolagem (sem fixo, sem sobrepor)
   Ref: mobile-first single column (MDN, Stack Overflow), edX design for mobile */
@media (max-width: 1023px) {
  .oficina-wrap {
    padding-top: 0;
  }
  .oficina-layout {
    min-height: 0;
    flex-direction: column;
    /* Ordem: conteúdo do curso primeiro, depois progresso e lista de módulos */
    display: flex;
  }
  .oficina-main {
    order: -1;
    position: relative;
    z-index: 0;
    padding-top: var(--space-4);
    padding-bottom: var(--space-6);
    min-height: 0;
  }
  .oficina-sidebar {
    order: 0;
    position: relative;
    top: auto;
    z-index: 0;
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
  }
  .oficina-modulo__title {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .oficina-modulo-video,
  .oficina-modulo-leitura {
    max-width: 100%;
    overflow: hidden;
  }
  .oficina-modulo-leitura iframe {
    max-height: 50vh;
  }
}


/* ---------- Layout com sidebar (dashboard, módulo, prova, resultado) ---------- */
.oficina-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 1024px) {
  .oficina-layout {
    flex-direction: row;
    align-items: flex-start;
    max-width: 90rem;
    margin-inline: auto;
    padding-inline: var(--container-padding);
  }
}

/* Sidebar do curso */
.oficina-sidebar {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) var(--container-padding);
  position: sticky;
  top: calc(var(--top-bar-height) + var(--header-height));
  z-index: 50;
}

@media (min-width: 1024px) {
  .oficina-sidebar {
    width: 18rem;
    min-width: 18rem;
    border-bottom: none;
    border-right: 1px solid var(--color-border);
    padding: var(--space-6);
    min-height: calc(100vh - var(--top-bar-height) - var(--header-height));
  }
}

.oficina-sidebar__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

/* Progresso na sidebar */
.oficina-sidebar__progress {
  margin-bottom: var(--space-6);
}

.oficina-sidebar__progress-ring {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary) 0deg,
    var(--color-primary) calc(var(--pct, 0) * 3.6deg),
    var(--color-surface-alt) calc(var(--pct, 0) * 3.6deg),
    var(--color-surface-alt) 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.oficina-sidebar__progress-inner {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
}

.oficina-sidebar__progress-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Lista de módulos na sidebar */
.oficina-sidebar__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.oficina-sidebar__item {
  margin-bottom: var(--space-1);
}

.oficina-sidebar__item a,
.oficina-sidebar__item span {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  transition: background var(--duration-fast), color var(--duration-fast);
}

.oficina-sidebar__item a:hover {
  background: var(--color-surface);
  color: var(--color-primary);
  text-decoration: none;
}

.oficina-sidebar__item.is-current a,
.oficina-sidebar__item.is-current span {
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 600;
}

.oficina-sidebar__item.is-locked span {
  cursor: not-allowed;
  opacity: 0.7;
}

.oficina-sidebar__item-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.oficina-sidebar__item.is-unlocked .oficina-sidebar__item-num,
.oficina-sidebar__item.is-current .oficina-sidebar__item-num {
  background: var(--color-primary);
  color: var(--color-white);
}

.oficina-sidebar__item.is-completed .oficina-sidebar__item-num {
  background: var(--color-primary);
  color: var(--color-white);
}

.oficina-sidebar__item-text {
  flex: 1;
  min-width: 0;
}

/* Área principal do conteúdo */
.oficina-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-6) var(--container-padding) var(--space-12);
}

@media (min-width: 1024px) {
  .oficina-main {
    padding: var(--space-8) var(--space-10) var(--space-16);
    max-width: 52rem;
  }
}

/* Breadcrumb */
.oficina-breadcrumb {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.oficina-breadcrumb a {
  color: var(--color-primary);
}

.oficina-breadcrumb a:hover {
  text-decoration: underline;
}

/* ---------- View: Entrada (overview do curso) ---------- */
.oficina-view.is-active.oficina-view--entrada {
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 25%);
}

.oficina-hero {
  padding: var(--space-12) var(--container-padding) var(--space-10);
  text-align: center;
  max-width: 40rem;
  margin-inline: auto;
}

.oficina-hero__badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.oficina-hero__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: var(--line-tight);
  margin-bottom: var(--space-3);
}

.oficina-hero__desc {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: var(--line-relaxed);
  margin-bottom: 0;
}

.oficina-overview {
  max-width: 56rem;
  margin-inline: auto;
  padding: 0 var(--container-padding) var(--space-12);
  display: grid;
  gap: var(--space-10);
}

@media (min-width: 768px) {
  .oficina-overview {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    align-items: start;
  }
}

/* O que você vai aprender */
.oficina-learn {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.oficina-learn__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.oficina-learn__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.oficina-learn__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--line-relaxed);
}

.oficina-learn__item::before {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.2;
  margin-top: 0.2rem;
}

/* Regulamento em card */
.oficina-regulamento {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.oficina-regulamento__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.oficina-regulamento ul {
  padding-left: var(--space-5);
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.7;
}

.oficina-regulamento li {
  margin-bottom: var(--space-2);
}

/* Formulário de entrada */
.oficina-entrada-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .oficina-entrada-card {
    position: sticky;
    top: calc(var(--top-bar-height) + var(--header-height) + var(--space-4));
  }
}

.oficina-entrada-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.oficina-entrada-card__sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.oficina-entrada .form-group {
  margin-bottom: var(--space-4);
}

.oficina-entrada .form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

.oficina-entrada .form-group input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  min-height: 48px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.oficina-entrada .form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(42, 157, 244, 0.15);
}

.oficina-entrada .btn--large {
  width: 100%;
  margin-top: var(--space-2);
}

/* ---------- Barra de progresso (topo quando logado) ---------- */
.oficina-progress {
  padding: var(--space-4) var(--container-padding);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.oficina-progress__bar-wrap {
  flex: 1;
  min-width: 8rem;
}

.oficina-progress__bar {
  height: 6px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.oficina-progress__fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out);
}

.oficina-progress__text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.oficina-progress__user {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

/* ---------- Views (show/hide) ---------- */
.oficina-view {
  display: none;
}

.oficina-view.is-active {
  display: block;
  animation: oficinaFadeIn 0.3s var(--ease-out);
}

@keyframes oficinaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Dashboard: lista de módulos ---------- */
.oficina-dashboard__header {
  margin-bottom: var(--space-8);
}

.oficina-dashboard__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.oficina-dashboard__lead {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 38rem;
}

.oficina-dashboard__list {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .oficina-dashboard__list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .oficina-dashboard__list {
    grid-template-columns: 1fr;
  }
}

.oficina-modulo-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.oficina-modulo-card:hover {
  text-decoration: none;
  color: var(--color-text);
}

.oficina-modulo-card.is-unlocked {
  border-color: var(--color-primary);
  cursor: pointer;
}

.oficina-modulo-card.is-unlocked:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.oficina-modulo-card.is-locked {
  opacity: 0.85;
  cursor: not-allowed;
  pointer-events: none;
}

.oficina-modulo-card.is-completed {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.oficina-modulo-card__num {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.oficina-modulo-card.is-unlocked .oficina-modulo-card__num,
.oficina-modulo-card.is-completed .oficina-modulo-card__num {
  background: var(--color-primary);
  color: var(--color-white);
}

.oficina-modulo-card.is-locked .oficina-modulo-card__num {
  background: var(--color-surface-alt);
}

.oficina-modulo-card__body {
  flex: 1;
  min-width: 0;
}

.oficina-modulo-card__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  display: block;
}

.oficina-modulo-card__status {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  display: block;
}

.oficina-modulo-card.is-completed .oficina-modulo-card__status {
  color: var(--color-primary);
  font-weight: 500;
}

.oficina-modulo-card__abrir {
  display: inline-block;
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast);
}
.oficina-modulo-card__abrir:hover {
  background: var(--color-primary-dark, #1e88e5);
  color: var(--color-white);
}

.oficina-sair {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.oficina-sair button {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: var(--text-sm);
  text-decoration: underline;
}

.oficina-sair button:hover {
  color: var(--color-primary-dark);
}

/* ---------- Conteúdo do módulo (vídeo + leitura) ---------- */
.oficina-modulo__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
  line-height: var(--line-tight);
}

.oficina-modulo-section {
  margin-bottom: var(--space-8);
}

.oficina-modulo-section__label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.oficina-modulo-video {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-black);
  aspect-ratio: 16/9;
  box-shadow: var(--shadow-md);
}

.oficina-modulo-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.oficina-modulo-video-placeholder {
  margin: 0;
  padding: var(--space-8);
  color: var(--color-text-muted);
  text-align: center;
  font-size: var(--text-sm);
}

.oficina-modulo-leitura {
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  line-height: var(--line-relaxed);
  color: var(--color-text-muted);
}

.oficina-modulo-leitura h3 {
  color: var(--color-text);
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
}

.oficina-modulo-leitura p {
  margin-bottom: var(--space-3);
}

.oficina-modulo-leitura p:last-child {
  margin-bottom: 0;
}

.oficina-modulo-actions {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ---------- Prova ---------- */
.oficina-prova-header {
  margin-bottom: var(--space-8);
}

.oficina-prova-header__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.oficina-prova-header__lead {
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

.oficina-prova {
  margin-top: var(--space-6);
}

.oficina-prova__questao {
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.oficina-prova__questao h4 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-4);
  line-height: var(--line-relaxed);
  color: var(--color-text);
}

.oficina-prova__opcoes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.oficina-prova__opcao {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}

.oficina-prova__opcao:hover {
  border-color: var(--color-primary-light);
  background: var(--color-surface);
}

.oficina-prova__opcao input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.oficina-prova__submit {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

/* ---------- Resultado da prova ---------- */
.oficina-resultado {
  max-width: 28rem;
  margin-inline: auto;
  padding: var(--space-10);
  text-align: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.oficina-resultado.is-aprovado {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

.oficina-resultado.is-reprovado {
  border-color: var(--color-border);
}

.oficina-resultado__nota {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
  line-height: 1;
}

.oficina-resultado.is-reprovado .oficina-resultado__nota {
  color: var(--color-text-muted);
}

.oficina-resultado__msg {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  line-height: var(--line-relaxed);
}

.oficina-resultado__resumo {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.oficina-resultado__correcoes {
  width: 100%;
  max-width: 100%;
  text-align: left;
  margin-bottom: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.oficina-resultado__correcoes-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.oficina-resultado__correcoes-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.oficina-resultado__correcao-item {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-primary);
}

.oficina-resultado__correcao-item h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.oficina-resultado__correcao-item p {
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
}

.oficina-resultado__correcao-item .certa {
  color: var(--color-primary);
  font-weight: 500;
}

.oficina-resultado__correcao-item .errada {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.oficina-resultado__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}

.oficina-resultado .btn {
  min-width: 10rem;
}

/* ---------- Conclusão do curso ---------- */
.oficina-conclusao {
  max-width: 36rem;
  margin-inline: auto;
  padding: var(--space-12);
  text-align: center;
  background: var(--color-bg);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.oficina-conclusao__badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.oficina-conclusao h2 {
  font-size: var(--text-3xl);
  font-weight: 800;
  margin-bottom: var(--space-4);
  color: var(--color-primary);
}

.oficina-conclusao p {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  line-height: var(--line-relaxed);
}

.oficina-conclusao__resultado {
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  text-align: center;
}

.oficina-conclusao__progresso {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 var(--space-2) !important;
}

.oficina-conclusao__nota {
  font-size: var(--text-lg);
  color: var(--color-text);
  margin: 0 !important;
}

.oficina-conclusao .btn {
  min-width: 14rem;
}
