/* ═══════════════════════════════════════════════════════════════════════════
   Expansão Noturna — tema próprio: céu noturno, índigo/violeta, lua.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #080a14;
  --bg2: #0d1026;
  --panel: rgba(20, 24, 48, 0.72);
  --panel-solid: #121631;
  --panel2: #1a1f42;
  --linha: rgba(148, 163, 255, 0.14);
  --texto: #eef1ff;
  --muted: #9aa3c7;
  --indigo: #6366f1;
  --indigo-hi: #818cf8;
  --violeta: #a855f7;
  --lua: #fde68a;
  --ok: #34d399;
  --fire: #f59e0b;
  --erro: #f87171;
  --radius: 22px;
  --sombra: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--texto);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Céu de fundo ─────────────────────────────────────────────────────── */
.ceu {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(900px 600px at 78% -10%, rgba(99, 102, 241, 0.28), transparent 65%),
    radial-gradient(700px 500px at 8% 110%, rgba(168, 85, 247, 0.20), transparent 65%),
    linear-gradient(180deg, #070912 0%, #0a0d20 55%, #0c0a1f 100%);
}
.lua {
  position: absolute; top: 8%; right: 12%;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7d6, #fde68a 55%, #fbbf24 100%);
  box-shadow: 0 0 80px 20px rgba(253, 230, 138, 0.22), 0 0 180px 60px rgba(253, 230, 138, 0.08);
  opacity: .85;
}
.brilho {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 120%, rgba(99, 102, 241, 0.18), transparent 60%);
}
.estrelas { position: absolute; inset: 0; }
.estrelas span {
  position: absolute; border-radius: 50%; background: #e0e7ff;
  animation: piscar var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--atraso, 0s);
}
@keyframes piscar {
  0%, 100% { opacity: .15; transform: scale(.8); }
  50% { opacity: .95; transform: scale(1); }
}

/* ── Logo / marca ─────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 14px; justify-content: center; }
.brand.small { justify-content: flex-start; gap: 10px; }
.lua-logo { width: 56px; height: 56px; filter: drop-shadow(0 8px 22px rgba(129, 140, 248, .45)); }
.lua-logo svg { width: 100%; height: 100%; }
.lua-logo.mini { width: 34px; height: 34px; }
.wordmark {
  font-weight: 800; font-size: 1.55rem; letter-spacing: -.6px;
  background: linear-gradient(100deg, #fff 0%, #c7d2fe 55%, #a855f7 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark em { font-style: normal; font-weight: 900; color: transparent; }
.brand.small .wordmark { font-size: 1.2rem; }

/* ── Login ────────────────────────────────────────────────────────────── */
.wrap-login {
  position: relative; z-index: 1; min-height: 100vh;
  display: grid; place-items: center; padding: 24px;
}
.card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--linha);
  border-radius: var(--radius);
}
.login {
  width: 100%; max-width: 420px; padding: 38px 32px 26px;
  display: flex; flex-direction: column; gap: 18px;
  box-shadow: var(--sombra);
  animation: subir .5s cubic-bezier(.2, .8, .2, 1);
}
@keyframes subir { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.sub { color: var(--muted); font-size: .96rem; text-align: center; line-height: 1.5; }
.sub strong { color: var(--indigo-hi); }

#form-login { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.field input {
  font-family: inherit; font-size: 1rem; padding: 13px 15px;
  border-radius: 13px; border: 1px solid var(--linha);
  background: rgba(255, 255, 255, 0.04); color: var(--texto);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input::placeholder { color: #5b6488; }
.field input:focus {
  outline: none; border-color: var(--indigo);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.senha-wrap { position: relative; }
.senha-wrap input { width: 100%; padding-right: 46px; }

/* RA + dígito: o dígito fica num campo curto à direita, como no site oficial. */
.ra-wrap { display: flex; align-items: center; gap: 8px; }
.ra-wrap input { flex: 1; min-width: 0; }
.ra-wrap .ra-digito {
  flex: 0 0 52px; width: 52px; text-align: center; font-weight: 700;
  text-transform: uppercase;
}
.ra-hifen { color: var(--muted); font-weight: 700; font-size: 1.1rem; user-select: none; }
.ver {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; cursor: pointer; font-size: 1rem;
  opacity: .6; padding: 6px; border-radius: 8px;
}
.ver:hover { opacity: 1; background: rgba(255,255,255,.06); }

.btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700;
  font-size: .95rem; border-radius: 13px; padding: 12px 16px;
  transition: filter .15s, transform .1s, background .15s, opacity .15s;
  color: var(--texto); text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violeta) 100%);
  box-shadow: 0 10px 30px -8px rgba(129, 140, 248, .6);
  color: #fff;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ghost { background: rgba(255, 255, 255, .07); color: var(--texto); border: 1px solid var(--linha); }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.btn.fire {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #1a1207; box-shadow: 0 10px 26px -10px rgba(249, 115, 22, .7);
}
.btn.fire:hover:not(:disabled) { filter: brightness(1.08); }

