/* =====================================================================
   Sistem Informasi RT/RW - Stylesheet Utama
   ===================================================================== */

:root {
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --primary: #4f46e5;
  --bg-body: #f5f6fa;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --border-color: #e5e7eb;
}

[data-bs-theme="dark"] {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --text-main: #e2e8f0;
  --border-color: #334155;
}

body {
  background: var(--bg-body);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  transition: background .2s ease, color .2s ease;
}

/* ---------------- LOGIN PAGE ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card { border-radius: 16px; }
.login-icon { font-size: 3rem; color: var(--primary); }

/* ---------------- APP LAYOUT ---------------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .25s ease;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary);
}

.sidebar-nav { padding: .75rem .6rem; }

.nav-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
  padding: .9rem .75rem .3rem;
  font-weight: 600;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  border-radius: 8px;
  color: var(--text-main);
  font-size: .9rem;
  margin-bottom: 2px;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(79,70,229,.08); color: var(--primary); }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.topbar-title { font-weight: 600; font-size: 1rem; color: var(--text-main); }

.btn-icon {
  background: transparent;
  border: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-main);
}
.btn-icon:hover { background: rgba(79,70,229,.1); }

.dropdown-toggle-noarrow::after { display: none; }

.badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: #ef4444;
  border-radius: 50%;
}

.user-menu-btn { display: flex; align-items: center; gap: .6rem; border: none; background: transparent; padding: .3rem .5rem; border-radius: 10px; }
.user-menu-btn:hover { background: rgba(79,70,229,.08); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.user-name { font-size: .85rem; font-weight: 600; text-align: left; color: var(--text-main); }
.user-role { font-size: .72rem; color: #94a3b8; text-align: left; }

.page-content { padding: 1.25rem; }

/* ---------------- STAT CARDS ---------------- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.stat-card i { font-size: 1.4rem; opacity: .85; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: .35rem; }
.stat-label { font-size: .78rem; color: #94a3b8; }

.stat-blue i, .stat-blue .stat-value { color: #3b82f6; }
.stat-purple i, .stat-purple .stat-value { color: #8b5cf6; }
.stat-cyan i, .stat-cyan .stat-value { color: #06b6d4; }
.stat-pink i, .stat-pink .stat-value { color: #ec4899; }
.stat-orange i, .stat-orange .stat-value { color: #f97316; }
.stat-teal i, .stat-teal .stat-value { color: #14b8a6; }
.stat-indigo i, .stat-indigo .stat-value { color: #6366f1; }
.stat-green i, .stat-green .stat-value { color: #22c55e; }
.stat-brown i, .stat-brown .stat-value { color: #78350f; }
.stat-yellow i, .stat-yellow .stat-value { color: #eab308; }
.stat-red i, .stat-red .stat-value { color: #ef4444; }
.stat-gray i, .stat-gray .stat-value { color: #64748b; }

.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; }
.card-header { background: transparent; border-bottom: 1px solid var(--border-color); font-weight: 600; font-size: .9rem; }

/* Placeholder foto/ikon (avatar, foto rumah, dsb) — dibuat manual (bukan .bg-light
   Bootstrap) agar konsisten mengikuti dark/light mode seperti seluruh elemen lain. */
.placeholder-icon { background: var(--bg-body); border: 1px solid var(--border-color); }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
}
