/* ============================================================
   Concílio APÓtima 2026 — Sistema de Inscrição
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --blue-700:  #1d4ed8;
  --blue-600:  #2563eb;
  --blue-500:  #3b82f6;
  --blue-50:   #eff6ff;
  --gray-900:  #111827;
  --gray-800:  #1f2937;
  --gray-600:  #4b5563;
  --gray-500:  #6b7280;
  --gray-400:  #9ca3af;
  --gray-300:  #d1d5db;
  --gray-200:  #e5e7eb;
  --gray-100:  #f3f4f6;
  --gray-50:   #f9fafb;
  --white:     #ffffff;
  --red-600:   #dc2626;
  --red-500:   #ef4444;
  --red-50:    #fef2f2;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --amber-500: #f59e0b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --transition: 0.2s ease;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  padding: 1.5rem;
}

.login-page .container { width: 100%; max-width: 400px; }

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--gray-900);
}

.header h1 span { color: var(--blue-600); }

.header-sub {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ---------- Dashboard Layout ---------- */
.dashboard-page {
  min-height: 100vh;
  background: var(--gray-50);
}

.dashboard-page .container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem;
}

.header--dashboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}

.header--dashboard h1 { font-size: 1.375rem; }

/* ---------- Dashboard Header ---------- */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.dashboard-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.125rem;
}

.vagas-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-width: 140px;
}

.vagas-summary-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.vagas-summary-text small {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-400);
}

.vagas-summary-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vagas-summary-bar {
  width: 100%;
  height: 4px;
  background: var(--gray-200);
  border-radius: 100px;
  overflow: hidden;
}

.vagas-summary-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
}

.vagas-summary-fill.safe { background: var(--green-500); }
.vagas-summary-fill.warn { background: var(--amber-500); }
.vagas-summary-fill.crit { background: var(--red-500); }
.vagas-summary-fill.full { background: var(--red-600); }

/* ---------- Igrejas Grid ---------- */
.igrejas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.igreja-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.igreja-card:hover {
  box-shadow: var(--shadow-md);
}

.igreja-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem 0.5rem;
}

.igreja-nome {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
}

.igreja-distrito {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-400);
  margin-top: 0.125rem;
}

.igreja-count {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 0.25rem 0.5rem;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------- Vagas ---------- */
.igreja-vagas {
  padding: 0.5rem 1.25rem 0.625rem;
}

.vagas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.vagas-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vagas-text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
}

.vagas-text strong { font-size: 0.9375rem; color: var(--gray-900); }

.vagas-text.lotado { color: var(--red-500); }
.vagas-text.alerta { color: var(--amber-500); }

.vagas-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: 100px;
  overflow: hidden;
}

.vagas-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
}

.vagas-fill.safe { background: var(--green-500); }
.vagas-fill.warn { background: var(--amber-500); }
.vagas-fill.crit { background: var(--red-500); }
.vagas-fill.full { background: var(--red-600); }

/* ---------- Actions ---------- */
.igreja-actions {
  padding: 0 1.25rem 0.75rem;
}

.igreja-actions .btn--primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Inscritos ---------- */
.igreja-inscritos {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.inscrito-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--gray-600);
  gap: 0.5rem;
  border: 1px solid transparent;
  transition: var(--transition);
}

.inscrito-item:hover {
  border-color: var(--gray-200);
  background: var(--white);
}

.inscrito-nome {
  flex: 1;
  font-weight: 500;
  color: var(--gray-700);
}

.inscrito-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  opacity: 0;
  transition: var(--transition);
}

.inscrito-item:hover .inscrito-actions { opacity: 1; }

.btn-icon {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-icon--edit {
  background: var(--gray-100);
  color: var(--gray-500);
}

.btn-icon--edit:hover {
  background: var(--blue-50);
  color: var(--blue-600);
}

.btn-icon--del {
  background: transparent;
  color: var(--gray-400);
}

.btn-icon--del:hover {
  background: var(--red-50);
  color: var(--red-500);
}

.igreja-empty {
  font-size: 0.8125rem;
  color: var(--gray-400);
  font-style: italic;
  padding: 0.25rem 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn--primary {
  background: var(--gray-900);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--gray-800);
}

.btn--outline {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}

.btn--outline:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.btn--ghost {
  background: transparent;
  color: var(--gray-400);
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn--ghost:hover { color: var(--red-500); }

.btn--full { width: 100%; }

.btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ---------- Loader ---------- */
.btn-loader {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-loader.hidden { display: none; }
.btn-text.hidden { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Card (login) ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  border: 1px solid var(--gray-200);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.375rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
}

.form-optional {
  font-weight: 400;
  color: var(--gray-400);
}

.form-input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--gray-900);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.form-textarea {
  min-height: 4.5rem;
  resize: vertical;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 999;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 500px;
  padding: 1.5rem;
  animation: slideUp 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover { color: var(--gray-800); }

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.form-actions .btn { min-width: 100px; }

/* ---------- Alert ---------- */
.alert {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
}

.alert--error {
  background: var(--red-50);
  color: var(--red-500);
}

.alert--success {
  background: #f0fdf4;
  color: var(--green-600);
}

.hidden { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--gray-900);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  animation: slideUp 0.3s ease;
  max-width: 340px;
}

.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-500); }

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .igrejas-grid { grid-template-columns: 1fr; }
  .card { padding: 1.5rem; }
  .modal { padding: 1.25rem; }
  .header--dashboard { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .dashboard-header { flex-direction: column; }
  .vagas-summary { align-items: flex-start; width: 100%; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 100px; }
