@import url('https://cdnjs.cloudflare.com/ajax/libs/inter-ui/3.19.3/inter.min.css');

:root {
  --app-primary: #0d9668;
  --app-primary-dark: #07603f;
  --app-primary-light: #34d399;
  --app-accent: #f0ad4e;
  --app-bg: #f1f5f4;
  --app-ink: #1c2b28;
  --card-radius: 1rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  background-color: var(--app-bg);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(13,150,104,.06) 0%, transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(240,173,78,.07) 0%, transparent 40%);
  background-attachment: fixed;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--app-ink);
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; }
a { text-decoration: none; }

/* ===== Layout ===== */
.app-wrapper { display: flex; min-height: 100vh; }
.app-content { flex-grow: 1; min-width: 0; }

/* ===== Sidebar ===== */
.app-sidebar {
  width: 246px;
  background: linear-gradient(200deg, var(--app-primary-dark) 0%, #0a4632 100%);
  flex-shrink: 0;
  box-shadow: 3px 0 14px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  color: #fff; font-weight: 800; font-size: 1.05rem;
  padding: 1.1rem 1.1rem .9rem;
}
.sidebar-brand i {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.14);
  border-radius: .7rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: var(--app-accent);
}

.app-sidebar .nav { gap: 2px; }

.app-sidebar .nav-link {
  color: rgba(255,255,255,.78);
  padding: .62rem 1rem;
  border-radius: .6rem;
  font-size: .89rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.app-sidebar .nav-link i { width: 22px; display: inline-block; font-size: 1rem; vertical-align: -2px; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.10); color: #fff; transform: translateX(2px); }
.app-sidebar .nav-link.active {
  background: rgba(255,255,255,.16);
  color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--app-accent);
}

.sidebar-section-label {
  color: rgba(255,255,255,.45);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  padding: .9rem 1rem .3rem;
}

.sidebar-brand-sub {
  font-size: .68rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  letter-spacing: .02em;
}

.sidebar-illustration { padding: 0 .9rem 1.1rem; }
.sidebar-quote-box {
  background: rgba(255,255,255,.08);
  border-radius: .9rem;
  padding: .9rem 1rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.sidebar-quote {
  color: rgba(255,255,255,.6);
  font-size: .72rem;
  line-height: 1.5;
  margin: .25rem 0 0;
}
.sidebar-quote-icon {
  position: absolute;
  right: 10px; bottom: 6px;
  font-size: 1.9rem;
  color: rgba(255,255,255,.12);
}

/* ===== Welcome banner ===== */
.welcome-banner {
  background: linear-gradient(110deg, var(--app-primary-dark) 0%, var(--app-primary) 55%, #34d399 130%);
  border-radius: var(--card-radius);
  padding: 1.4rem 1.6rem;
  display: flex; align-items: center; gap: 1.1rem;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 18px rgba(13,150,104,.22);
}
.welcome-banner::after {
  content: '';
  position: absolute; right: -40px; top: -60px;
  width: 240px; height: 240px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
}
.welcome-icon {
  width: 56px; height: 56px; flex-shrink: 0;
  background: rgba(255,255,255,.18);
  border-radius: 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; color: #fff;
}

/* ===== Highlight box (statistik iuran) ===== */
.highlight-box {
  background: #eaf7f1;
  border-radius: .7rem;
  padding: .7rem .9rem;
  font-size: .85rem;
  color: #0a5c3a;
}

/* ===== Topbar ===== */
.content-topbar {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.05);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-date {
  background: #f3f6f5;
  border-radius: 2rem;
  padding: .4rem .9rem;
  font-size: .82rem;
  color: #4a5a55;
  align-items: center;
}
.topbar-bell {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #f3f6f5;
  display: flex; align-items: center; justify-content: center;
  color: #5b6b66;
  font-size: 1rem;
}
.notif-dot {
  position: absolute;
  top: -4px; right: -4px;
  background: #e05c5c;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid #fff;
}
.topbar-avatar-btn {
  display: flex; align-items: center;
  background: transparent; border: none;
  padding: .2rem .4rem;
}
.topbar-avatar-btn:hover { background: #f3f6f5; border-radius: 2rem; }
.avatar-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--app-primary), var(--app-primary-light));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}

.app-footer {
  color: #7d8b86;
  font-size: .8rem;
  border-top: 1px solid rgba(0,0,0,.05);
}

/* ===== Cards ===== */
.card {
  border: 1px solid rgba(0,0,0,.05);
  border-radius: var(--card-radius);
  box-shadow: 0 2px 10px rgba(20,40,35,.05);
  transition: box-shadow .15s ease;
}
.card:hover { box-shadow: 0 6px 20px rgba(20,40,35,.09); }
.card-header {
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
  border-bottom: 1px solid rgba(0,0,0,.06);
  font-size: .92rem;
}

