/* ============================================================
   Sistem Kas MDAS — Global Styles
   Font: Inter (Google Fonts)
   Framework: Bootstrap 5
   ============================================================ */

:root {
  --primary:        #0d9488;
  --primary-dark:   #0f766e;
  --primary-light:  #ccfbf1;
  --accent:         #2563eb;
  --sidebar-bg:     #0f172a;
  --sidebar-width:  256px;
  --navbar-height:  60px;
  --content-bg:     #f1f5f9;
  --card-bg:        #ffffff;
  --text-primary:   #0f172a;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --success:        #16a34a;
  --danger:         #dc2626;
  --warning:        #d97706;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--content-bg);
  color: var(--text-primary);
  font-size: 0.925rem;
}

/* ── Navbar ────────────────────────────────────────────────── */
#mainNavbar {
  height: var(--navbar-height);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  z-index: 1050;
}

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; flex-shrink: 0;
}

.avatar-sm {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.82rem; flex-shrink: 0;
}

/* ── Sidebar Desktop ───────────────────────────────────────── */
.sidebar-desktop {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,0.04);
  z-index: 900;
  display: flex;
  flex-direction: column;
}

/* ── Offcanvas Sidebar (Mobile) ───────────────────────────── */
.sidebar-offcanvas {
  width: 270px !important;
  background: var(--sidebar-bg) !important;
}
.sidebar-offcanvas .offcanvas-header {
  background: linear-gradient(135deg, #0d9488, #2563eb);
  border: none;
}

/* ── Sidebar Navigation ───────────────────────────────────── */
.sidebar-nav {
  padding: 0.75rem 0.6rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

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

.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  border-color: rgba(255,255,255,0.05);
}

.sidebar-link.active {
  background: rgba(13,148,136,0.18);
  color: #5eead4;
  border-color: rgba(13,148,136,0.3);
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #475569;
  text-transform: uppercase;
  display: block;
  padding: 0.75rem 0.9rem 0.35rem;
}

.sidebar-logout {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
  transition: margin-left 0.2s ease;
}

@media (min-width: 992px) {
  .main-content { margin-left: var(--sidebar-width); }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  background: var(--card-bg);
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 90px; height: 90px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.stat-card.saldo  { background: linear-gradient(135deg, #0d9488, #0284c7); }
.stat-card.masuk  { background: linear-gradient(135deg, #16a34a, #059669); }
.stat-card.keluar { background: linear-gradient(135deg, #dc2626, #ea580c); }
.stat-card.total  { background: linear-gradient(135deg, #7c3aed, #2563eb); }

.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; word-break: break-all; }
.stat-label { font-size: 0.78rem; opacity: 0.85; font-weight: 500; margin-top: 2px; }
.stat-icon  {
  position: absolute; bottom: 10px; right: 16px;
  font-size: 2.2rem; opacity: 0.2; pointer-events: none;
}

@media (max-width: 576px) {
  .stat-value { font-size: 1.2rem; }
}

/* ── Badge tipe transaksi ──────────────────────────────────── */
.badge-pemasukan {
  background: #dcfce7; color: #15803d;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.3em 0.65em; border-radius: 6px; white-space: nowrap;
}
.badge-pengeluaran {
  background: #fee2e2; color: #dc2626;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.3em 0.65em; border-radius: 6px; white-space: nowrap;
}
.amount-masuk  { color: var(--success); font-weight: 600; }
.amount-keluar { color: var(--danger);  font-weight: 600; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { border-radius: 10px; font-weight: 500; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  box-shadow: 0 2px 8px rgba(13,148,136,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #065f46);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13,148,136,0.45);
}
.btn-primary:active { transform: translateY(0); }

/* ── Forms ────────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
  outline: none;
}
.form-label { font-weight: 500; font-size: 0.88rem; margin-bottom: 0.35rem; color: var(--text-primary); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 2.5rem; }
.input-icon-wrap .bi { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.95rem; }

/* ── Tables ───────────────────────────────────────────────── */
.table { font-size: 0.87rem; }
.table thead th {
  background: #f8fafc;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
  padding: 0.75rem 0.85rem; white-space: nowrap;
}
.table tbody td { padding: 0.75rem 0.85rem; vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table-responsive { border-radius: 12px; overflow: hidden; }

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.3rem; font-weight: 800; margin: 0; color: var(--text-primary); }

/* ── Alert ────────────────────────────────────────────────── */
.alert { border-radius: 12px; border: none; font-size: 0.9rem; }
.alert-success { background: #f0fdf4; color: #166534; }
.alert-danger  { background: #fef2f2; color: #991b1b; }

/* ── Login page ───────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0d9488 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.login-card {
  background: #fff; border-radius: 22px;
  padding: 2.25rem 2rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}
.login-logo {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff;
  box-shadow: 0 8px 24px rgba(13,148,136,0.4);
}
@media (max-width: 576px) {
  .login-card { padding: 1.75rem 1.25rem; border-radius: 18px; }
}

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown-menu {
  border-radius: 14px !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
  padding: 0.35rem !important;
}
.dropdown-item { border-radius: 8px; font-size: 0.88rem; }
.dropdown-item:hover { background: #f1f5f9; }

/* ── Pagination ───────────────────────────────────────────── */
.page-link { border-radius: 8px !important; border: 1px solid var(--border); color: var(--text-primary); }
.page-link:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar {
  background: #fff; border-radius: 14px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-content  { border-radius: 18px; border: none; }
.modal-header   { border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; }
.modal-footer   { border-top: 1px solid var(--border); padding: 0.75rem 1.5rem; }
.btn-close:focus { box-shadow: none; }

/* ── Bukti foto preview ───────────────────────────────────── */
.foto-preview {
  width: 100%; max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--border);
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.35s ease both; }

/* ── Laporan summary ──────────────────────────────────────── */
.rekap-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1.25rem;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; opacity: 0.3; display: block; margin-bottom: 0.75rem; }

/* ── Scrollbar (Webkit) ───────────────────────────────────── */
.sidebar-desktop::-webkit-scrollbar { width: 4px; }
.sidebar-desktop::-webkit-scrollbar-track { background: transparent; }
.sidebar-desktop::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* ── Mobile Bottom Navigation Bar ─────────────────────────── */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  z-index: 1040;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0.35rem;
  position: relative;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.25rem 0.4rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-width: 54px;
  cursor: pointer;
}

.bottom-nav-item i {
  font-size: 1.22rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
  color: #e2e8f0;
}

.bottom-nav-item.active {
  color: #2dd4bf;
  font-weight: 600;
}

.bottom-nav-item.active i {
  transform: translateY(-2px);
  color: #2dd4bf;
}

.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 6px #2dd4bf;
}

/* FAB Center Catat Button */
.bottom-nav-fab {
  transform: translateY(-12px);
  text-decoration: none !important;
}

.bottom-nav-fab .fab-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.35rem;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.5);
  border: 3px solid #0f172a;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bottom-nav-fab:hover .fab-circle,
.bottom-nav-fab:active .fab-circle {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.65);
}

.bottom-nav-fab span {
  margin-top: 3px;
  font-weight: 600;
  font-size: 0.68rem;
  color: #e2e8f0;
}

.bottom-nav-fab.active .fab-circle {
  background: linear-gradient(135deg, #2dd4bf 0%, #3b82f6 100%);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.6);
}

/* Mobile Offcanvas Bottom Sheet */
.mobile-menu-offcanvas {
  background: #0f172a !important;
  color: #fff !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 22px 22px 0 0 !important;
  max-height: 72vh !important;
}

.sheet-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #2dd4bf;
  flex-shrink: 0;
}

.active-sheet-item {
  background: rgba(13, 148, 136, 0.18) !important;
  border-radius: 12px;
}

/* Mobile Content Padding for Bottom Nav */
@media (max-width: 991.98px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}
