/* ==========================================================================
   Área do Aluno — Conexões Sociais
   Paleta: roxo (marca), laranja (destaque/CTA), verde-água (sucesso/progresso)
   ========================================================================== */

:root {
  --plum-900: #241934;
  --plum-800: #2E2049;
  --plum-700: #4A2E76;
  --plum-600: #5B3A8E;
  --orange-500: #E27A33;
  --orange-400: #EE9455;
  --teal-500: #159C93;
  --teal-400: #2DBAAF;
  --cream-50: #FBF7F1;
  --cream-100: #F3ECDF;
  --ink-900: #241934;
  --ink-600: #5D5470;
  --ink-400: #8B8298;
  --line: #E7DFCF;
  --white: #FFFFFF;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 20px 50px -20px rgba(36, 25, 52, .25);
  --shadow-tight: 0 8px 20px -10px rgba(36, 25, 52, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-900);
  background: var(--cream-50);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  margin: 0 0 8px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--ink-900);
}

a { color: var(--plum-700); text-decoration: none; }
a:hover { color: var(--orange-500); }

p { margin: 0 0 12px; color: var(--ink-600); line-height: 1.6; }

/* ---------- Header ---------- */
.aluno-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.aluno-header .brand {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--plum-800);
  max-width: 60%;
  line-height: 1.3;
}
@media (max-width: 640px) {
  .aluno-header .brand { font-size: 13.5px; max-width: 55%; }
}
.header-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-home-link {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-600);
  padding: 8px 4px;
}
.header-home-link:hover { color: var(--plum-700); }
.header-user-link {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  flex: none;
}
.header-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--plum-600); color: #fff; font-size: 12.5px; font-weight: 700;
}
.header-username {
  font-size: 13.5px; font-weight: 700; color: var(--ink-900);
}
.aluno-header form button {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink-600);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: .15s;
}
.aluno-header form button:hover {
  border-color: var(--plum-600);
  color: var(--plum-700);
}

.aluno-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

/* ---------- Botões ---------- */
.btn, button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  font-family: 'Inter', sans-serif;
  background: var(--orange-500);
  color: var(--white);
  box-shadow: 0 10px 24px -10px rgba(226, 122, 51, .5);
  text-decoration: none;
}
.btn:hover, button[type="submit"]:hover {
  background: var(--orange-400);
  transform: translateY(-1px);
  color: var(--white);
}
.btn-primary { background: var(--orange-500); }

/* ---------- Formulários (login, definir senha) ---------- */
.login-page, .password-setup-page {
  max-width: 420px;
  margin: 40px auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-soft);
}
.login-page h1, .password-setup-page h1 {
  font-size: 26px;
  margin-bottom: 6px;
  text-align: center;
}
.login-page > p, .password-setup-page > p {
  text-align: center;
  margin-bottom: 24px;
}
form label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-600);
  margin: 16px 0 6px;
}
form input[type="text"],
form input[type="email"],
form input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  font-size: 14.5px;
  font-family: 'Inter', sans-serif;
  background: var(--cream-50);
  transition: border-color .15s;
}
form input:focus {
  outline: none;
  border-color: var(--plum-600);
}
form label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink-600);
}
form button[type="submit"] {
  width: 100%;
  margin-top: 24px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-error {
  background: #FBEAEA;
  color: #A23B3B;
  border: 1px solid #F0C6C6;
}

/* ---------- Card com foto (página inicial) ---------- */
.course-photo-card {
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow-tight);
  transition: transform .2s ease, box-shadow .2s ease;
  background: var(--plum-700);
}
.course-photo-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-soft); }
.course-photo-card-img, .course-photo-card-fallback {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.course-photo-card-fallback {
  background: linear-gradient(160deg, var(--banner-color, var(--plum-700)), var(--plum-900));
}
.course-photo-card-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(36,25,52,0) 30%, rgba(36,25,52,.92) 100%);
}
.course-photo-card-tag {
  position: absolute; top: 14px; left: 14px;
  background: rgba(255,255,255,.92); color: var(--plum-800);
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px; z-index: 2;
}
.course-photo-card-text {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px; z-index: 2;
}
.course-photo-card-text strong {
  display: block; color: #fff; font-family: 'Fraunces', serif;
  font-size: 17px; margin-bottom: 4px; line-height: 1.25;
}
.course-photo-card-text > span {
  display: block; color: rgba(255,255,255,.75); font-size: 12.5px; margin-bottom: 4px;
}
.course-photo-card-percent {
  display: block; color: rgba(255,255,255,.85) !important; font-size: 11px; margin-top: 6px;
}

