/* ============================================================
   EbenNexo Church ERP — Estilos principais
   ============================================================ */

:root {
  --primary:       #1a3c5e;
  --primary-light: #2563a8;
  --primary-dark:  #0f2540;
  --accent:        #c8860a;
  --accent-light:  #e8a52a;
  --sidebar-bg:    #0f2540;
  --sidebar-width: 260px;
  --topbar-h:      60px;
  --body-bg:       #f0f2f5;
  --card-bg:       #ffffff;
  --text-main:     #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --radius:        8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.14);
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text-main);
  font-size: .9rem;
  line-height: 1.6;
  margin: 0;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

img { max-width: 100%; }

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.sidebar-brand-name {
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: .3px;
}

.sidebar-brand-name span {
  display: block;
  font-size: .68rem;
  font-weight: 400;
  color: rgba(255,255,255,.5);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 14px 20px 6px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,.7);
  font-size: .865rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}

.sidebar-nav .nav-link i {
  font-size: 1.05rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
  border-left-color: rgba(255,255,255,.2);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(200,134,10,.18);
  border-left-color: var(--accent);
}

.sidebar-nav .nav-link.active i {
  color: var(--accent-light);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: .68rem;
  color: rgba(255,255,255,.4);
}

/* ---- Main content ----------------------------------------- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ----------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.topbar-breadcrumb {
  flex: 1;
}

.topbar-breadcrumb .breadcrumb {
  margin: 0;
  font-size: .83rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-notif {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .15s;
}

.topbar-notif:hover { background: var(--body-bg); }

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ---- Page content ----------------------------------------- */
.page-content {
  padding: 24px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px;
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: .875rem;
}

/* ---- Cards ------------------------------------------------ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body { padding: 20px; }

/* ---- Stat cards ------------------------------------------- */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.primary { background: rgba(37,99,168,.1); color: var(--primary-light); }
.stat-icon.success { background: rgba(22,163,74,.1); color: #16a34a; }
.stat-icon.warning { background: rgba(202,138,4,.1); color: #ca8a04; }
.stat-icon.danger  { background: rgba(220,38,38,.1); color: #dc2626; }
.stat-icon.info    { background: rgba(14,165,233,.1); color: #0ea5e9; }
.stat-icon.accent  { background: rgba(200,134,10,.12); color: var(--accent); }

.stat-body { flex: 1; min-width: 0; }

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Tables ----------------------------------------------- */
.table {
  font-size: .875rem;
  margin: 0;
}

.table thead th {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: #f8fafc;
  border-top: none;
  border-bottom: 2px solid var(--border);
  padding: 10px 16px;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-color: var(--border);
}

.table tbody tr:hover td { background: #f8fafc; }

/* ---- Forms ------------------------------------------------ */
.form-label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}

.form-control, .form-select {
  font-size: .875rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,.12);
  outline: none;
}

.form-text {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ---- Buttons ---------------------------------------------- */
.btn {
  font-size: .875rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 7px 16px;
  transition: all .15s;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: #a87008;
  border-color: #a87008;
  color: #fff;
}

.btn-sm {
  font-size: .8rem;
  padding: 5px 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

/* ---- Badges ----------------------------------------------- */
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

/* ---- Alerts ----------------------------------------------- */
.alert {
  border: none;
  border-radius: var(--radius);
  font-size: .875rem;
  border-left: 4px solid transparent;
}

.alert-success  { background: #f0fdf4; color: #166534; border-left-color: #16a34a; }
.alert-danger   { background: #fef2f2; color: #991b1b; border-left-color: #dc2626; }
.alert-warning  { background: #fffbeb; color: #92400e; border-left-color: #d97706; }
.alert-info     { background: #eff6ff; color: #1e40af; border-left-color: #3b82f6; }

/* ---- Avatar ----------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm  { width: 30px; height: 30px; font-size: .72rem; }
.avatar-md  { width: 40px; height: 40px; font-size: .85rem; }
.avatar-lg  { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl  { width: 80px; height: 80px; font-size: 1.5rem; }

/* ---- Member card ------------------------------------------ */
.member-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---- Auth pages ------------------------------------------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.auth-card-header {
  background: var(--primary-dark);
  padding: 32px 32px 24px;
  text-align: center;
}

.auth-card-header img {
  height: 52px;
  margin-bottom: 12px;
}

.auth-card-title {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.auth-card-subtitle {
  color: rgba(255,255,255,.55);
  font-size: .8rem;
  margin: 0;
}

.auth-card-body {
  padding: 28px 32px 32px;
}

/* ---- Admin sidebar (diferente da church) ------------------ */
.sidebar-admin .sidebar-brand {
  background: linear-gradient(135deg, #1e1b4b, #3730a3);
}

/* ---- Dropdown fixes --------------------------------------- */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: .875rem;
  padding: 6px;
}

.dropdown-item {
  border-radius: 6px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background: var(--body-bg);
  color: var(--text-main);
}

.dropdown-divider { margin: 6px 0; }

/* ---- Status indicator ------------------------------------ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.active   { background: #16a34a; }
.status-dot.inactive { background: #94a3b8; }
.status-dot.blocked  { background: #dc2626; }

/* ---- Pagination ------------------------------------------ */
.pagination {
  gap: 4px;
  margin: 0;
}

.page-link {
  border-radius: 6px !important;
  border: 1.5px solid var(--border);
  color: var(--text-main);
  font-size: .83rem;
  padding: 5px 10px;
}

.page-link:hover { background: var(--body-bg); border-color: var(--border); }

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---- Modal ----------------------------------------------- */
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.modal-title { font-size: .95rem; font-weight: 700; }

.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
}

/* ---- Responsive ------------------------------------------ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .topbar-toggle {
    display: flex;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1039;
  }

  .sidebar-overlay.open {
    display: block;
  }
}

/* ---- Utilities ------------------------------------------- */
.text-primary-custom { color: var(--primary-light) !important; }
.text-accent { color: var(--accent) !important; }
.bg-primary-custom { background: var(--primary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: .83rem; }
.fs-xs { font-size: .75rem; }
.gap-4px { gap: 4px; }
.gap-8px { gap: 8px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  opacity: .4;
}

.empty-state h5 {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 8px;
}
