/* Eventos RSVP — CSS3 puro, mobile-first. Chave: P26-3A-DAD6-042E-642E-9A58 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1c2430;
  --text-muted: #556070;
  --border: #d6dbe3;
  --primary: #1f4e8c;
  --primary-hover: #173d6e;
  --primary-text: #ffffff;
  --focus: #f0a400;
  --ok: #1d6b3a;
  --ok-bg: #e2f3e8;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --danger: #a3242b;
  --danger-bg: #fbe5e6;
  --info: #1f4e8c;
  --info-bg: #e3ecf8;
  --bar-ok: #2f8a50;
  --bar-near: #c98a0c;
  --bar-full: #b8333a;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --gap: 1rem;
  --maxw: 64rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --surface-2: #232b36;
    --text: #e6eaf0;
    --text-muted: #a3adbb;
    --border: #333d4b;
    --primary: #6fa3e8;
    --primary-hover: #8fb8ee;
    --primary-text: #0d1726;
    --focus: #ffc94d;
    --ok: #7fd49c;
    --ok-bg: #173323;
    --warn: #f3c46b;
    --warn-bg: #3a2c10;
    --danger: #f19aa0;
    --danger-bg: #3d1a1d;
    --info: #9cc2f2;
    --info-bg: #1b2b42;
    --bar-ok: #4cae6d;
    --bar-near: #e0a531;
    --bar-full: #e0595f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.visualmente-oculto {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.pular {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: var(--primary-text);
  border-radius: var(--radius-sm);
}
.pular:focus { top: 0.5rem; }

/* ---------- Cabeçalho ---------- */
.topo {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topo__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.marca {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  margin-right: auto;
}
.marca__icone {
  display: inline-grid;
  place-items: center;
  width: 1.9rem; height: 1.9rem;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 1rem;
}
.topo__nav {
  order: 3;
  width: 100%;
  display: flex;
  gap: 1rem;
}
.topo__nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.topo__nav a:hover,
.topo__nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.usuario {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.25rem;
}
.usuario__nome {
  font-weight: 600;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Avisos (aria-live) ---------- */
.avisos {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}
.avisos:empty { display: none; }

.aviso {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}
.aviso p { margin: 0; }
.aviso--sucesso { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.aviso--info { background: var(--info-bg); color: var(--info); border-color: currentColor; }
.aviso--erro { background: var(--danger-bg); color: var(--danger); border-color: currentColor; }
.aviso--alerta { background: var(--warn-bg); color: var(--warn); border-color: currentColor; }
.aviso__fechar {
  background: none;
  border: 0;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

/* ---------- Conteúdo ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}
main:focus { outline: none; }

.cabecalho-pagina {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.cabecalho-pagina h1 { margin: 0; }

.estado {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.estado--erro { color: var(--danger); border-color: var(--danger); border-style: solid; }
.estado--carregando::before {
  content: "";
  display: inline-block;
  width: 1em; height: 1em;
  margin-right: 0.5em;
  vertical-align: -0.15em;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .estado--carregando::before { animation: none; }
}

/* ---------- Botões ---------- */
.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.botao:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.botao:disabled { opacity: 0.6; cursor: not-allowed; }
.botao--secundario {
  background: var(--surface);
  color: var(--primary);
}
.botao--secundario:hover { background: var(--surface-2); color: var(--primary-hover); }
.botao--perigo {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}
.botao--perigo:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.botao--pequeno { min-height: 2.1rem; padding: 0.3rem 0.75rem; font-size: 0.9rem; }
.botao--discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.botao--discord:hover { background: #4752c4; border-color: #4752c4; color: #fff; }

.acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- Filtro ---------- */
.filtro {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.filtro button {
  font: inherit;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
.filtro button + button { border-left: 1px solid var(--border); }
.filtro button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
}

/* ---------- Cartões ---------- */
.lista-eventos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}
.cartao {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: 100%;
}
.cartao__data {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: none;
}
.cartao__titulo { margin: 0; font-size: 1.1rem; }
.cartao__titulo a { color: var(--text); text-decoration: none; }
.cartao__titulo a:hover { text-decoration: underline; }
.cartao__local { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.cartao__rodape { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; }

/* ---------- Selos ---------- */
.selos { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.selo {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.selo--confirmado { color: var(--ok); background: var(--ok-bg); }
.selo--fila { color: var(--warn); background: var(--warn-bg); }
.selo--lotado { color: var(--danger); background: var(--danger-bg); }
.selo--vagas { color: var(--info); background: var(--info-bg); }
.selo--neutro { color: var(--text-muted); background: var(--surface-2); }

/* ---------- Barra de lotação ---------- */
.lotacao { display: flex; flex-direction: column; gap: 0.25rem; }
.lotacao__texto {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.lotacao__barra {
  height: 0.5rem;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.lotacao__preenchido {
  height: 100%;
  width: 0;
  background: var(--bar-ok);
  border-radius: inherit;
  transition: width 0.3s ease;
}
.lotacao--quase .lotacao__preenchido { background: var(--bar-near); }
.lotacao--cheio .lotacao__preenchido { background: var(--bar-full); }
@media (prefers-reduced-motion: reduce) {
  .lotacao__preenchido { transition: none; }
}

/* ---------- Detalhe ---------- */
.voltar { display: inline-block; margin-bottom: 0.75rem; }

.detalhe {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}
.painel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.painel > h2 { margin-bottom: 0.75rem; }

.info {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0.75rem 0 1rem;
}
.info dt { color: var(--text-muted); font-weight: 600; }
.info dd { margin: 0; overflow-wrap: anywhere; }

.descricao {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.nota { font-size: 0.9rem; color: var(--text-muted); margin: 0.5rem 0 0; }
.nota--alerta { color: var(--warn); }

.pessoas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
ol.pessoas { counter-reset: fila; }
.pessoa {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.pessoa__nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pessoa__posicao {
  flex: none;
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}
.pessoa--eu .pessoa__nome { font-weight: 700; }
.pessoa__tag { font-size: 0.8rem; color: var(--text-muted); }

.avatar {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
  border: 1px solid var(--border);
}
.avatar--pequeno { width: 1.75rem; height: 1.75rem; }

.criador {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---------- Formulário ---------- */
.formulario {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: grid;
  gap: 1rem;
  max-width: 40rem;
}
.campo { display: flex; flex-direction: column; gap: 0.3rem; }
.campo label { font-weight: 600; }
.campo .dica { font-size: 0.85rem; color: var(--text-muted); }
.campo input,
.campo textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  width: 100%;
}
.campo textarea { min-height: 7rem; resize: vertical; }
.campo input:focus-visible,
.campo textarea:focus-visible { border-color: var(--primary); outline-offset: 0; }
.campo [aria-invalid="true"] { border-color: var(--danger); }
.campo__erro {
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}
.campo__erro:empty { display: none; }
.linha { display: grid; gap: 1rem; grid-template-columns: 1fr; }

.erro-geral {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin: 0;
}
.erro-geral:empty { display: none; }

.cartao-login {
  max-width: 32rem;
  text-align: center;
}
.cartao-login .acoes { justify-content: center; }

/* ---------- Rodapé ---------- */
.rodape {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}
.rodape p { margin: 0; overflow-wrap: anywhere; }

/* ---------- Telas maiores ---------- */
@media (min-width: 40rem) {
  h1 { font-size: 1.75rem; }
  .topo__nav { order: 0; width: auto; }
  .lista-eventos { grid-template-columns: repeat(2, 1fr); }
  .linha { grid-template-columns: repeat(3, 1fr); }
  .usuario__nome { max-width: 14rem; }
}

@media (min-width: 60rem) {
  .lista-eventos { grid-template-columns: repeat(3, 1fr); }
  .detalhe { grid-template-columns: 3fr 2fr; align-items: start; }
  .detalhe__principal { grid-row: span 2; }
}