/* ---------- Estados bloqueados ---------- */
.sidebar-lessons li.locked .sidebar-locked-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 10px; border-radius: var(--radius-sm);
  color: var(--ink-400); cursor: not-allowed; font-size: 13.5px;
}
.sidebar-lessons li.locked .sidebar-icon { background: var(--cream-100); color: var(--ink-400); }
.btn-nav-locked {
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  background: var(--cream-100); color: var(--ink-400); cursor: not-allowed;
}

/* ---------- Meus cursos (grid) ---------- */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.course-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}
.course-card h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--ink-900);
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--cream-100);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange-500), var(--teal-500));
  border-radius: 999px;
  transition: width .3s ease;
}
.course-card span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-400);
}

/* ---------- Banner do curso ---------- */
.course-banner {
  background: linear-gradient(120deg, var(--banner-color, var(--plum-700)) 0%, var(--plum-900) 100%);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  min-height: 200px;
}
.course-banner-text {
  padding: 32px 34px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.course-banner-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  margin-bottom: 10px;
}
.course-banner h1 { color: #fff; font-size: 27px; margin-bottom: 14px; }
.course-instructor-name strong { display: block; color: #fff; font-size: 14.5px; }
.course-instructor-name span { display: block; color: rgba(255,255,255,.65); font-size: 12.5px; }
.course-banner-photo {
  flex: none;
  width: 220px;
  position: relative;
}
.course-banner-photo img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: top center;
}
.course-banner-photo::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 30%);
}
@media (max-width: 640px) {
  .course-banner { flex-direction: column; }
  .course-banner-photo { width: 100%; height: 160px; }
}

/* ---------- Página do curso (descrição, boas-vindas) ---------- */
.welcome-video {
  margin: 28px 0;
}
.lessons-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.lessons-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--teal-500);
  white-space: nowrap;
}
.lessons-list ol {
  list-style: none;
  padding: 0;
  margin: 20px 0 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lessons-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: border-color .15s;
}
.lessons-list li:hover { border-color: var(--plum-600); }
.lessons-list li.completed { border-color: var(--teal-400); background: #F2FBFA; }
.lessons-list li a { font-weight: 600; color: var(--ink-900); flex: 1; }
.lessons-list li span { font-size: 12.5px; color: var(--ink-400); font-weight: 700; }
.badge-ok {
  background: var(--teal-500);
  color: var(--white) !important;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px !important;
}

/* ---------- Layout da página de aula (player + sidebar) ---------- */
.aula-layout {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}
.aula-breadcrumb {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-400);
  margin-bottom: 10px;
}
.aula-nav-buttons {
  display: flex;
  justify-content: space-between;
  margin: 14px 0 20px;
}
.btn-nav {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  color: var(--ink-600);
  background: var(--white);
}
.btn-nav:hover { border-color: var(--plum-600); color: var(--plum-700); }
.btn-nav-primary {
  background: var(--orange-500);
  border-color: var(--orange-500);
  color: var(--white);
}
.btn-nav-primary:hover { background: var(--orange-400); color: var(--white); }
.aula-instructor {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.aula-instructor img {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
}
.aula-instructor span { font-size: 13px; color: var(--ink-600); font-weight: 600; }

.aula-sidebar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: sticky;
  top: 84px;
}
.aula-sidebar h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-400);
  margin-bottom: 14px;
}
.sidebar-lessons {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-lessons li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  font-size: 13.5px;
  font-weight: 500;
}
.sidebar-lessons li a:hover { background: var(--cream-100); }
.sidebar-lessons li.current a {
  background: var(--cream-100);
  color: var(--plum-700);
  font-weight: 700;
}
.sidebar-lessons li.completed a { color: var(--teal-500); }
.sidebar-icon {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cream-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-400);
}
.sidebar-lessons li.completed .sidebar-icon { background: var(--teal-500); color: #fff; }
.sidebar-lessons li.current .sidebar-icon { background: var(--orange-500); color: #fff; }

@media (max-width: 860px) {
  .aula-layout { grid-template-columns: 1fr; }
  .aula-sidebar { position: static; }
}

/* ---------- Player da aula ---------- */
#player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--plum-900);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 24px 0;
  box-shadow: var(--shadow-soft);
}
#player-wrapper iframe,
#player-wrapper #player {
  width: 100%;
  height: 100%;
}
.cc-click-catcher {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}
.custom-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.75) 100%);
}
.cc-progress-bar {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,.25);
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 10px;
}
.cc-progress-fill {
  height: 100%;
  background: var(--orange-500);
  border-radius: 999px;
  width: 0%;
}
.cc-buttons-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.cc-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.cc-btn:hover { color: var(--orange-400); }
.cc-time {
  color: rgba(255,255,255,.85);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
}
.cc-spacer { flex: 1; }

