/* ==========================================================
   PENDATAAN WARGA & JAMAAH JAKARTA SELATAN 1 (JS1)
   CALM PALETTE INSPIRED BY QURAN-MANQUL.PAGES.DEV
   (Warm Parchment, Soft Sage Green, Stone & Warm Amber)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Amiri:wght@400;700&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Calm Sage & Forest Green (quran-manqul theme-pesantren) */
  --brand-primary: #2d5a43;
  --brand-primary-hover: #224734;
  --brand-primary-light: #edf7f0;
  --brand-primary-border: #b2dec0;
  --brand-primary-text: #0c2b16;

  /* Warm Amber & Gold Accent */
  --brand-accent: #b45309;
  --brand-accent-hover: #92400e;
  --brand-accent-light: #fef3c7;
  --brand-accent-border: #fde68a;

  /* Calm Slate / Teal secondary */
  --brand-slate: #475569;
  --brand-slate-light: #f1f5f9;

  /* Eye-friendly Warm Parchment & Stone Background */
  --bg-page: #fbf9f5;
  --bg-card: #ffffff;
  --bg-subtle: #f5f2eb;
  --border-color: #e7e5e4;
  --border-focus: #2d5a43;

  /* Soft Natural Typography */
  --text-main: #2b241e;
  --text-muted: #78716c;
  --text-subtle: #a8a29e;

  --sidebar-width: 230px;
  --sidebar-collapsed-width: 66px;
  --header-height: 60px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(43, 36, 30, 0.04);
  --shadow-md: 0 4px 8px -1px rgba(43, 36, 30, 0.06), 0 2px 4px -1px rgba(43, 36, 30, 0.03);
  --shadow-lg: 0 10px 20px -3px rgba(43, 36, 30, 0.08);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ---- Top Header Bar ---- */
.navbar-app {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
  padding: 0 1.25rem 0 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-icon-box {
  width: var(--sidebar-collapsed-width);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(45, 90, 67, 0.25);
  transition: transform 0.15s ease;
}

.brand-title-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* User Profile Top Avatar */
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: 30px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
}
.header-user-btn:hover {
  background: var(--bg-subtle);
  border-color: #d6d3d1;
}
.header-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background: var(--brand-primary-light);
}

/* ---- Collapsible Left Sidebar (Calm Modern Style) ---- */
.app-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 1020;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s ease;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  padding: 1.25rem 1.5rem 2.5rem 1.5rem;
  flex-grow: 1;
  transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 0;
}

/* Collapsed Mini / Icon-Only Mode */
body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}
body.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-group-title,
body.sidebar-collapsed .nav-item-label,
body.sidebar-collapsed .sidebar-footer-text,
body.sidebar-collapsed .sidebar-user-card {
  display: none !important;
}

body.sidebar-collapsed .sidebar-nav-link {
  justify-content: center;
  padding: 0.75rem 0.5rem;
  margin: 0.2rem 0.45rem;
}
body.sidebar-collapsed .sidebar-nav-link i {
  margin-right: 0 !important;
  font-size: 1.15rem;
}

/* Sidebar Nav Items */
.sidebar-group-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 0.85rem 1rem 0.2rem 1rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.58rem 0.85rem;
  margin: 0.15rem 0.6rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.84rem;
  color: #44403c;
  text-decoration: none;
  transition: all 0.15s ease;
}
.sidebar-nav-link:hover {
  background-color: var(--bg-page);
  color: var(--brand-primary);
}
.sidebar-nav-link.active {
  background-color: var(--brand-primary);
  color: #ffffff !important;
  box-shadow: 0 3px 8px rgba(45, 90, 67, 0.25);
}
.sidebar-nav-link.active i {
  color: #ffffff !important;
}

/* Sidebar Toggle Fold Button */
.btn-sidebar-toggle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn-sidebar-toggle:hover {
  background: #ede8dc;
  color: var(--text-main);
}

/* ---- Compact Action Bar (Replacing bulky hero banner) ---- */
.compact-action-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .compact-action-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ---- Clean Cards ---- */
.card-clean {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.card-clean:hover {
  box-shadow: var(--shadow-md);
  border-color: #d6d3d1;
}

/* ---- Stat Cards Pill (Calm tones) ---- */
.stat-pill-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  height: 100%;
}
.stat-pill-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d6d3d1;
}
.stat-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.stat-icon-green  { background: #edf7f0; color: #2d5a43; }
.stat-icon-amber  { background: #fef3c7; color: #b45309; }
.stat-icon-stone  { background: #f5f2eb; color: #57534e; }
.stat-icon-teal   { background: #f0fdfa; color: #0d9488; }
.stat-icon-rose   { background: #fff1f2; color: #e11d48; }

.stat-pill-card .stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}
.stat-pill-card .stat-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.stat-progress-bar {
  height: 5px;
  background: #f5f2eb;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.stat-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* ---- Modern Stepper / Tabs ---- */
.stepper-nav {
  display: flex;
  background: #f5f2eb;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.3rem;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.stepper-nav::-webkit-scrollbar { height: 4px; }
.stepper-nav::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 10px; }

.stepper-btn {
  flex: 1;
  min-width: 110px;
  border: 1px solid #e7e5e4;
  background: #ffffff;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.8rem;
  color: #57534e;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.stepper-btn:hover {
  color: var(--brand-primary);
  background: #faf8f5;
  border-color: #b2dec0;
}
.stepper-btn.active {
  background: var(--brand-primary);
  color: #ffffff !important;
  border-color: var(--brand-primary);
  box-shadow: 0 3px 8px rgba(45, 90, 67, 0.25);
}
.stepper-btn .badge-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  background: #f5f2eb;
  color: #44403c;
}
.stepper-btn.active .badge-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Primary Button in Calm Green */
.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

.btn-outline-primary {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  font-weight: 700;
}
.btn-outline-primary:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
}

.text-primary {
  color: var(--brand-primary) !important;
}
.bg-primary-subtle {
  background-color: var(--brand-primary-light) !important;
  color: var(--brand-primary-text) !important;
}

/* Forms */
.form-label {
  font-weight: 700;
  font-size: 0.76rem;
  color: #57534e;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-control, .form-select {
  font-family: var(--font-main);
  font-size: 0.86rem;
  border: 1px solid #d6d3d1;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  background-color: #ffffff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(45, 90, 67, 0.15);
}

/* Responsive Mobile Layout */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show-mobile {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
    padding: 1rem 1rem 2rem 1rem;
  }
}

/* Print Ready Styles */
@media print {
  body { background: #ffffff !important; color: #000000 !important; }
  .no-print { display: none !important; }
  .navbar-app, .app-sidebar, footer, .btn { display: none !important; }
  .main-wrapper { margin-left: 0 !important; padding: 0 !important; }
  .print-only { display: block !important; }
}
