/* =====================================================
   CURSA — Plataforma de Cursos Rápidos & Treinamentos
   Design System / Shared Styles
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Tokens ────────────────────────────────────────── */
:root {
  --navy:        #0F1629;
  --navy-mid:    #1A2744;
  --navy-light:  #243558;
  --cyan:        #00C2FF;
  --cyan-dim:    #0099CC;
  --cyan-glow:   rgba(0, 194, 255, 0.18);
  --surface:     #F7F9FC;
  --surface-2:   #EEF2F7;
  --white:       #FFFFFF;
  --text:        #1A1A2E;
  --text-mid:    #4A5568;
  --text-soft:   #8A9AB5;
  --success:     #10B981;
  --warning:     #F59E0B;
  --danger:      #EF4444;
  --border:      #E2E8F0;
  --sidebar-w:   240px;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);
  --transition:  .18s ease;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.55;
  font-size: 1.1rem;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ── Layout Shell ───────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow: hidden;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Topbar Profile Menu ───────────────────────────── */
.topbar-profile-menu { position: relative; display: flex; align-items: center; }
.profile-trigger {
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .18s;
}
.profile-trigger:hover { border-color: var(--cyan); }
.profile-trigger .avatar { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; color: var(--white); background: var(--navy-light); }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all .18s ease;
  z-index: 300;
}
.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
}
.profile-dropdown-info { flex: 1; min-width: 0; }
.profile-dropdown-name { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-dropdown-email { font-size: .7rem; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-mid);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.profile-dropdown-item:hover { background: var(--surface); color: var(--text); }
.profile-dropdown-item svg { flex-shrink: 0; }
.profile-dropdown-danger { color: var(--danger); }
.profile-dropdown-danger:hover { background: rgba(239,68,68,.06); color: var(--danger); }
.logo-icon {
  width: 34px; height: 34px;
  background: var(--cyan);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { color: var(--navy); }
.logo-text { font-size: 1.15rem; font-weight: 800; color: var(--white); letter-spacing: -.3px; }
.logo-text span { color: var(--cyan); }
.logo-text-light { font-size: 1.15rem; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.logo-text-light span { color: var(--cyan); }

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: 18px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  border-radius: 0;
  position: relative;
  transition: color var(--transition), background var(--transition);
}
.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,.04);
}
.nav-item.active {
  color: var(--cyan);
  background: var(--cyan-glow);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--cyan);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { flex-shrink: 0; }
.nav-badge { background: var(--cyan); color: var(--navy); font-size: .6rem; font-weight: 800; padding: 1px 6px; border-radius: 100px; margin-left: auto; line-height: 1.4; }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--navy-light);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .8rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .7rem; color: var(--text-soft); }
.sidebar-logout { color: var(--text-soft); padding: 4px; border-radius: 6px; transition: color var(--transition); }
.sidebar-logout:hover { color: var(--danger); }

/* ── Main Area ──────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mid);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── Page Content ───────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 32px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--cyan);
  color: var(--navy);
}
.btn-primary:hover {
  background: var(--cyan-dim);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}
.btn-outline {
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  padding: 9px 14px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-p { padding: 24px; }

/* ── Badge ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-cyan { background: rgba(0,194,255,.12); color: var(--cyan-dim); }
.badge-green { background: rgba(16,185,129,.12); color: var(--success); }
.badge-orange { background: rgba(245,158,11,.12); color: var(--warning); }

/* ── Progress Bar ────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #0099ff);
  border-radius: 100px;
  transition: width .5s ease;
}
.progress-fill.done { background: linear-gradient(90deg, var(--success), #059669); }

/* ── Star Rating ─────────────────────────────────────── */
.stars { display: flex; gap: 2px; }
.star { color: var(--warning); font-size: 14px; }
.star.empty { color: var(--border); }

/* ── Avatar ──────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--navy-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-md { width: 40px; height: 40px; font-size: .9rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-initials { background: var(--navy-mid); }

/* ── Divider ─────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Page Header ─────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.page-header p { font-size: .875rem; color: var(--text-mid); margin-top: 4px; }

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state svg { color: var(--text-soft); margin: 0 auto 16px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-mid); }
.empty-state p { font-size: .875rem; color: var(--text-soft); margin-top: 4px; }

/* ── Utilities ────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-mid { color: var(--text-mid); }
.text-soft { color: var(--text-soft); }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.w-full { width: 100%; }
.grid { display: grid; }

/* ── Scroll to Top ──────────────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--cyan);
  color: var(--navy);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s ease, visibility .25s ease, transform .25s ease, background .18s;
  z-index: 999;
}
.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top:hover {
  background: var(--cyan-dim);
}

/* =====================================================
   FORMS (shared)
   ===================================================== */
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: .85rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: .75rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .875rem; font-family: 'Inter', sans-serif;
  color: var(--text); background: var(--white);
  outline: none; transition: border-color .18s, box-shadow .18s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-glow);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-soft); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A9AB5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px; cursor: pointer;
}
.form-hint { font-size: .72rem; color: var(--text-soft); margin-top: 4px; }
.form-error { font-size: .72rem; color: var(--danger); margin-top: 4px; }
.form-actions {
  display: flex; align-items: center; gap: 12px;
  padding-top: 20px; border-top: 1px solid var(--border); margin-top: 24px;
}

