/* =========================================================
   Sistema da Igreja — Tema Claro e Moderno (com sidebar)
   ========================================================= */
:root {
  --brand: #10b981;
  --brand-dark: #059669;
  --brand-soft: #e7f8f1;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e6eaf0;
  --text: #1f2937;
  --muted: #6b7a90;
  --sidebar-w: 256px;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 10px 25px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Mantém o tom do tema em ícones/links que usam o padrão do Bootstrap */
.text-primary { color: var(--brand-dark) !important; }

/* ---------- Estrutura ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1045;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.app-sidebar.open { transform: none; box-shadow: var(--shadow-md); }

.app-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.app-brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #34d399);
  color: #fff; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-brand-name { font-weight: 800; font-size: 1.02rem; line-height: 1.15; }
.app-brand-sub { font-size: .68rem; color: var(--muted); font-weight: 500; letter-spacing: .03em; }

.app-nav { flex: 1; overflow-y: auto; padding: .35rem .8rem 1rem; }
.app-nav-section {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted);
  padding: 1rem .75rem .4rem;
}
.app-nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .75rem; margin-bottom: 2px;
  border-radius: .6rem;
  color: #475569; font-weight: 500; font-size: .9rem;
}
.app-nav-link i { font-size: 1.05rem; width: 20px; text-align: center; color: #94a3b8; }
.app-nav-link:hover { background: #f1f5f9; color: var(--text); text-decoration: none; }
.app-nav-link.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.app-nav-link.active i { color: var(--brand-dark); }

.app-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
}

/* Overlay mobile */
.app-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 1040;
}
.app-overlay.show { display: block; }

/* Área principal */
.app-main {
  flex: 1; margin-left: 0;
  display: flex; flex-direction: column;
  min-height: 100vh; min-width: 0;
}

/* Topbar */
.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .9rem;
  padding: 0 1.5rem;
}
.app-topbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.app-content { flex: 1; padding: 1.5rem; }

.app-footer {
  text-align: center; color: var(--muted); font-size: .8rem;
  padding: 1rem; border-top: 1px solid var(--border);
}

/* Desktop: sidebar sempre visível */
@media (min-width: 992px) {
  .app-sidebar { transform: none; }
  .app-main { margin-left: var(--sidebar-w); }
  .app-overlay { display: none !important; }
}

/* ---------- Cartões ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-soft { box-shadow: var(--shadow-sm); }
.card-hover { transition: transform .15s ease, box-shadow .15s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0 !important; }

/* ---------- Cartões de estatística ---------- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-card .fs-3 { color: var(--text); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
}
.stat-bg-blue   .stat-icon { background: #dbeafe; color: #1d4ed8; }
.stat-bg-green  .stat-icon { background: #d1fae5; color: #047857; }
.stat-bg-orange .stat-icon { background: #ffedd5; color: #c2410c; }
.stat-bg-purple .stat-icon { background: #ede9fe; color: #6d28d9; }

/* ---------- Botões ---------- */
.btn { border-radius: .55rem; font-weight: 600; }
.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-dark);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}
.btn-icon { display: inline-flex; align-items: center; gap: .4rem; }

/* ---------- Tabelas ---------- */
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.table-hover tbody tr:hover { --bs-table-hover-bg: #f8fafc; }
.table-actions .btn { padding: .28rem .5rem; line-height: 1; }

/* ---------- Badges ---------- */
.badge-soft-success { background: #d1fae5; color: #065f46; }
.badge-soft-danger  { background: #fee2e2; color: #991b1b; }
.badge-soft-info    { background: #dbeafe; color: #1e40af; }
.badge-soft-primary { background: #e0e7ff; color: #3730a3; }

/* ---------- Formulários ---------- */
.form-label { font-weight: 600; font-size: .85rem; color: #334155; }
.form-control, .form-select { border-radius: .55rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(16, 185, 129, .15); }

/* ---------- Lista de presença ---------- */
.lista-presenca {
  max-height: 430px; overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.lista-presenca .form-check { padding: .55rem .8rem; margin: 0; border-bottom: 1px solid #f1f5f9; }
.lista-presenca .form-check:last-child { border-bottom: none; }
.lista-presenca .form-check:hover { background: #f8fafc; }

/* ---------- Ícone de célula ---------- */
.celula-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; flex-shrink: 0;
}

/* ---------- Tela de login ---------- */
.login-bg {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(16, 185, 129, .14), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(14, 165, 233, .12), transparent 40%),
    var(--bg);
}
.login-card { border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), #34d399);
  color: #fff; font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Calendário ---------- */
.calendario td { height: 74px; vertical-align: top; padding: .35rem; }
.calendario .cal-vazio { background: #f8fafc; }
.calendario .cal-dia { cursor: default; }
.calendario .cal-dia-com-evento { background: #f0fdf4; }
.calendario .cal-num { font-weight: 600; font-size: .85rem; }
.calendario .cal-hoje .cal-num {
  display: inline-block;
  width: 24px; height: 24px; line-height: 24px;
  background: var(--brand); color: #fff;
  border-radius: 50%;
}
.cal-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin: 2px 2px 0 0;
}

/* ---------- Avisos / ministérios ---------- */
.aviso-importante { border-left: 5px solid #f59e0b !important; }
.ministerio-card .ministerio-icone {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; flex-shrink: 0;
}

/* ---------- Impressão ---------- */
@media print {
  .app-sidebar, .app-topbar, .no-print, .app-footer { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none !important; }
}
