:root {
  color-scheme: dark;
  --bg: #0b0f19;
  --bg-elevated: rgba(17, 24, 39, 0.82);
  --bg-soft: rgba(30, 41, 59, 0.55);
  --border: rgba(148, 163, 184, 0.16);
  --border-hover: rgba(129, 140, 248, 0.45);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.28);
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --info: #38bdf8;
  --radius: 14px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -15%, rgba(99, 102, 241, 0.22), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(139, 92, 246, 0.12), transparent);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

a {
  color: #818cf8;
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: #a5b4fc;
  text-decoration: none;
}

h1,
h2,
h3 {
  margin-top: 0;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin-bottom: 12px;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.container {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

main.container {
  flex: 1;
  padding-top: 8px;
  padding-bottom: 32px;
}

/* Navbar com efeito vidro */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 25, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 28px;
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 55%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: #cbd5e1;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nav-links a:hover {
  color: #ffffff;
  background-color: rgba(148, 163, 184, 0.12);
}

.nav-user {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0 6px;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.18s ease;
}

.btn:hover {
  color: #ffffff;
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.38);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border-color: var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: none;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.24);
}

.btn-success:hover {
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.36);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.84rem;
}

.btn-link-light {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid var(--border);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  font-family: inherit;
  font-weight: 500;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.btn-link-light:hover {
  background-color: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

/* Cards e animação de entrada */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--bg-elevated);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  animation: fadeUp 0.28s ease-out both;
}

.hero-card {
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.78),
    rgba(17, 24, 39, 0.92)
  );
  border-color: rgba(129, 140, 248, 0.22);
}

.hero-subtitle {
  color: var(--text-muted);
  margin: 0 0 18px 0;
  font-size: 0.98rem;
}

.grid-events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.event-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 0;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(99, 102, 241, 0.18);
}

.event-card h2 {
  margin: 10px 0 8px 0;
  font-size: 1.15rem;
}

.event-card h2 a {
  color: #f8fafc;
}

.event-card h2 a:hover {
  color: #a5b4fc;
}

.event-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 18px 0;
}

.event-meta strong {
  color: #cbd5e1;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.meta-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.meta-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
}

/* Mensagens Django */
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.msg {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  font-weight: 500;
  font-size: 0.94rem;
  animation: fadeUp 0.22s ease-out both;
}

.msg-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  border-left-color: var(--success);
  color: #6ee7b7;
}

.msg-error {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  border-left-color: var(--danger);
  color: #fda4af;
}

.msg-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  border-left-color: var(--warning);
  color: #fcd34d;
}

.msg-info,
.msg-debug {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  border-left-color: var(--info);
  color: #7dd3fc;
}

/* Filtros e Formulários */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-form input,
.filter-form select {
  flex: 1 1 210px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.filter-form input:focus,
.filter-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-box {
  max-width: 680px;
}

.auth-card {
  max-width: 480px;
  margin: 12px auto 24px auto;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: #e2e8f0;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.help-text {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 5px;
}

.help-text ul {
  margin: 4px 0 0 0;
  padding-left: 18px;
}

.errorlist {
  color: #fda4af;
  margin: 6px 0 0 0;
  padding-left: 18px;
  font-size: 0.86rem;
}

.sessao-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-soft);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(129, 140, 248, 0.28);
  color: #c7d2fe;
}

.badge-success {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

.badge-danger {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(251, 113, 133, 0.35);
  color: #fda4af;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

/* Tabelas */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(15, 23, 42, 0.65);
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

th {
  background: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background: rgba(99, 102, 241, 0.07);
}

tbody tr:last-child td {
  border-bottom: none;
}

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0 8px 0;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.footer {
  margin-top: auto;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.86rem;
  text-align: center;
  background: rgba(11, 15, 25, 0.55);
}

@media (max-width: 640px) {
  .card {
    padding: 18px;
  }

  h1 {
    font-size: 1.45rem;
  }
}
