/* =============================================
   SEFAZ Academy — Design System
   ============================================= */

/* Fonte Inter carregada via <link> em templates/base.html (com preconnect) —
   não duplicar aqui com @import para evitar uma segunda requisição. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Cores principais */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;

  /* Cores neutras */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semânticas */
  --color-primary:   var(--blue-600);
  --color-primary-h: var(--blue-700);
  --color-bg:        var(--gray-50);
  --color-card:      #ffffff;
  --color-text:      var(--gray-800);
  --color-muted:     var(--gray-500);
  --color-border:    var(--gray-200);
  --color-success:   #16a34a;
  --color-danger:    #dc2626;
  --color-warning:   #d97706;

  /* Sidebar */
  --sidebar-bg:      #0f172a;
  --sidebar-width:   256px;
  --sidebar-text:    rgba(255,255,255,.65);
  --sidebar-active:  rgba(59,130,246,.2);
  --sidebar-hover:   rgba(255,255,255,.06);

  /* Espaçamento */
  --topbar-h:   64px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-h); }
img { display: block; max-width: 100%; }

/* Barra de rolagem fina, com o gradiente azul/roxo da marca */
* {
  scrollbar-width: thin;
  scrollbar-color: #6366f1 transparent;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6, #8b5cf6);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2563eb, #7c3aed);
  background-clip: padding-box;
}

/* =============================================
   LAYOUT
   ============================================= */

.app-layout { display: flex; min-height: 100vh; }

/* =============================================
   SIDEBAR
   ============================================= */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--gray-600);
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.hamburger-btn:hover { background: var(--gray-100); }

.sidebar__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 190;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-decoration: none;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.08);
  border: none;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  z-index: 5;
}

.sidebar-close-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

.sidebar__brand-name-logo {
  display: block;
  width: 90%;
  height: auto;
  object-fit: contain;
}

.sidebar__nav { flex: 1; padding: 12px 0; }

.sidebar__section { margin-bottom: 4px; }

.sidebar__section-label {
  padding: 10px 18px 4px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.25);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  margin: 1px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 450;
  text-decoration: none;
  transition: background .12s, color .12s;
  position: relative;
}

.sidebar__link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }

.sidebar__link.active { background: var(--sidebar-active); color: #93c5fd; }

.sidebar__link.active .sidebar__link-icon { color: #60a5fa; }

.sidebar__link-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .75;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__link.active .sidebar__link-icon { opacity: 1; }
.sidebar__link:hover .sidebar__link-icon { opacity: 1; }

.sidebar__badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar__divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 8px 18px;
}

.sidebar__footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar__avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0; overflow: hidden;
}

.sidebar__avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar__user-info { flex: 1; min-width: 0; }

.sidebar__user-name {
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role { color: rgba(255,255,255,.35); font-size: 11px; margin-top: 1px; }

.sidebar__logout {
  color: rgba(255,255,255,.3);
  transition: color .12s;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
}

.sidebar__logout:hover { color: #fff; background: rgba(255,255,255,.08); }

/* =============================================
   MAIN
   ============================================= */

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar__title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.topbar__actions { display: flex; align-items: center; gap: 8px; }

.app-content { flex: 1; padding: 24px; }

/* =============================================
   MENSAGENS
   ============================================= */

.messages-wrapper { margin-bottom: 20px; }

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13.5px;
  border: 1px solid transparent;
}

.alert--success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert--error, .alert--danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert--info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert--warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* =============================================
   PÁGINAS DE AUTH
   ============================================= */

@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes authFloatOrb {
  0%, 100% { transform: translateY(0px) scale(1); }
  50%       { transform: translateY(-28px) scale(1.06); }
}

@keyframes authGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.auth-page {
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-page__left {
  background: linear-gradient(-45deg, #0f172a, #1e3a8a, #1d4ed8, #0f172a, #312e81);
  background-size: 400% 400%;
  animation: authGradient 14s ease infinite;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  position: relative;
  overflow: hidden;
}

/* Grade de pontos decorativos */
.auth-page__left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* Orbs flutuantes */
.auth-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-orb--1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,.28) 0%, transparent 65%);
  top: -180px; left: -160px;
  animation: authFloatOrb 9s ease-in-out infinite;
}