/* Stat cards */
.card-stat { border: none; border-radius: var(--card-radius); color: #fff; position: relative; overflow: hidden; isolation: isolate; }
.card-stat::after {
  content: ''; position: absolute; right: -18px; top: -18px;
  width: 90px; height: 90px; background: rgba(255,255,255,.12); border-radius: 50%; z-index: -1;
}
.stat-icon-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
.stat-sub { font-size: .74rem; opacity: .85; margin-top: .4rem; }

.card-stat.bg-saldo  { background: linear-gradient(135deg,#0d9668,#0aa876); }
.card-stat.bg-masuk  { background: linear-gradient(135deg,#2563eb,#3b82f6); }
.card-stat.bg-keluar { background: linear-gradient(135deg,#dc4c4c,#e8746f); }
.card-stat.bg-program{ background: linear-gradient(135deg,#e08e1f,#f0ad4e); }
.card-stat.bg-ungu   { background: linear-gradient(135deg,#7c3aed,#a855f7); }

/* Donut */
.donut-wrapper { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.legend-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px;
}

/* Transaksi terbaru */
.tx-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: .95rem;
}
.tx-in  { background: #e4f8ee; color: #0d9668; }
.tx-out { background: #fdeaea; color: #dc4c4c; }
.min-w-0 { min-width: 0; }

/* Program kerja */
.program-icon {
  width: 42px; height: 42px; border-radius: .8rem;
  background: #eaf7f1; color: var(--app-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}

/* Pengumuman icons */
.pengumuman-icon {
  width: 36px; height: 36px; border-radius: .7rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: .9rem; color: #fff;
}
.bg-icon-green  { background: linear-gradient(135deg,#0d9668,#34d399); }
.bg-icon-blue   { background: linear-gradient(135deg,#2563eb,#60a5fa); }
.bg-icon-orange { background: linear-gradient(135deg,#e08e1f,#f0ad4e); }

/* ===== Galeri ===== */
.gallery-thumb { height: 140px; object-fit: cover; }
.gallery-card:hover { transform: translateY(-2px); }

/* ===== Alarm Darurat ===== */
.alarm-active-card { border-width: 2px !important; }
.alarm-live-alert {
  border-left: 4px solid #b91c1c !important;
  animation: alarmBannerPulse 1.6s ease-in-out infinite;
}
@keyframes alarmBannerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,.28); }
  50% { box-shadow: 0 0 0 8px rgba(185,28,28,0); }
}
.alarm-pulse-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: #fdeaea; color: #b91c1c;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  animation: alarmPulse 1.2s infinite;
  flex-shrink: 0;
}
@keyframes alarmPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,.35); }
  50% { box-shadow: 0 0 0 12px rgba(185,28,28,0); }
}
.btn-check:checked + .btn-outline-danger { background:#dc4c4c; color:#fff; }
.btn-check:checked + .btn-outline-warning { background:#f0ad4e; color:#402700; }
.btn-check:checked + .btn-outline-primary { background:#2563eb; color:#fff; }
.btn-check:checked + .btn-outline-info { background:#0dcaf0; color:#023047; }
.btn-check:checked + .btn-outline-secondary { background:#6c757d; color:#fff; }

/* ===== Tables ===== */
.table-responsive { border-radius: var(--card-radius); overflow: hidden; }
.table thead.table-light th {
  background-color: #f6f8f7;
  border-bottom: 2px solid rgba(0,0,0,.06);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #5b6b66;
}
.table td, .table th { vertical-align: middle; }
.table-hover tbody tr:hover { background-color: rgba(13,150,104,.05); }

/* ===== Badges / Buttons ===== */
.badge { font-weight: 600; padding: .4em .65em; border-radius: .5rem; }
.btn { border-radius: .6rem; font-weight: 500; }
.btn-success { background: linear-gradient(135deg, var(--app-primary), var(--app-primary-light)); border: none; }
.btn-success:hover { background: linear-gradient(135deg, var(--app-primary-dark), var(--app-primary)); }
.btn-sm { border-radius: .5rem; }

/* ===== Alerts ===== */
.alert { border: none; border-radius: .8rem; }
.alert-warning { background-color: #fff4e0; color: #7a5410; }
.alert-success { background-color: #e4f8ee; color: #0a5c3a; }
.alert-danger { background-color: #fdeaea; color: #8c2626; }

.list-group-item { border-color: rgba(0,0,0,.05); }

/* ===== Login page ===== */
.login-wrapper {
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.09) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255,255,255,.07) 0%, transparent 40%),
    linear-gradient(135deg, var(--app-primary-dark), #08422f 60%, #062f21);
  min-height: 100vh;
}
.login-card { border-radius: 1.2rem; border: none; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-icon {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--app-primary), var(--app-primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.9rem; margin: 0 auto 1rem;
  box-shadow: 0 8px 18px rgba(13,150,104,.35);
}

/* ===== Scrollbar polish ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c3cfca; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a8b8b2; }

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: -246px;
    top: 0;
    height: 100vh;
    z-index: 1030;
    transition: left .2s ease;
  }
  .app-sidebar.show { left: 0; }
  .content-topbar { top: 0; }
}
