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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand - alinhado ao LP Cursos (atualizacao.palicurso.com.br) */
  --primary-start: #17114a;
  --primary-mid:   #1f1662;
  --primary-end:   #3a52c9;
  --primary-gradient: linear-gradient(135deg, var(--primary-start), var(--primary-mid) 50%, var(--primary-end));

  /* Surfaces */
  --bg:      #f5f5f9;
  --surface: #ffffff;
  --border:  #e5e7eb;
  --muted:   #6b7280;

  /* Text */
  --text:    #1f1f36;

  /* Feedback */
  --success: #059669;
  --danger:  #dc2626;
  --warning: #d97706;
  --info:    #2563eb;

  /* Accent chips */
  --chip-bg:   #eef2ff;
  --chip-text: #4338ca;

  /* Misc */
  --shadow-sm: 0 2px 8px rgba(22, 30, 84, 0.07);
  --shadow:    0 6px 20px rgba(22, 30, 84, 0.10);
  --shadow-lg: 0 15px 40px rgba(22, 30, 84, 0.13);
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --font: 'Montserrat', 'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--primary-gradient);
  color: #fff;
  padding: 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.navbar-brand:hover { text-decoration: none; }
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.navbar-nav { display: flex; gap: .5rem; align-items: center; }
.navbar-nav a {
  color: rgba(255,255,255,.82);
  font-size: .875rem;
  font-weight: 500;
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  transition: background .18s, color .18s;
}
.navbar-nav a:hover { color: #fff; background: rgba(255,255,255,.12); text-decoration: none; }
.navbar-nav a.active { color: #fff; background: rgba(255,255,255,.18); font-weight: 600; }

.btn-logout {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: .4rem .9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font);
  transition: background .18s;
}
.btn-logout:hover { background: rgba(255,255,255,.24); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 2rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.3rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, opacity .18s;
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 6px 18px rgba(27, 17, 99, 0.28);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(27, 17, 99, 0.35); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--chip-bg); color: var(--primary-mid); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 8px 18px rgba(220, 38, 38, 0.35); }