.auth-orb--2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(59,130,246,.22) 0%, transparent 65%);
  bottom: -130px; right: -100px;
  animation: authFloatOrb 11s ease-in-out infinite reverse;
  animation-delay: -4s;
}

.auth-orb--3 {
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(139,92,246,.18) 0%, transparent 65%);
  top: 45%; right: 60px;
  animation: authFloatOrb 7s ease-in-out infinite;
  animation-delay: -2s;
}

.auth-page__brand {
  position: relative;
  z-index: 2;
  margin-bottom: 28px;
  animation: authFadeUp .7s ease both;
}

.auth-page__app-desc {
  color: rgba(255,255,255,.38);
  font-size: 12.5px;
  letter-spacing: .01em;
}

.auth-page__tagline {
  position: relative;
  z-index: 2;
  animation: authFadeUp .7s ease .12s both;
}

.auth-page__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}


.auth-page__tagline h2 {
  color: #fff;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.035em;
  margin-bottom: 16px;
}

.auth-page__tagline h2 .highlight {
  background: linear-gradient(90deg, #60a5fa 20%, #a78bfa 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-page__tagline p {
  color: rgba(255,255,255,.48);
  font-size: 14.5px;
  line-height: 1.75;
  max-width: 370px;
}

/* Stats */
.auth-stats {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 0;
  margin-top: 36px;
  margin-bottom: 34px;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,.08);
  animation: authFadeUp .7s ease .24s both;
}

.auth-stat {
  flex: 1;
  padding-right: 20px;
  border-right: 1px solid rgba(255,255,255,.08);
  margin-right: 20px;
}

.auth-stat:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.auth-stat__number {
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 6px;
}

.auth-stat__label {
  color: rgba(255,255,255,.38);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Features */
.auth-page__features {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: authFadeUp .7s ease .36s both;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 13px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  padding: 11px 15px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  transition: background .2s, border-color .2s, color .2s;
}

.auth-feature:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.13);
  color: rgba(255,255,255,.85);
}

.auth-feature__icon {
  width: 34px; height: 34px;
  background: rgba(59,130,246,.22);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Right panel */
.auth-page__right {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  overflow-y: auto;
}

.auth-form-wrap {
  width: 100%;
  max-width: 380px;
  animation: authFadeUp .5s ease .1s both;
}

.auth-form-wrap__logo {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  object-fit: contain;
  margin-bottom: 16px;
}

.auth-form-wrap__title {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -.025em;
  margin-bottom: 6px;
}

.auth-form-wrap__sub {
  color: var(--color-muted);
  font-size: 13.5px;
  margin-bottom: 22px;
}

.auth-form-wrap__footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-muted);
}

/* Mobile auth */
@media (max-width: 768px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-page__left { display: none; }
  .auth-page__right { padding: 32px 24px; align-items: flex-start; padding-top: 60px; }
}

/* =============================================
   CATEGORY PILLS — filtro horizontal com scroll
   ============================================= */

.category-pills-wrap {
  margin-bottom: 24px;
  position: relative;
}

.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.category-pills::-webkit-scrollbar { height: 3px; }
.category-pills::-webkit-scrollbar-track { background: transparent; }
.category-pills::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
.category-pills::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.category-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1.5px solid transparent;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
  cursor: pointer;
  text-decoration: none;
}

.category-pill:hover {
  background: var(--blue-50);
  color: var(--blue-600);
  border-color: var(--blue-100);
  transform: translateY(-1px);
}

.category-pill--active {
  background: var(--blue-600);
  color: #fff;
  border-color: var(--blue-600);
}

.category-pill--active:hover {
  background: var(--blue-700);
  color: #fff;
  border-color: var(--blue-700);
  transform: translateY(-1px);
}

/* =============================================
   PAGINAÇÃO
   ============================================= */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 28px 0 8px;
}