/* =====================================================
   TABLE
   ===================================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 11px 16px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-soft);
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; font-size: .85rem; color: var(--text-mid); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface); }
.table-actions { display: flex; gap: 6px; }

/* =====================================================
   TOGGLE
   ===================================================== */
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; cursor: pointer; display: inline-block; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  display: block; width: 100%; height: 100%;
  background: var(--border); border-radius: 100px;
  transition: background .2s ease;
}
.toggle input:checked + .toggle-track { background: var(--cyan); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--white); border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s ease;
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 500;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.modal-close {
  color: var(--text-soft); cursor: pointer; padding: 4px; border-radius: 6px;
  transition: color .18s; background: none; border: none; font-family: inherit;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 24px 20px;
}

/* =====================================================
   ALERT
   ===================================================== */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .83rem; display: flex; align-items: flex-start; gap: 10px;
}
.alert-info { background: rgba(0,194,255,.08); border: 1px solid rgba(0,194,255,.2); color: var(--cyan-dim); }
.alert-success { background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.2); color: var(--success); }
.alert-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); color: var(--warning); }
.alert-danger { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); color: var(--danger); }

/* =====================================================
   PLAN CARD
   ===================================================== */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.plan-card {
  border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 24px; text-align: center;
  transition: border-color .18s, box-shadow .18s;
  background: var(--white);
}
.plan-card:hover { border-color: var(--cyan); box-shadow: var(--shadow-md); }
.plan-card.featured { border-color: var(--cyan); background: rgba(0,194,255,.03); }
.plan-badge {
  display: none;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--cyan); margin-bottom: 8px;
}
.plan-card.featured .plan-badge { display: block; }
.plan-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.plan-price { font-size: 2.2rem; font-weight: 800; color: var(--text); margin-top: 8px; letter-spacing: -.03em; }
.plan-price span { font-size: .9rem; font-weight: 400; color: var(--text-soft); }
.plan-desc { font-size: .8rem; color: var(--text-mid); margin-top: 6px; }
.plan-features { list-style: none; margin-top: 16px; text-align: left; }
.plan-features li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; font-size: .82rem; color: var(--text-mid);
  border-bottom: 1px solid var(--border);
}
.plan-features li:last-child { border-bottom: none; }
.plan-features li svg { flex-shrink: 0; }

/* =====================================================
   STATUS DOT
   ===================================================== */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  margin-right: 6px;
}
.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--text-soft); }
.status-dot.warning { background: var(--warning); }

/* =====================================================
   RESPONSIVE / MOBILE
   ===================================================== */