.btn-sm  { padding: .35rem .8rem; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .4rem;
  color: var(--muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.check-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; font-weight: 500; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-error   { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-info    { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.alert-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }

/* ── Auth page ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--primary-gradient);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 40%, rgba(58,82,201,.35) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(23,17,74,.5) 0%, transparent 55%);
  pointer-events: none;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: 0 24px 64px rgba(22, 30, 84, 0.35);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo-img {
  height: 52px;
  width: auto;
  display: block;
  margin: 0 auto .8rem;
}
.auth-logo p  { color: var(--muted); font-size: .875rem; margin-top: .3rem; font-weight: 500; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { padding: 2rem 0 1.2rem; }
.page-header h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; }
.page-header p  { color: var(--muted); margin-top: .3rem; font-size: .9rem; }

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary-gradient);
}
.stat-card .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--primary-start); letter-spacing: -.02em; }
.stat-card .sub   { font-size: .8rem; color: var(--muted); }

/* ── Course grid ─────────────────────────────────────────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}
.course-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .22s, box-shadow .22s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.course-thumb {
  height: 140px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.course-body { padding: 1.2rem; }
.course-body h3 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; }
.course-body p  { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.progress-bar  { height: 5px; background: #e5e7eb; border-radius: 3px; margin-top: .9rem; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary-gradient); border-radius: 3px; transition: width .5s; }

/* ── Admin tiles ─────────────────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.admin-tile {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: transform .22s, box-shadow .22s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.admin-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.admin-tile .icon { font-size: 2.2rem; margin-bottom: .9rem; }
.admin-tile h3 { font-size: .95rem; font-weight: 700; }
.admin-tile p  { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; background: #fafafa; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f7ff; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-admin    { background: #ede9fe; color: #5b21b6; }
.badge-teacher  { background: #dbeafe; color: #1e40af; }
.badge-student  { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-pub      { background: #d1fae5; color: #065f46; }
.badge-draft    { background: #fef3c7; color: #92400e; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 10, 50, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%; max-width: 460px;
  box-shadow: 0 24px 64px rgba(22, 30, 84, 0.25);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.2rem; }
.modal-actions { display: flex; gap: .8rem; justify-content: flex-end; margin-top: 1.4rem; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-mid);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 3rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress bar (sidebar) ──────────────────────────────────────────────── */
.progress-bar-sm { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar-sm-fill { height: 100%; background: var(--primary-gradient); border-radius: 3px; }

/* ── Hero banner ─────────────────────────────────────────────────────────── */
.course-hero {
  background: var(--primary-gradient);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.course-hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  pointer-events: none;
}
.course-hero h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: .5rem; letter-spacing: -.01em; }
.course-hero p  { opacity: .85; max-width: 580px; font-size: .9rem; line-height: 1.6; }

/* ── Module / lesson list ────────────────────────────────────────────────── */
.module { margin-bottom: 1rem; scroll-margin-top: 80px; }
.module-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  user-select: none;
  transition: background .15s;
}
.module-header:hover { background: #f8f7ff; }
.module-header h3 { font-size: .95rem; font-weight: 700; }
.module-header .chevron { transition: transform .2s; font-size: .8rem; color: var(--muted); }

/* Módulo aberto: cabeçalho com o gradiente da marca - fica óbvio qual está aberto */
.module-header.open,
.module-header.open:hover { background: var(--primary-gradient); border-color: transparent; box-shadow: var(--shadow); }
.module-header.open h3 { color: #fff; }
.module-header.open .chevron { color: #fff; transform: rotate(180deg); }

/* Lições do módulo aberto: recuadas e com barra lateral, conectando ao cabeçalho */
.module-header.open + .lesson-list {
  border-left: 3px solid var(--primary-end);
  margin-left: .4rem; padding-left: .5rem; margin-top: 6px;
}

.lesson-list { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.lesson-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem 1.2rem;
  display: flex; align-items: center; gap: 1rem;
  text-decoration: none; color: var(--text);
  transition: background .15s, transform .15s;
}
.lesson-item:hover { background: #f8f7ff; transform: translateX(3px); text-decoration: none; }
.lesson-icon { font-size: 1.2rem; flex-shrink: 0; }
.lesson-info { flex: 1; min-width: 0; }
.lesson-info .title { font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-info .meta  { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-done       { background: #10b981; }
.dot-progress   { background: #f59e0b; }
.dot-notstarted { background: #d1d5db; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border); }
.tab {
  padding: .6rem 1.2rem; cursor: pointer; font-size: .875rem; font-weight: 600;
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font); transition: color .18s;
}
.tab.active { color: var(--primary-mid); border-bottom-color: var(--primary-mid); }
.tab:hover:not(.active) { color: var(--text); }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.hidden { display: none !important; }
.back-link {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--muted); font-size: .875rem; font-weight: 500;
  margin: 1.2rem 0 .5rem; transition: color .15s;
}
.back-link:hover { color: var(--primary-mid); text-decoration: none; }

/* Checkboxes */
input[type="checkbox"] { width:14px; height:14px; flex-shrink:0; cursor:pointer; accent-color:var(--primary); }

/* ── Cronograma / Próximos compromissos (dashboard) ──────────────────────── */
.schedule-band {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-end);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0 .4rem;
}
.schedule-band-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.schedule-band-head h3 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--primary-start); font-weight: 700; margin: 0;
}
.schedule-list { display: flex; flex-direction: column; gap: .15rem; }
.schedule-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem .2rem;
}
.schedule-item + .schedule-item { border-top: 1px solid var(--border); }
.schedule-item .ev-icon { font-size: 1.1rem; flex-shrink: 0; width: 1.6rem; text-align: center; }
.schedule-item .ev-body { flex: 1; min-width: 0; }
.schedule-item .ev-title { font-weight: 600; font-size: .92rem; color: var(--text); }
.schedule-item .ev-title a { color: var(--text); text-decoration: none; }
.schedule-item .ev-title a:hover { color: var(--primary-mid); text-decoration: underline; }
.schedule-item .ev-meta { font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.schedule-item .ev-when {
  flex-shrink: 0; font-size: .8rem; font-weight: 600; color: var(--primary-mid);
  background: var(--chip-bg); border-radius: 999px; padding: .25rem .65rem; white-space: nowrap;
}
.schedule-item.type-exam     .ev-when { color: var(--danger);  background: #fef2f2; }
.schedule-item.type-deadline .ev-when { color: var(--warning); background: #fffbeb; }

/* ── Próximo compromisso dentro do hero do curso ─────────────────────────── */
.hero-next-event {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .7rem;
  margin-top: 1rem; padding: .6rem .85rem;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
}
.hero-next-event .hne-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
}
.hero-next-event .hne-body { flex: 1; min-width: 0; color: #fff; font-size: .9rem; }
.hero-next-event .hne-body strong { font-weight: 700; }
.hero-next-event .hne-more {
  flex-shrink: 0; cursor: pointer; font-family: inherit;
  font-size: .8rem; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, .18); border: none;
  border-radius: 999px; padding: .35rem .8rem; transition: background .18s;
}
.hero-next-event .hne-more:hover { background: rgba(255, 255, 255, .32); }

/* Botão de fechar do modal de agenda */
.modal-x {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--muted); line-height: 1; padding: .2rem .4rem; border-radius: 8px;
}
.modal-x:hover { background: var(--bg); color: var(--text); }

/* ── Conteúdo bloqueado (liberação programada) ───────────────────────────── */
.module.module-locked { opacity: .85; }
.module-header.locked {
  cursor: default; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
}
.module-header.locked h3 { color: var(--muted); font-weight: 600; }
.lesson-item.lesson-locked {
  cursor: default; background: var(--bg); color: var(--muted);
}
.lesson-item.lesson-locked .title { color: var(--muted); }
.lesson-item.lesson-locked:hover { background: var(--bg); transform: none; }
.lock-badge {
  flex-shrink: 0; font-size: .72rem; font-weight: 600; white-space: nowrap;
  color: var(--chip-text); background: var(--chip-bg);
  border-radius: 999px; padding: .2rem .6rem;
}

/* Contrato (documento legal) - usado no overlay de aceite e na pagina /contrato */
.contract-doc { font-size: .9rem; line-height: 1.6; color: #1f2937; }
.contract-doc .ct-title { font-size: 1.05rem; text-align: center; margin: 0 0 1rem; color: #17114a; }
.contract-doc .ct-preamble { text-align: justify; margin: 0 0 1.2rem; }
.contract-doc .ct-h { font-size: .92rem; font-weight: 800; color: #17114a; margin: 1.4rem 0 .5rem; text-transform: uppercase; letter-spacing: .02em; }
.contract-doc .ct-c { text-align: justify; margin: 0 0 .7rem; }
.contract-doc .ct-c .ct-n { font-weight: 700; color: #4338ca; margin-right: .35rem; }
.contract-doc .ct-sub { margin-left: 1.3rem; }
.contract-doc .ct-sign { margin: 1.1rem 0 0; font-weight: 600; }
.contract-doc a { color: var(--primary-mid); }