.pagination__status {
  font-size: 13px;
  color: var(--color-muted);
}

/* =============================================
   FILTER TABS — Meus Cursos
   ============================================= */

.filter-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--color-border);
  padding-bottom: 0;
}

.filter-tab {
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  text-decoration: none;
  transition: color .15s, border-color .15s;
  border-radius: 6px 6px 0 0;
}

.filter-tab:hover { color: var(--gray-700); }

.filter-tab--active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
  font-weight: 600;
}

/* =============================================
   ENROLLMENT PROGRESS BAR
   ============================================= */

.enrollment-progress {
  margin: 10px 0 4px;
}

.enrollment-progress__bar {
  height: 5px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 5px;
}

.enrollment-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-500), #6366f1);
  border-radius: 99px;
  transition: width .4s ease;
}

.enrollment-progress__label {
  font-size: 11.5px;
  color: var(--color-muted);
  font-weight: 500;
}

/* =============================================
   REVIEWS — avaliações de curso
   ============================================= */

.review-avg {
  font-size: 13px;
  font-weight: 600;
  color: #f59e0b;
  margin-left: 10px;
  vertical-align: middle;
}

.review-form-card {
  background: var(--gray-50);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

/* Star rating input */
.star-rating-input {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 2px;
}

.star-rating-input input { display: none; }

.star-rating-input label {
  font-size: 28px;
  color: #d1d5db;
  cursor: pointer;
  transition: color .15s;
  line-height: 1;
}

.star-rating-input label:hover,
.star-rating-input label:hover ~ label,
.star-rating-input input:checked ~ label { color: #f59e0b; }

.review-card {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  background: #fff;
}

.review-card--own { background: var(--blue-50); border-color: var(--blue-100); }

.review-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.review-card__avatar {
  width: 32px; height: 32px;
  background: var(--blue-600);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.review-card__name { font-size: 13px; font-weight: 600; color: var(--gray-800); line-height: 1.2; }

.review-stars { color: #f59e0b; font-size: 15px; letter-spacing: 1px; }

.review-card__date { margin-left: auto; font-size: 12px; color: var(--color-muted); }

.review-card__comment { font-size: 13.5px; color: var(--gray-600); line-height: 1.6; margin: 0; }

/* Aula concluída badge */
.lesson-completed-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-sm);
  color: #15803d;
  font-size: 13.5px;
  font-weight: 600;
}

/* =============================================
   FORMULÁRIOS
   ============================================= */

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--gray-400); }

.form-error { color: var(--color-danger); font-size: 12px; margin-top: 4px; display: block; }
.form-help { color: var(--color-muted); font-size: 12px; margin-top: 4px; display: block; }

/* =============================================
   FORMULÁRIO DE CURSO — criar / editar
   ============================================= */

.course-form-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.course-form-card {
  position: relative;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 28px 28px 24px;
}

.course-form-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue-500), #8b5cf6, var(--blue-500));
  background-size: 200% 100%;
  animation: authGradient 6s ease infinite;
}

.course-form-card__intro {
  font-size: 13px;
  color: var(--color-muted);
  margin: 2px 0 22px;
  line-height: 1.6;
}

.course-form-fields > * {
  opacity: 0;
  animation: authFadeUp .5s ease both;
}

.course-form-fields > *:nth-child(1) { animation-delay: .02s; }
.course-form-fields > *:nth-child(2) { animation-delay: .07s; }
.course-form-fields > *:nth-child(3) { animation-delay: .12s; }
.course-form-fields > *:nth-child(4) { animation-delay: .17s; }
.course-form-fields > *:nth-child(5) { animation-delay: .22s; }
.course-form-fields > *:nth-child(6) { animation-delay: .27s; }

/* Campo com label flutuante (title/description) */
.ff-field { position: relative; margin-bottom: 18px; }

