:root {
  --bg: #f0f1f4;
  --surface: #ffffff;
  --surface-soft: #f6f9ff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #00aaff;
  --primary-strong: #1643f5;
  --border: #d7dee8;
  --danger: #b91c1c;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: url('backgroundLogin.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, #00aaff 0%, #1a66ff 100%);
  border-bottom: 2px solid #1643f5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transition: box-shadow 0.3s ease;
}

.topbar__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  min-width: 0;
}

.brand img {
  width: 180px;
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
}

.brand span {
  font-weight: 700;
  color: #ffffff;
  font-size: 1rem;
}

/* Menu hamburguer para mobile */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
  z-index: 101;
}

.menu-toggle:hover {
  transform: scale(1.1);
}

.menu-toggle:active {
  transform: scale(0.95);
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a,
.nav button {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav a:hover,
.nav button:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.nav a:active,
.nav button:active {
  transform: translateY(0);
}

.nav a.nav-link-active {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.34);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-admin-only] {
  display: none;
}

[data-admin-only].visible {
  display: inline-flex;
}

.container {
  max-width: 1140px;
  margin: 24px auto;
  padding: 0 20px 30px;
}

.hero {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 6px solid var(--primary);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
  color: #0f3fbd;
}

.hero p {
  opacity: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.card {
  grid-column: span 12;
  background: var(--surface);
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: #93c5fd;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #1a66ff;
  color: #fff;
}

.btn-primary:hover {
  background: #1643f5;
}

.btn-soft {
  background: #eff6ff;
  color: #1e40af;
}

.btn-soft:hover {
  background: #dbeafe;
}

.btn-edital {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  border: 2px solid #991b1b;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transition: all 0.3s ease;
}

.btn-edital:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
  transform: translateY(-2px);
}

.btn-edital:active {
  transform: translateY(0);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fecaca;
}

.btn.active {
  border: 1px solid #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-width: 450px;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  /* Garante que não haja rolagem desnecessária em desktop */
  max-width: 100%;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.92rem;
}

th {
  background: #f8fbff;
  color: #334155;
  font-weight: 600;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #fff7ed;
  color: #b45309;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.alert-info {
  background: #eef2ff;
  color: #3730a3;
}

.alert-ok {
  background: #ecfdf5;
  color: #166534;
}

.hidden {
  display: none;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-switch {
  display: flex;
  gap: 10px;
}

.auth-switch button {
  flex: 1;
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.auth-switch button.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

/* ============================================ */
/* MEDIA QUERIES - RESPONSIVIDADE MOBILE */
/* ============================================ */

/* Tablets e telas menores */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .topbar__inner {
    padding: 10px 16px;
  }

  .brand img {
    width: 140px;
  }

  .brand span {
    font-size: 0.9rem;
  }

  .container {
    margin: 16px auto;
    padding: 0 16px 24px;
  }

  .hero {
    padding: 18px;
  }

  .hero h1 {
    font-size: 1.35rem;
  }

  .card {
    padding: 16px;
  }

  .card h2 {
    font-size: 1.05rem;
  }

  .grid {
    gap: 12px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .module-tabs {
    flex-direction: column;
  }

  .module-tabs button {
    width: 100%;
    text-align: center;
  }

  table {
    font-size: 0.85rem;
    min-width: 500px;
  }

  th,
  td {
    padding: 8px 6px;
  }

  .actions {
    flex-direction: column;
    width: 100%;
  }

  .actions button {
    width: 100%;
  }
}

/* Mobile - Menu hamburguer */
@media (max-width: 640px) {
  .topbar__inner {
    padding: 10px 12px;
  }

  .brand img {
    width: 120px;
  }

  .brand span {
    display: none;
  }

  .menu-toggle {
    display: block;
    order: 3;
  }

  .nav {
    position: fixed;
    top: 56px;
    right: -100%;
    width: 280px;
    max-width: 85vw;
    height: calc(100vh - 56px);
    background: linear-gradient(180deg, #1a66ff 0%, #0e4fc9 100%);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 20px 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 99;
  }

  .nav.open {
    right: 0;
  }

  .nav a,
  .nav button {
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  .nav a:hover,
  .nav button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: none;
  }

  .nav a.nav-link-active {
    background: rgba(255, 255, 255, 0.25);
    border-left: 4px solid #ffffff;
  }

  .hero {
    padding: 16px;
  }

  .hero h1 {
    font-size: 1.25rem;
  }

  .hero p {
    font-size: 0.9rem;
  }

  .card {
    padding: 14px;
  }

  .card h2 {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  table {
    font-size: 0.8rem;
    min-width: 450px;
  }

  th,
  td {
    padding: 8px 4px;
  }

  .status {
    font-size: 0.75rem;
    padding: 2px 8px;
  }

  .alert {
    font-size: 0.85rem;
    padding: 10px;
  }

  .auth-switch {
    flex-direction: column;
  }

  .auth-switch button {
    padding: 12px;
  }
}

/* Desktop - responsividade para telas maiores */
@media (min-width: 920px) {
  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-6 {
    grid-column: span 6;
  }

  table {
    font-size: 0.92rem;
    /* Remove min-width em telas grandes para evitar scroll horizontal */
    min-width: auto;
  }

  .table-wrapper {
    /* Em desktop, evita rolagem desnecessária */
    overflow-x: visible;
  }
}

/* Overlay escuro quando menu móvel está aberto */
.nav-overlay {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  transition: opacity 0.3s ease;
}

.nav-overlay.visible {
  display: block;
}

@media (min-width: 641px) {
  .nav-overlay {
    display: none !important;
  }
}

/* ============================================ */
/* TIMELINE DE ETAPAS */
/* ============================================ */

.timeline-etapas {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.etapa-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-soft);
  border-left: 4px solid #d7dee8;
  transition: all 0.2s ease;
}

.etapa-item.concluida {
  border-left-color: #10b981;
  background: #ecfdf5;
}

.etapa-item.em-andamento {
  border-left-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.etapa-item.pendente {
  border-left-color: #d7dee8;
  opacity: 0.7;
}

/*
  ========== SISTEMA DE NOTIFICAÇÕES TOAST (DESATIVADO) ==========
  Agora usando Notyf - biblioteca externa via CDN
  CSS customizado anterior removido para evitar conflitos
  Para ver o CSS customizado antigo, consulte o histórico do Git
  ========== FIM SISTEMA DE NOTIFICAÇÕES TOAST ==========
*/

/* ============================================ */
/* TIMELINE DE ETAPAS */
/* ============================================ */

.etapa-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: #e5e7eb;
  color: #6b7280;
}

.etapa-item.concluida .etapa-icon {
  background: #10b981;
  color: #ffffff;
}

.etapa-item.em-andamento .etapa-icon {
  background: #f59e0b;
  color: #ffffff;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.etapa-content {
  flex: 1;
}

.etapa-titulo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.etapa-descricao {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.etapa-data {
  font-size: 0.85rem;
  color: var(--primary-strong);
  font-weight: 600;
}

/* ============================================ */
/* PÁGINA DE MATRÍCULA */
/* ============================================ */

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .two-col {
    grid-template-columns: repeat(2, 1fr);
  }
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-soft {
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  border: 1px solid #d1d5db;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
  display: inline-block;
  text-align: center;
}

.btn-soft:hover {
  background: #e5e7eb;
}

.hidden {
  display: none !important;
}