/* ---------- Quiz ---------- */
#quiz-form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 16px;
  background: var(--white);
}
#quiz-form legend {
  font-weight: 700;
  padding: 0 6px;
  color: var(--ink-900);
}
#quiz-form label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  font-size: 14.5px;
  color: var(--ink-600);
  margin: 10px 0;
  cursor: pointer;
}
#quiz-result {
  margin-top: 24px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--cream-100);
  font-weight: 600;
}

/* ---------- Validação pública de certificado ---------- */
.certificate-validation-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
}
.certificate-validation-card p { margin-bottom: 10px; color: var(--ink-900); }

@media (max-width: 640px) {
  .aluno-header { padding: 14px 18px; }
  .aluno-main { padding: 32px 18px 60px; }
  .login-page, .password-setup-page { margin: 20px auto; padding: 28px 22px; }
}

/* ---------- Breadcrumb da aula ---------- */
.aula-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-400);
  margin-bottom: 10px;
}
.aula-breadcrumb a { color: var(--ink-400); }
.aula-breadcrumb a:hover { color: var(--plum-700); }

/* ---------- Documentos da aula ---------- */
.lesson-attachments {
  margin-top: 28px;
  padding: 20px 22px;
  background: var(--cream-100);
  border-radius: var(--radius-md);
}
.lesson-attachments h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-600);
  margin-bottom: 12px;
}
.lesson-attachments ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-attachments a {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--plum-700); font-size: 13.5px;
}
.lesson-attachments a:hover { color: var(--orange-500); }

/* ---------- Comentários / mural da aula ---------- */
.lesson-comments {
  margin-top: 32px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}
.lesson-comments h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-600);
  margin-bottom: 16px;
}
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.comment-form textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--cream-50);
  resize: vertical;
  transition: border-color .15s;
}
.comment-form textarea:focus { outline: none; border-color: var(--plum-600); }
.comment-form button { align-self: flex-end; }
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.comment-list li {
  display: flex; gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.comment-list li:first-child { border-top: none; padding-top: 0; }
.comment-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--plum-600); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
}
.comment-body { flex: 1; }
.comment-body strong { font-size: 13.5px; color: var(--ink-900); }
.comment-date { font-size: 11.5px; color: var(--ink-400); margin-left: 8px; }
.comment-lesson-tag {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  background: var(--cream-100); color: var(--plum-700); font-size: 10.5px; font-weight: 700;
}
.comment-body p { margin: 5px 0 0; font-size: 14px; color: var(--ink-600); line-height: 1.5; }
.comment-empty { color: var(--ink-400); font-size: 13.5px; font-style: italic; padding: 12px 0; }

/* ---------- Página de perfil ---------- */
.profile-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
  max-width: 640px;
}
.profile-avatar-row { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.profile-avatar-preview {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover;
  flex: none;
}
.profile-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--plum-600); color: #fff; font-size: 22px; font-weight: 700;
}
.profile-section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-400); margin: 24px 0 6px; border-top: 1px solid var(--line); padding-top: 20px;
}
.profile-readonly-grid, .profile-address-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px;
}
.profile-readonly-grid input:disabled {
  background: var(--cream-100); color: var(--ink-400); cursor: not-allowed;
}
.profile-readonly-note { font-size: 12px; color: var(--ink-400); margin-top: 8px; }
@media (max-width: 560px) {
  .profile-readonly-grid, .profile-address-grid { grid-template-columns: 1fr; }
}

/* ---------- Avaliação / Certificado ---------- */
.completion-section {
  margin-top: 28px;
  background: linear-gradient(135deg, var(--plum-700), var(--plum-900));
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  color: #fff;
  box-shadow: var(--shadow-soft);
}
.completion-section h2 { color: #fff; font-size: 20px; margin-bottom: 10px; }
.completion-section p { color: rgba(255,255,255,.8); margin-bottom: 18px; }