.ff-field input,
.ff-field textarea {
  width: 100%;
  padding: 20px 14px 8px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.ff-field textarea { resize: vertical; min-height: 92px; padding-top: 22px; }

.ff-field label {
  position: absolute;
  left: 14px;
  top: 14px;
  font-size: 14px;
  color: var(--gray-400);
  pointer-events: none;
  transform-origin: left top;
  transition: transform .15s ease, color .15s ease, top .15s ease;
}

.ff-field input:focus,
.ff-field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.ff-field input:focus + label,
.ff-field textarea:focus + label,
.ff-field input:not(:placeholder-shown) + label,
.ff-field textarea:not(:placeholder-shown) + label {
  top: 7px;
  transform: scale(.78);
  color: var(--color-primary);
}

.ff-field .form-error { margin-top: 6px; }

/* Grupo de pills de categoria */
.course-form-group { margin-bottom: 18px; }

.course-form-group > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.course-form-pills { display: flex; flex-wrap: wrap; gap: 8px; }

/* Select real: só aparece se o JS não montar os pills/toggle */
.js-enhanced-field { margin-top: 8px; max-width: 260px; }

/* Toggle de status (segmented control) */
.status-toggle {
  display: inline-flex;
  background: var(--gray-100);
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
}

.status-toggle__option {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, box-shadow .15s;
}

.status-toggle__option:hover { color: var(--gray-800); }

.status-toggle__option--active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: var(--shadow-xs);
}

.status-toggle__option--active.status-toggle__option--published { color: var(--color-success); }
.status-toggle__option--active.status-toggle__option--archived { color: var(--color-muted); }

/* Dropzone de capa */
.thumb-dropzone {
  position: relative;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--gray-50);
}

.thumb-dropzone:hover,
.thumb-dropzone--dragover {
  border-color: var(--color-primary);
  background: var(--blue-50);
}

.thumb-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.thumb-dropzone__icon { color: var(--gray-400); margin-bottom: 8px; }

.thumb-dropzone__hint { font-size: 13px; color: var(--color-muted); }

.thumb-dropzone__hint strong { color: var(--color-primary); font-weight: 600; }

.thumb-dropzone__preview {
  display: none;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.thumb-dropzone--has-image .thumb-dropzone__preview { display: flex; }
.thumb-dropzone--has-image .thumb-dropzone__placeholder { display: none; }

.thumb-dropzone__preview img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Preview ao vivo do card do curso */
.live-preview { position: sticky; top: 84px; }

.live-preview__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-preview__label svg { color: var(--gray-400); }

.live-preview .course-card { pointer-events: none; transition: box-shadow .2s; }
.live-preview .course-card:hover { transform: none; }

@media (max-width: 1024px) {
  .course-form-page { grid-template-columns: 1fr; }
  .live-preview { position: static; max-width: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  .course-form-fields > *,
  .course-form-card::before { animation: none; opacity: 1; }
}

/* =============================================
   BOTÕES
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(37,99,235,.2);
}
.btn--primary:hover { background: var(--color-primary-h); border-color: var(--color-primary-h); color: #fff; }

.btn--outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--outline:hover { background: var(--blue-50); color: var(--color-primary); }

.btn--ghost { background: transparent; color: var(--gray-600); border-color: var(--color-border); background: var(--gray-100); }
.btn--ghost:hover { background: var(--gray-200); color: var(--gray-700); }

.btn--danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn--danger:hover { background: #b91c1c; }

.btn--success { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn--success:hover { background: #15803d; }

.btn--full { width: 100%; }
.btn--sm { padding: 5px 11px; font-size: 12.5px; }
.btn--lg { padding: 11px 22px; font-size: 15px; font-weight: 600; }

/* =============================================
   CARDS
   ============================================= */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card__title { font-size: 15px; font-weight: 600; }

/* =============================================
   MÉTRICAS
   ============================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  position: relative;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(59,130,246,.14);
  border-color: rgba(99,102,241,.3);
}
.stat-card:hover::before { transform: scaleX(1); }

.stat-card__icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .25s ease;
}
.stat-card:hover .stat-card__icon { transform: scale(1.06) rotate(-4deg); }
.stat-card__icon--blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #2563eb; box-shadow: 0 2px 5px rgba(37,99,235,.1); }
.stat-card__icon--purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #7c3aed; box-shadow: 0 2px 5px rgba(124,58,237,.1); }
.stat-card__icon--amber  { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; box-shadow: 0 2px 5px rgba(217,119,6,.1); }
.stat-card__icon--green  { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #16a34a; box-shadow: 0 2px 5px rgba(22,163,74,.1); }
.stat-card__icon--red    { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #dc2626; box-shadow: 0 2px 5px rgba(220,38,38,.1); }

.stat-card__body { flex: 1; min-width: 0; }

.stat-card__label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  margin-bottom: 8px;
  white-space: nowrap;
}

.stat-card__value {
  font-size: 30px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -.02em;
}

.stat-card__sub { font-size: 12px; color: var(--color-muted); margin-top: 6px; }
.stat-card__sub a { color: var(--color-primary); font-weight: 600; }

/* =============================================
   CABEÇALHO DE PÁGINA
   ============================================= */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1, .page-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--gray-900);
}

