/* ─── Custom Properties ────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --primary: #1a1a2e;
  --secondary: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --gold: #f5a623;
  --text-light: #a0aec0;
  --border: rgba(255,255,255,0.08);
  --card-blur: rgba(255,255,255,0.03);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Base ────────────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d0d1f;
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  border-right: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(233, 69, 96, 0.6));
  animation: glow 2s ease-in-out infinite alternate;
}
@keyframes glow {
  from { filter: drop-shadow(0 0 6px rgba(233, 69, 96, 0.4)); }
  to { filter: drop-shadow(0 0 14px rgba(233, 69, 96, 0.9)); }
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: 1px; }
.brand-year { font-size: 11px; color: var(--gold); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }

.sidebar-nav {
  list-style: none;
  padding: 16px 0;
  flex: 1;
  overflow-y: auto;
}

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

.nav-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 12px 20px 4px;
}

.sidebar-nav li:not(.nav-label) a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  margin: 2px 0;
}

.sidebar-nav li:not(.nav-label) a:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-left-color: rgba(233, 69, 96, 0.5);
}

.sidebar-nav li.active a {
  color: #fff !important;
  background: rgba(233, 69, 96, 0.15) !important;
  border-left-color: var(--highlight) !important;
}

.sidebar-nav li a i { font-size: 16px; width: 20px; text-align: center; }

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

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: all var(--transition);
}
.logout-btn:hover { color: var(--highlight); background: rgba(233,69,96,0.1); }

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

/* ─── Top Navbar ──────────────────────────────────────────────────────────── */
.top-navbar {
  display: flex;
  align-items: center;
  background: rgba(22, 33, 62, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--highlight), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: white;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

/* ─── Flash Toast ─────────────────────────────────────────────────────────── */
.alert-toast {
  position: fixed;
  top: 80px; right: 24px;
  z-index: 2000;
  min-width: 300px;
  max-width: 480px;
  border-radius: 12px;
  border: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  animation: slideInRight 0.3s ease forwards;
}
@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Page Content ────────────────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 28px 40px;
}

/* ─── Stats Cards ─────────────────────────────────────────────────────────── */
.stat-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--card-accent, var(--highlight));
  border-radius: 16px 16px 0 0;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* ─── Financial Summary (Redesigned) ───────────────────────────────────────── */
.financial-summary {
  background: linear-gradient(145deg, rgba(22, 33, 62, 0.6) 0%, rgba(15, 52, 96, 0.3) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
}
.financial-summary .fs-header {
  background: linear-gradient(90deg, rgba(233, 69, 96, 0.2) 0%, rgba(15, 52, 96, 0.4) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.financial-summary .fs-header i { font-size: 20px; color: var(--gold); }
.financial-summary .fs-header span {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}
.financial-summary .fs-body {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.financial-summary .fs-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  border-left: 4px solid;
  transition: background var(--transition);
}
.financial-summary .fs-item:hover { background: rgba(255,255,255,0.06); }
.financial-summary .fs-item.fs-income { border-left-color: #68d391; }
.financial-summary .fs-item.fs-program { border-left-color: #76e4f7; }
.financial-summary .fs-item.fs-expected { border-left-color: #b794f4; }
.financial-summary .fs-item.fs-paid { border-left-color: #fc8181; }
.financial-summary .fs-item.fs-pending { border-left-color: #f6ad55; }
.financial-summary .fs-item.fs-balance { border-left-color: #63b3ed; }
.financial-summary .fs-item.fs-count { border-left-color: #b794f4; }
.financial-summary .fs-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
}
.financial-summary .fs-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.financial-summary .fs-value.fs-positive { color: #68d391; }
.financial-summary .fs-value.fs-negative { color: #fc8181; }
@media (min-width: 768px) {
  .financial-summary .fs-body { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .financial-summary .fs-body { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .financial-summary .fs-body { grid-template-columns: repeat(4, 1fr); }
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card-dark {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.card-dark .card-header {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.card-dark .card-body { padding: 24px; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-dark-custom {
  color: #e2e8f0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.table-dark-custom thead th {
  background: rgba(15, 52, 96, 0.6);
  color: #a0aec0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-dark-custom tbody tr {
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.table-dark-custom tbody tr:hover { background: rgba(255,255,255,0.04); }
.table-dark-custom tbody td { padding: 14px 16px; vertical-align: middle; font-size: 14px; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge-cash { background: rgba(72, 187, 120, 0.2); color: #68d391; border: 1px solid rgba(72,187,120,0.3); }
.badge-upi { background: rgba(99, 179, 237, 0.2); color: #63b3ed; border: 1px solid rgba(99,179,237,0.3); }
.badge-bank { background: rgba(159, 122, 234, 0.2); color: #b794f4; border: 1px solid rgba(159,122,234,0.3); }
.badge-full { background: rgba(72, 187, 120, 0.2); color: #68d391; border: 1px solid rgba(72,187,120,0.3); }
.badge-partial { background: rgba(246, 173, 85, 0.2); color: #f6ad55; border: 1px solid rgba(246,173,85,0.3); }
.badge-advance { background: rgba(252, 129, 74, 0.2); color: #fc814a; border: 1px solid rgba(252,129,74,0.3); }
.badge-custom { padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-dark .form-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.form-dark .form-control,
.form-dark .form-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  transition: all var(--transition);
}
.form-dark .form-control:focus,
.form-dark .form-select:focus {
  background: rgba(255,255,255,0.08);
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
  color: #fff;
}
.form-dark .form-control::placeholder { color: rgba(255,255,255,0.3); }
.form-dark .form-select option { background: #16213e; color: #fff; }
.form-dark textarea.form-control { resize: vertical; min-height: 100px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--highlight), #c0392b);
  border: none;
  color: white;
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(233, 69, 96, 0.4);
  color: white;
}

.btn-export {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-export-pdf { background: rgba(220, 53, 69, 0.2); color: #fc8181; border: 1px solid rgba(220,53,69,0.3); }
.btn-export-pdf:hover { background: rgba(220,53,69,0.4); color: #fff; }
.btn-export-csv { background: rgba(72,187,120,0.2); color: #68d391; border: 1px solid rgba(72,187,120,0.3); }
.btn-export-csv:hover { background: rgba(72,187,120,0.4); color: #fff; }

/* ─── Chart Containers ────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; }

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.page-link {
  background: rgba(255,255,255,0.05);
  border-color: var(--border);
  color: #a0aec0;
  transition: all var(--transition);
}
.page-link:hover { background: rgba(233,69,96,0.2); color: #fff; border-color: var(--highlight); }
.page-item.active .page-link { background: var(--highlight); border-color: var(--highlight); color: #fff; }
.page-item.disabled .page-link { opacity: 0.4; }

/* ─── Login Page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d0d1f 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(233,69,96,0.1) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(15,52,96,0.3) 0%, transparent 70%);
  bottom: -200px; left: -200px;
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

/* ─── Sidebar Overlay (mobile) ────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.visible {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ─── Section Headers ─────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title-h {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ─── Utility ─────────────────────────────────────────────────────────────── */
.text-gold { color: var(--gold); }
.text-highlight { color: var(--highlight); }
.fw-800 { font-weight: 800; }
.rounded-12 { border-radius: 12px; }
.border-dark-custom { border-color: var(--border) !important; }

/* ─── Amount display ──────────────────────────────────────────────────────── */
.amount-positive { color: #68d391; font-weight: 700; }
.amount-negative { color: #fc8181; font-weight: 700; }
.amount-neutral { color: #63b3ed; font-weight: 700; }