.menu-toggle {
  display: none; width: 36px; height: 36px; border-radius: 8px;
  align-items: center; justify-content: center; color: var(--text-mid);
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.menu-toggle:hover { background: var(--surface-2); color: var(--text); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 99; opacity: 0; transition: opacity .25s ease;
}
.sidebar-overlay.open { opacity: 1; }

@media (max-width: 1024px) {
  .lesson-sidebar { display: none !important; }
  .treinamento-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  html { font-size: 15px; }
  body { overflow-x: hidden; }
  .app-shell { overflow-x: hidden; max-width: 100vw; }
  .main { margin-left: 0; width: 100%; max-width: 100vw; }
  img, iframe, video, table { max-width: 100% !important; }

  .menu-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%); transition: transform .25s ease;
    width: 260px; z-index: 101;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; }

  .topbar { padding: 0 16px; height: 54px; }
  .topbar-title { font-size: .9rem; }

  .page-content { padding: 20px 16px; }

  .page-header h1 { font-size: 1.2rem; }
  .page-header p { font-size: .8rem; }

  .welcome-hero { flex-direction: column; text-align: center; padding: 28px 20px; }
  .welcome-hero h1 { font-size: 1.2rem; }
  .welcome-hero::after { display: none; }
  .hero-stats { justify-content: center; gap: 20px; flex-wrap: wrap; }
  .hero-stat-val { font-size: 1.2rem; }
  .dashboard-cols { grid-template-columns: 1fr; }

  .courses-grid, .formacao-grid, .treinamento-grid { grid-template-columns: 1fr; }

  .course-row { flex-direction: column; }
  .course-row-thumb { width: 100%; min-height: auto; aspect-ratio: 16/9; }

  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }

  .lesson-infobar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
  .lesson-infobar h1 { font-size: .95rem; }
  .lesson-nav-btns { width: 100%; justify-content: flex-end; }

  .lesson-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 4px; padding-bottom: 4px; flex-wrap: nowrap; }
  .lesson-tab { padding: 9px 12px; font-size: .8rem; white-space: nowrap; }

  .lesson-content { padding: 16px; }

  .topbar-actions { gap: 4px; }
  .topbar-actions .btn { font-size: .75rem; padding: 5px 10px; }
  .topbar-actions .lesson-complete-btn { font-size: .72rem; padding: 5px 10px; }

  .card-p { padding: 16px; }

  .plans-grid { grid-template-columns: 1fr; }

  .info-stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .course-category { font-size: .65rem; }
  .course-title { font-size: .82rem; }

  .form-row { grid-template-columns: 1fr; }

  .table-wrap { overflow-x: auto; }
  .table th, .table td { padding: 8px 10px; font-size: .78rem; white-space: nowrap; }
  .table-actions { flex-direction: column; gap: 4px; }

  .modal { max-width: 100%; margin: 10px; border-radius: var(--radius); }
  .modal-header { padding: 16px 18px 0; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 0 18px 16px; }

  .filter-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .filter-btn { white-space: nowrap; font-size: .75rem; padding: 6px 12px; }

  div[style*="display:grid;grid-template-columns:1fr 320px;"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }

  .page-content { padding: 16px 12px; }

  .topbar-title { font-size: .85rem; }
  .btn { font-size: .82rem; padding: 8px 16px; }
  .btn-sm { font-size: .75rem; padding: 5px 10px; }

  .hero-stats { gap: 12px; }
  .hero-stat-val { font-size: 1.1rem; }

  .course-thumb { aspect-ratio: 4/3; }

  .qa-item-header { flex-wrap: wrap; }
  .qa-item-time { margin-left: 0; width: 100%; }

  .star-pick { font-size: 1.5rem; }
}

/* =====================================================
   MINHAS COMPRAS RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  .compras-tabs { overflow-x: auto; flex-wrap: nowrap; gap: 4px; padding-bottom: 4px; }
  .compras-tab { white-space: nowrap; padding: 10px 14px; font-size: .8rem; }
  .compra-card { flex-direction: column; }
  .compra-thumb { width: 100% !important; min-height: auto !important; aspect-ratio: 16/9; }
  .compra-body { flex-direction: column; align-items: flex-start !important; gap: 10px; padding: 14px 16px; }
  .compra-right { flex-direction: row !important; align-items: center !important; width: 100%; justify-content: space-between; }
  div[style*="width:100px;"] { width: 100% !important; max-width: 120px; }
}

/* =====================================================
   FORMACAO (DETAIL) RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  .course-hero { flex-direction: column; padding: 24px 20px; gap: 16px; }
  .course-hero::before { display: none; }
  .hero-thumb { width: 100% !important; height: auto !important; aspect-ratio: 16/9; border-radius: 10px; }
  .hero-title { font-size: 1.15rem; }
  .hero-desc { font-size: .8rem; }
  .hero-right { width: 100%; align-items: stretch !important; }
  .hero-right .btn { justify-content: center; }
  .progress-big { min-width: auto !important; width: 100%; }
  .course-tabs { overflow-x: auto; flex-wrap: nowrap; gap: 4px; padding-bottom: 4px; }
  .course-tab { white-space: nowrap; padding: 10px 14px; font-size: .8rem; }
  .course-detail-cols { grid-template-columns: 1fr !important; }
  .module-title { font-size: .72rem; }
  .lesson-row { padding: 10px 8px; gap: 8px; }
  .lesson-title { font-size: .8rem; }
  .lesson-duration { font-size: .65rem; }
  .lesson-play { display: none; }
  .lesson-num { width: 16px; font-size: .65rem; }
  .info-stat-grid { gap: 8px; }
  .info-stat { padding: 10px; }
  .info-stat-val { font-size: 1rem; }
}

/* ── Code rendering in content ─────────────────────── */
.qa-item-q code,
.qa-answer-content code,
.qa-item div[style*="line-height:1.6"] code {
  font-family: 'Courier New', monospace;
  background: #f1f3f5;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .82rem;
  color: #e03131;
}
.qa-item-q pre,
.qa-answer-content pre,
.qa-item div[style*="line-height:1.6"] pre {
  background: #1a1b26;
  color: #a9b1d6;
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  font-size: .82rem;
  line-height: 1.6;
  border: 1px solid #2a2b3e;
  font-family: 'Courier New', 'Consolas', monospace;
}
.qa-item-q pre code,
.qa-answer-content pre code,
.qa-item div[style*="line-height:1.6"] pre code {
  background: none;
  padding: 0;
  color: #a9b1d6;
  font-size: inherit;
  font-family: inherit;
}