/* =============================================
   GRADE DE CURSOS
   ============================================= */

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.course-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}

.course-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.course-card__thumb {
  width: 100%; height: 148px;
  object-fit: cover;
  flex-shrink: 0;
}

.course-card__thumb--placeholder {
  width: 100%; height: 148px;
  background: linear-gradient(135deg, var(--blue-50), var(--blue-100));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.course-card__thumb--placeholder svg { color: #93c5fd; }

.course-card__body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-card__category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-primary);
  margin-bottom: 5px;
}

.course-card__origin {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
}
.course-card__origin--interno { background: #dbeafe; color: #1d4ed8; }
.course-card__origin--externo { background: #ede9fe; color: #7c3aed; }

.course-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  flex: 1;
}

.course-card__title a { color: var(--gray-900); }
.course-card__title a:hover { color: var(--color-primary); }

.course-card__teacher { font-size: 12.5px; color: var(--color-muted); margin-bottom: 10px; }

.course-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.course-card__meta { font-size: 12px; color: var(--color-muted); }

/* =============================================
   DETALHE DO CURSO
   ============================================= */

.course-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

.course-detail__thumb {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 16px;
  max-height: 280px;
  object-fit: cover;
}

.course-detail__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}

.course-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--color-muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.course-detail__meta span { display: flex; align-items: center; gap: 5px; }

.course-detail__desc { font-size: 14px; line-height: 1.75; color: var(--gray-700); margin-bottom: 20px; }

.sidebar-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}

.sidebar-card__enrolled {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-success);
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 12px;
}

/* --- Módulos --- */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--color-border);
}

.module { margin-bottom: 10px; }

.module__header {
  background: var(--gray-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
}

.lesson-list {
  list-style: none;
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.lesson-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  transition: background .1s;
}

.lesson-list__item:last-child { border-bottom: none; }
.lesson-list__item:hover { background: var(--gray-50); }

.lesson-list__item a { color: var(--gray-800); flex: 1; }
.lesson-list__item a:hover { color: var(--color-primary); }
.lesson-list__locked { color: var(--color-muted); flex: 1; }
.lesson-list__type { color: var(--gray-400); flex-shrink: 0; display: flex; align-items: center; }
.lesson-list__duration { color: var(--gray-400); font-size: 11.5px; margin-left: auto; white-space: nowrap; }

/* Accordion de módulos na página de detalhe do curso */
.course-accordion { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }

.accordion-module { border-bottom: 1px solid var(--color-border); }
.accordion-module:last-child { border-bottom: none; }

.accordion-module__header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(59,130,246,.07), rgba(139,92,246,.05));
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gray-900);
  transition: background .15s, border-color .15s;
}
.accordion-module__header:hover { background: linear-gradient(90deg, rgba(59,130,246,.12), rgba(139,92,246,.09)); }
.accordion-module--open .accordion-module__header {
  background: linear-gradient(90deg, rgba(59,130,246,.14), rgba(139,92,246,.1));
  border-left-color: #6366f1;
}
.accordion-module__chevron { flex-shrink: 0; transition: transform .22s; color: #6366f1; }
.accordion-module__title { flex: 1; }
.accordion-module__count {
  font-size: 11px;
  font-weight: 700;
  color: #6366f1;
  background: rgba(99,102,241,.12);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.accordion-module__body { display: none; background: #fff; }
.accordion-module--open .accordion-module__body { display: block; }
.accordion-module--open .accordion-module__chevron { transform: rotate(180deg); }

.accordion-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--gray-700);
  transition: background .1s;
}
.accordion-lesson:hover { background: var(--gray-50); }
.accordion-lesson__icon { flex-shrink: 0; display: flex; align-items: center; }
.accordion-lesson__title { flex: 1; line-height: 1.35; }
.accordion-lesson__duration { font-size: 11.5px; color: var(--color-muted); white-space: nowrap; }
.accordion-lesson__play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
  text-decoration: none;
}
.accordion-lesson__play:hover { background: #1d4ed8; transform: scale(1.1); text-decoration: none; }
.accordion-lesson__locked { display: flex; align-items: center; flex-shrink: 0; }

/* =============================================
   TABELA
   ============================================= */

.table-wrapper {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table { width: 100%; border-collapse: collapse; }

.table th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--color-border);
}