.msg { font-size: .9rem; text-align: center; padding: 11px 14px; border-radius: 12px; line-height: 1.45; }
.msg.erro { background: rgba(248, 113, 113, .12); color: #fca5a5; border: 1px solid rgba(248, 113, 113, .3); }
.aviso { color: #6b739a; font-size: .78rem; text-align: center; margin-top: 2px; }

/* ── Dashboard ────────────────────────────────────────────────────────── */
#dash { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topo {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 18px 32px;
  border-bottom: 1px solid var(--linha);
  background: rgba(8, 10, 20, 0.55);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 20;
}
.acoes-topo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.usuario { display: flex; align-items: center; gap: 10px; margin-right: 4px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem; color: #fff;
  background: linear-gradient(135deg, var(--indigo), var(--violeta));
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
.usuario-info { display: flex; flex-direction: column; line-height: 1.2; }
.usuario-info strong { font-size: .92rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-info small { color: var(--muted); font-size: .75rem; letter-spacing: .5px; }
.sair { padding: 9px 15px; font-size: .88rem; }

.painel { width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 32px 70px; flex: 1; }

.sect-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.sect-head h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.4px; }
.contador { color: var(--muted); font-size: .88rem; }

/* ── Grade de cursos ──────────────────────────────────────────────────── */
.grid-cursos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.curso-card {
  background: linear-gradient(160deg, rgba(30, 36, 72, .8), rgba(16, 20, 44, .85));
  border: 1px solid var(--linha); border-radius: 18px; padding: 20px;
  cursor: pointer; display: flex; flex-direction: column; gap: 12px;
  transition: transform .16s, border-color .16s, box-shadow .16s;
  position: relative; overflow: hidden;
  animation: subir .4s cubic-bezier(.2, .8, .2, 1) backwards;
}
.curso-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--indigo), var(--violeta));
  opacity: 0; transition: opacity .16s;
}
.curso-card:hover { transform: translateY(-3px); border-color: rgba(129, 140, 248, .5); box-shadow: 0 18px 40px -18px rgba(99, 102, 241, .5); }
.curso-card:hover::before { opacity: 1; }
.curso-card h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.35; letter-spacing: -.2px; }
.curso-card .resumo { color: var(--muted); font-size: .82rem; line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.curso-card .rodape { display: flex; align-items: center; gap: 10px; }
.curso-card .cod { font-size: .72rem; color: #6b739a; font-weight: 600; letter-spacing: .3px; }

/* ── Barra de progresso ───────────────────────────────────────────────── */
.barra { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; flex: 1; min-width: 60px; }
.barra.grande { height: 12px; margin: 14px 0; }
.barra-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--indigo), var(--violeta));
  border-radius: 99px; transition: width .4s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 14px rgba(129, 140, 248, .7);
}
.barra-fill.completa { background: linear-gradient(90deg, #10b981, var(--ok)); box-shadow: 0 0 14px rgba(52, 211, 153, .7); }
.barra-txt { font-size: .78rem; color: var(--muted); font-weight: 700; min-width: 38px; text-align: right; }

/* ── Tela do curso ────────────────────────────────────────────────────── */
.voltar { margin-bottom: 18px; padding: 9px 15px; font-size: .86rem; }
.curso-cabeca { padding: 24px 26px; display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.curso-cabeca h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.3px; line-height: 1.3; }
.curso-cabeca-info .muted { margin-top: 6px; }
.muted { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.barra-wrap { display: flex; align-items: center; gap: 12px; }

.curso-acoes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.pendentes-txt { color: var(--muted); font-size: .84rem; margin-left: auto; }

.filtros { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  background: rgba(255, 255, 255, .05); border: 1px solid var(--linha);
  color: var(--muted); padding: 7px 15px; border-radius: 99px;
  cursor: pointer; font-family: inherit; font-size: .82rem; font-weight: 600;
  transition: all .15s;
}
.chip:hover { color: var(--texto); background: rgba(255, 255, 255, .09); }
.chip.ativo { background: linear-gradient(135deg, var(--indigo), var(--violeta)); color: #fff; border-color: transparent; }

/* ── Atividades ───────────────────────────────────────────────────────── */
.secao-titulo {
  font-size: .78rem; font-weight: 800; color: var(--indigo-hi);
  text-transform: uppercase; letter-spacing: 1.2px; margin: 22px 0 10px;
}
.secao-titulo:first-child { margin-top: 0; }
.atividade {
  display: flex; align-items: center; gap: 13px;
  background: rgba(18, 22, 49, .6); border: 1px solid var(--linha);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 8px;
  transition: border-color .15s, background .15s;
}
.atividade:hover { border-color: rgba(129, 140, 248, .4); background: rgba(22, 27, 60, .7); }
.atividade .icone { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: rgba(99, 102, 241, .14); font-size: 1rem; }
.atividade .info { min-width: 0; flex: 1; }
.atividade .nome { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atividade .tipo { color: var(--muted); font-size: .76rem; margin-top: 2px; text-transform: capitalize; }
.atividade .estado { font-size: .74rem; font-weight: 700; padding: 5px 11px; border-radius: 99px; flex-shrink: 0; white-space: nowrap; }
.estado.ok { background: rgba(52, 211, 153, .14); color: var(--ok); }
.estado.pend { background: rgba(245, 158, 11, .14); color: var(--fire); }
.estado.sem { background: rgba(148, 163, 255, .12); color: var(--muted); }
.estado.falha { background: rgba(248, 113, 113, .14); color: var(--erro); }
/* Item encerrado por prazo: vermelho discreto + cadeado. */
.estado.fechado {
  background: rgba(248, 113, 113, .12); color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, .28);
}
.atividade.fechada { border-color: rgba(248, 113, 113, .18); background: rgba(28, 18, 24, .45); }
.atividade.fechada .nome { color: #c9b0b0; }
.dica.fechada { color: #c98b8b; border-left-color: rgba(248, 113, 113, .5); }
.atividade .mini-btn {
  background: rgba(255, 255, 255, .06); border: 1px solid var(--linha); color: var(--texto);
  border-radius: 9px; padding: 6px 12px; font-size: .78rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background .15s; flex-shrink: 0;
}
.atividade .mini-btn:hover { background: rgba(255, 255, 255, .13); }

/* Item que é apenas conteúdo (rótulo/texto): fica apagado. */
.atividade.content-only { opacity: .55; background: rgba(14, 17, 38, .4); }
.atividade.content-only .icone { background: rgba(148, 163, 255, .07); }

/* Explicação de por que o item não conclui sozinho. */
.atividade .dica {
  color: #8b93b8; font-size: .76rem; line-height: 1.45; margin-top: 5px;
  padding-left: 8px; border-left: 2px solid rgba(129, 140, 248, .35);
}
/* O botão "Abrir" é um link: mesmo visual do mini-btn. */

.vazio { color: var(--muted); font-style: italic; padding: 20px 4px; }

/* ── Modal de progresso ───────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(4, 6, 14, .78); backdrop-filter: blur(8px); padding: 20px;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 480px; padding: 28px;
  background: linear-gradient(160deg, #171b3d, #0e1130);
  border: 1px solid var(--linha); border-radius: var(--radius);
  box-shadow: var(--sombra); display: flex; flex-direction: column; gap: 6px;
  animation: subir .3s cubic-bezier(.2, .8, .2, 1);
}
.modal-card h3 { font-size: 1.2rem; font-weight: 800; letter-spacing: -.3px; }
#modal-status { font-size: .86rem; min-height: 1.3em; }
.modal-numeros { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap; }
.modal-numeros strong { color: var(--texto); font-size: 1rem; }
.modal-log {
  background: rgba(0, 0, 0, .35); border: 1px solid var(--linha); border-radius: 10px;
  padding: 10px 12px; font-size: .72rem; color: var(--muted); max-height: 140px;
  overflow: auto; margin-bottom: 12px; font-family: ui-monospace, monospace; white-space: pre-wrap;
}

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; background: var(--panel2); border: 1px solid var(--linha);
  border-radius: 14px; padding: 14px 20px; font-weight: 600; font-size: .9rem;
  max-width: min(92vw, 460px); box-shadow: var(--sombra);
  animation: subir .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.ok { border-color: rgba(52, 211, 153, .45); }
.toast.erro { border-color: rgba(248, 113, 113, .45); }

.spinner {
  width: 15px; height: 15px; display: inline-block; vertical-align: -2px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25);
  border-top-color: #fff; animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .topo { padding: 14px 16px; }
  .painel { padding: 22px 16px 60px; }
  .lua { width: 70px; height: 70px; top: 5%; right: 8%; }
  .usuario-info strong { max-width: 130px; }
  .wordmark { font-size: 1.15rem; }
  .login { padding: 30px 22px 20px; }
  .curso-acoes { gap: 8px; }
  .pendentes-txt { margin-left: 0; width: 100%; }
  #btn-abrir-moodle { flex: 1; }

  /* Atividade em duas linhas: nome em cima, estado e botão embaixo. */
  .atividade { flex-wrap: wrap; padding: 14px; gap: 10px; }
  .atividade .info { flex: 1 1 calc(100% - 48px); }
  .atividade .nome { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .atividade .estado { margin-left: 44px; }
  .atividade .mini-btn { margin-left: auto; }
}