/* =====================================================
   ADMIN PAGES RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  .form-section { margin-bottom: 20px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { justify-content: center; }
  .table-wrap { overflow-x: auto; }
  .table th, .table td { padding: 8px 10px; font-size: .75rem; white-space: nowrap; }
  .table-actions { flex-direction: row; gap: 4px; }
  .table-actions .btn-sm { font-size: .7rem; padding: 4px 8px; }
}

/* =====================================================
   AULA PAGE RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  .topbar .lesson-complete-btn { font-size: .7rem !important; padding: 4px 8px !important; white-space: nowrap; }
  .topbar .btn-ghost { font-size: .72rem !important; padding: 4px 8px !important; }
  .topbar > button + div { font-size: .78rem !important; min-width: 0; overflow: hidden; }
  .topbar > button + div a { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar > button + div span:last-child { font-size: .82rem; }
  .topbar-actions span[style*="font-size:.75rem"] { display: none; }
  .lesson-infobar { padding: 12px 16px; }
  .lesson-infobar h1 { font-size: .9rem; }
  .lesson-nav-btns { gap: 4px; }
  .lesson-nav-btns .btn { font-size: .72rem; padding: 5px 10px; }
  .lesson-nav-btns .btn svg { width: 12px; height: 12px; }
  .lesson-content { padding: 16px; }
  .qa-form > form > div[style*="display:flex"] { flex-direction: column; }
  .qa-form .avatar { display: none; }
  .lesson-tab { padding: 8px 10px; font-size: .75rem; }
  .lesson-tab span[style*="background:var(--cyan)"] { font-size: .6rem !important; padding: 1px 5px !important; }
  .topbar .btn-ghost svg, .topbar .lesson-complete-btn svg { width: 12px; height: 12px; }
  .topbar .btn-ghost span, .topbar .lesson-complete-btn span { display: none; }
  .topbar .btn-ghost { font-size: 0 !important; padding: 6px 8px !important; }
  .topbar .btn-ghost svg { width: 16px; height: 16px; margin: 0; }
  .topbar .lesson-complete-btn { font-size: 0 !important; padding: 6px 8px !important; }
  .topbar .lesson-complete-btn svg { width: 16px; height: 16px; margin: 0; }
  .topbar .lesson-complete-btn.done { font-size: 0 !important; }
  .topbar .lesson-complete-btn.done svg { width: 16px; height: 16px; }
  .topbar .icon-btn { width: 32px; height: 32px; }
}

/* =====================================================
   FOOTER BAR
   ===================================================== */
.footer-bar {
  background: #000;
  color: rgba(255,255,255,.9);
  font-size: .7rem;
  padding: 8px 20px;
  z-index: 200;
  line-height: 1.5;
}
.footer-admin { border-top: 1px solid rgba(255,255,255,.05); }
.footer-site { border-top: none; }
.footer-wrap { margin-top: auto; }
.footer-inner {
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}
.footer-copy {
  color: #fff;
  font-size: .7rem;
  letter-spacing: .02em;
}
.footer-version {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: .7rem;
  transition: opacity .15s;
}
.footer-version:hover { opacity: .7; }

/* =====================================================
   CHANGELOG MODAL
   ===================================================== */
.changelog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .3s ease;
}
.changelog-overlay.open {
  display: flex;
  opacity: 1;
}
.changelog-card {
  background: var(--white);
  border-radius: 20px;
  width: 100%;
  max-width: 460px;
  padding: 36px 32px 28px;
  position: relative;
  box-shadow: 0 25px 60px rgba(0,0,0,.25);
  animation: changelog-pop .35s cubic-bezier(.21,1.02,.73,1);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes changelog-pop {
  0% { transform: scale(.92) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.changelog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.changelog-close:hover { background: var(--surface-2); color: var(--text); }
.changelog-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.changelog-icon svg {
  background: rgba(0,194,255,.1);
  border-radius: 16px;
  padding: 10px;
}
.changelog-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -.3px;
}
.changelog-desc {
  font-size: .85rem;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 20px;
}
.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.changelog-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .82rem;
  color: var(--text-mid);
  line-height: 1.4;
  padding: 6px 0;
}
.changelog-list li svg {
  flex-shrink: 0;
  margin-top: 3px;
}
.changelog-more {
  justify-content: center !important;
  padding-top: 4px !important;
}
.changelog-more a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
  font-size: .82rem;
  transition: opacity .15s;
}
.changelog-more a:hover { opacity: .75; }
.changelog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.changelog-actions .btn-ghost {
  flex: 1;
  justify-content: center;
  font-size: .82rem;
  color: var(--text-soft);
}
.changelog-actions .btn-primary {
  flex: 1;
  justify-content: center;
  font-size: .85rem;
  padding: 10px 20px;
  gap: 6px;
}