.table td {
  padding: 13px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

/* =============================================
   BADGES
   ============================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge--student   { background: #eff6ff; color: #1d4ed8; }
.badge--teacher   { background: #f0fdf4; color: #15803d; }
.badge--admin     { background: #fefce8; color: #a16207; }
.badge--published { background: #f0fdf4; color: #15803d; }
.badge--draft     { background: #f8fafc; color: var(--gray-500); border: 1px solid var(--color-border); }
.badge--archived  { background: #fef2f2; color: #b91c1c; }
.badge--pending   { background: #fffbeb; color: #b45309; }
.badge--approved  { background: #f0fdf4; color: #15803d; }
.badge--rejected  { background: #fef2f2; color: #b91c1c; }
.badge--answered  { background: #f0fdf4; color: #15803d; }
.badge--unanswered{ background: #fffbeb; color: #b45309; }

/* =============================================
   FILTROS
   ============================================= */

.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* =============================================
   TABS
   ============================================= */

.tabs {
  display: flex;
  border-bottom: 1.5px solid var(--color-border);
  margin-bottom: 20px;
  gap: 2px;
}

.tab {
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  text-decoration: none;
  transition: color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab:hover { color: var(--color-text); text-decoration: none; }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* =============================================
   DÚVIDAS (Q&A)
   ============================================= */

.question-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.question-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.question-card__meta { font-size: 12px; color: var(--color-muted); }

.question-card__text { font-size: 13.5px; color: var(--gray-700); line-height: 1.6; }

.question-card__answer {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 13.5px;
  color: #15803d;
  line-height: 1.6;
}

.question-card__answer-label {
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.answer-form { margin-top: 12px; }
.answer-form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  margin-bottom: 8px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.answer-form textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* =============================================
   PLAYER DE VÍDEO
   ============================================= */

.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

.video-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.video-wrapper::before {
  content: '';
  display: block;
  padding-top: 56.25%; /* 16:9 */
}

.video-wrapper iframe,
.video-wrapper .local-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

.local-video { object-fit: contain; background: #000; }

.pdf-viewer {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.pdf-viewer__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 500;
  flex-wrap: wrap;
}

.pdf-viewer__toolbar span { flex: 1; }
.pdf-viewer__embed { display: block; width: 100%; height: 600px; border: none; }

/* Card de download para aulas em PDF */
.pdf-download-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 32px;
  background: var(--color-card);
  border: 1.5px dashed #fca5a5;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 20px;
}
.pdf-download-card__icon { line-height: 1; }
.pdf-download-card__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}
.pdf-download-card__sub {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 4px;
}
.pdf-download-card__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Conteúdo textual de aulas tipo texto */
.lesson-text-content {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--gray-700);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.lesson-text-content p { margin-bottom: 1em; }

.lesson-content {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--gray-700);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.lesson-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Sidebar da aula */
.lesson-sidebar {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.lesson-sidebar__title {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  background: var(--gray-50);
  border-bottom: 1px solid var(--color-border);
}

.lesson-sidebar__module {
  padding: 8px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--color-border);
}

/* Scroll container da sidebar de aula */
.lesson-sidebar__scroll {
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}
.lesson-sidebar__scroll::-webkit-scrollbar { width: 3px; }
.lesson-sidebar__scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Accordion de módulos na sidebar de aula */
.ls-module__header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: var(--gray-50);
  border: none;
  border-bottom: 1px solid var(--color-border);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  cursor: pointer;
  text-align: left;
}
.ls-module__header:hover { background: #f1f5f9; }
.ls-module__chevron { flex-shrink: 0; transition: transform .2s; }
.ls-module__body { display: none; }
.ls-module--open .ls-module__body { display: block; }
.ls-module--open .ls-module__chevron { transform: rotate(180deg); }

.lesson-sidebar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 12.5px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--color-border);
  transition: background .1s;
  text-decoration: none;
}

