/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #111827;
  line-height: 1.5;
  background: #f9fafb;
}
a { text-decoration: none; color: inherit; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
}
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1e40af; transform: translateY(-1px); }
.btn-outline { background: transparent; color: #1d4ed8; border: 2px solid #1d4ed8; }
.btn-outline:hover { background: #eff6ff; }
.btn-lg { padding: 0.875rem 2.25rem; font-size: 1.0625rem; border-radius: 10px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-loading { color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.125rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}
.required { color: #dc2626; }
input, select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
input::placeholder { color: #9ca3af; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }

/* ===== CARD ===== */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #166534; }

/* ===== MAINTENANCE PAGE ===== */
.maintenance-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(140deg, #0f2557 0%, #1d4ed8 60%, #3b82f6 100%);
}
.maintenance-card {
  background: #fff;
  border-radius: 20px;
  padding: 3rem 3.5rem;
  text-align: center;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
}
.maintenance-logo {
  font-size: 1.375rem;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: -0.5px;
  margin-bottom: 2rem;
  display: block;
}
.maintenance-icon { font-size: 3rem; margin-bottom: 1.25rem; line-height: 1; }
.maintenance-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.875rem;
}
.maintenance-card p {
  color: #6b7280;
  font-size: 0.9375rem;
  margin-bottom: 2rem;
  line-height: 1.65;
}
.maintenance-footer {
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  margin-top: 2rem;
  text-align: center;
}

/* ===== CADASTRO PAGE ===== */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
  background: #f9fafb;
}
.auth-box { width: 100%; max-width: 640px; }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1d4ed8;
  display: inline-block;
  margin-bottom: 1.25rem;
}
.auth-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.375rem; }
.auth-header p { color: #6b7280; font-size: 0.9rem; }
.privacy-note { text-align: center; margin-top: 1rem; font-size: 0.78rem; color: #9ca3af; }

/* ===== SUCCESS STATE ===== */
.success-box { text-align: center; padding: 2.5rem 1rem; }
.success-icon {
  width: 68px; height: 68px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.875rem;
  margin: 0 auto 1.25rem;
}
.success-box h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.success-box p { color: #6b7280; font-size: 0.9rem; line-height: 1.6; }

/* ===== ADMIN LAYOUT ===== */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #111827;
  color: #fff;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: 220px;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  font-size: 1.0625rem;
  font-weight: 800;
  color: #60a5fa;
  padding: 0 0.5rem;
  margin-bottom: 2rem;
}
.sidebar-section {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #4b5563;
  padding: 0 0.5rem;
  margin: 1.25rem 0 0.5rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #9ca3af;
  transition: all 0.15s;
  margin-bottom: 0.125rem;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: #e5e7eb; }
.nav-link.active { background: rgba(96,165,250,0.15); color: #60a5fa; }

.admin-main {
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar h1 { font-size: 1.0625rem; font-weight: 600; }
.topbar-meta { font-size: 0.8125rem; color: #6b7280; }

.admin-content { padding: 2rem; }

/* ===== TABLE CARD ===== */
.table-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.table-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table-header h2 { font-size: 0.9375rem; font-weight: 600; }
.count-pill {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
}
table { width: 100%; border-collapse: collapse; }
th {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
td {
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ===== STATES ===== */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #9ca3af;
  font-size: 0.9rem;
  gap: 0.75rem;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: #9ca3af;
}
.empty-state .empty-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.875rem; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.875rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  animation: toastIn 0.2s ease;
  max-width: 360px;
}
.toast-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .maintenance-card { padding: 2rem 1.5rem; }
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-main { margin-left: 0; }
}