.lesson-sidebar__item:hover { background: var(--gray-50); color: var(--color-primary); text-decoration: none; }
.lesson-sidebar__item.active { background: var(--blue-50); color: var(--color-primary); font-weight: 600; }

.lesson-sidebar__type { color: var(--gray-400); flex-shrink: 0; display: flex; align-items: center; }
.lesson-sidebar__name { flex: 1; line-height: 1.35; }
.lesson-sidebar__duration { font-size: 11px; color: var(--gray-400); white-space: nowrap; margin-left: auto; }

/* =============================================
   BREADCRUMB
   ============================================= */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--color-primary); }
.breadcrumb svg { flex-shrink: 0; color: var(--gray-300); }

/* =============================================
   EDITOR DE CURSO — módulos e aulas
   ============================================= */

.module-editor {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.module-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1.5px solid var(--color-border);
}

.module-editor__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-800);
}

.lesson-editor-list { padding: 4px 0; }

.lesson-editor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .15s;
}

.lesson-editor-item:last-child { border-bottom: none; }
.lesson-editor-item:hover { background: var(--gray-50); }

.lesson-editor__type { flex-shrink: 0; display: flex; align-items: center; }

.lesson-editor__name {
  flex: 1;
  font-size: 13px;
  color: var(--gray-700);
  font-weight: 500;
}

.lesson-editor__duration {
  font-size: 11.5px;
  color: var(--color-muted);
  white-space: nowrap;
}

.lesson-editor__url {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.lesson-editor__actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.module-add-form {
  padding: 16px 20px;
  background: var(--gray-50);
  border-top: 1.5px solid var(--color-border);
  margin-top: 12px;
}

/* =============================================
   TOPBAR AVATAR
   ============================================= */

.topbar-profile-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .75rem .35rem .35rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--color-text);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s;
  border: 1.5px solid #e2e8f0;
}
.topbar-profile-btn:hover { background: #f1f5f9; }

.topbar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.topbar-avatar--placeholder {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.topbar-profile-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =============================================
   PERFIL — VIEW
   ============================================= */

.profile-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 1rem;
}
.profile-card__cover {
  height: 90px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
}
.profile-card__body {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  padding: 0 1.5rem 1.25rem;
  position: relative;
}
.profile-card__avatar-wrap {
  margin-top: -40px;
  flex-shrink: 0;
}
.profile-card__avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  display: block;
}
.profile-card__avatar--placeholder {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.profile-card__info { flex: 1; padding-bottom: .25rem; }
.profile-card__name { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin: 0; }
.profile-card__edit-btn { margin-left: auto; flex-shrink: 0; align-self: center; }
.profile-card__bio {
  padding: .75rem 1.5rem 1.25rem;
  font-size: .9rem;
  color: #475569;
  border-top: 1px solid #f1f5f9;
  line-height: 1.6;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.profile-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}
.profile-stat__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: .35rem;
}
.profile-stat__label { font-size: .8rem; color: #64748b; }

/* =============================================
   PERFIL — EDIÇÃO
   ============================================= */

.profile-edit-avatar-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
}
.profile-edit-avatar-label {
  position: relative;
  cursor: pointer;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}
.profile-edit-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.profile-edit-avatar--placeholder {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700;
}
.profile-edit-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  opacity: 0;
  transition: opacity .2s;
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  text-align: center;
}
.profile-edit-avatar-label:hover .profile-edit-avatar-overlay { opacity: 1; }

.profile-edit-avatar-wrap { position: relative; flex-shrink: 0; }

.profile-edit-avatar-remove {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--color-border);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background .15s, transform .15s;
}

.profile-edit-avatar-remove:hover { background: #fef2f2; transform: scale(1.06); }

.profile-edit-full { grid-column: 1 / -1; }

.profile-edit-security {
  border-top: 1px solid #f1f5f9;
  padding: 1.25rem 1.5rem;
  background: #fafafa;
}

/* =============================================
   MODAL DE CONFIRMAÇÃO
   ============================================= */

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-modal__box {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 48px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05);
  animation: slideUp .2s ease;
  text-align: center;
}

.confirm-modal__icon {
  width: 56px; height: 56px;
  background: #fef2f2;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.confirm-modal__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.confirm-modal__text {
  font-size: 13.5px;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-modal__actions .btn {
  min-width: 110px;
}

/* =============================================
   APROVAÇÃO — PÁGINA PENDENTE
   ============================================= */

.pending-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  padding: 24px;
}

.pending-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.pending-card__icon { font-size: 40px; margin-bottom: 16px; }
.pending-card__title { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.02em; }
.pending-card__text { color: var(--color-muted); font-size: 14px; line-height: 1.75; margin-bottom: 24px; }

/* =============================================
   ADMIN — USUÁRIOS
   ============================================= */

.user-list { display: flex; flex-direction: column; gap: 8px; }

.user-item {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}

.user-item:hover { box-shadow: var(--shadow); }

.user-item__avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}

.user-item__info { flex: 1; min-width: 0; }
.user-item__name { font-weight: 600; font-size: 14px; }
.user-item__meta { font-size: 12px; color: var(--color-muted); margin-top: 1px; }

.user-item__actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* =============================================
   CERTIFICADO
   ============================================= */

.certificate {
  background: #fff;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 56px;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.certificate::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--color-primary), #6366f1);
}

.certificate__name { font-size: 28px; font-weight: 800; color: var(--color-primary); margin: 8px 0; letter-spacing: -.02em; }
.certificate__course { font-size: 18px; font-weight: 600; margin: 8px 0; }
.certificate__code { color: var(--color-muted); font-size: 12.5px; margin-top: 24px; font-family: monospace; }

/* =============================================
   ESTADO VAZIO
   ============================================= */

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state__icon { color: var(--gray-300); margin: 0 auto 12px; display: flex; justify-content: center; }
.empty-state__title { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.empty-state__text { font-size: 13.5px; color: var(--color-muted); line-height: 1.6; }

/* =============================================
   PRINT
   ============================================= */

@media print {
  .sidebar, .topbar, .btn:not(.btn--print), .lesson-sidebar { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .certificate { box-shadow: none; border: 2px solid #000; }
}

/* =============================================
   RESPONSIVO
   ============================================= */

@media (max-width: 1024px) {
  .course-detail-layout, .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; max-height: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.sidebar--open { transform: translateX(0); }
  .sidebar-close-btn { display: flex; }
  .app-main { margin-left: 0; }
  .app-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hamburger-btn { display: flex; }
  .sidebar__overlay.sidebar__overlay--open { display: block; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__title {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .topbar-profile-btn { padding: .3rem .5rem .3rem .3rem; gap: .4rem; }
  .topbar-profile-name { max-width: 90px; }

  .page-header { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 400px) {
  .topbar-profile-name { display: none; }
  .topbar-profile-btn { padding: .3rem; border-width: 1px; }
}
