@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --sidebar-width: 260px;
  --brand: #b71c1c;
  --brand-light: #ef5350;
  --bg-main: #f5f6fa;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

body {
  background: var(--bg-main);
  color: #2d3436;
  font-size: 0.9rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.02em; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%) !important;
}

.sidebar-header {
  padding: 1.25rem 1.2rem !important;
  border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}

.sidebar-header h5 {
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--brand-light) !important;
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.6);
  border-radius: 8px;
  margin-bottom: 2px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.sidebar .nav-link.active {
  color: #fff;
  background: var(--brand);
}

.sidebar .nav-link .nav-icon {
  width: 22px;
  display: inline-block;
  text-align: center;
  margin-right: 10px;
  font-size: 1rem;
}

.sidebar .mt-auto { border-top: 1px solid rgba(255,255,255,0.08) !important; }

#btnLogout {
  font-size: 0.8rem;
  border-radius: 8px;
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
}
#btnLogout:hover { border-color: var(--brand-light); color: var(--brand-light); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
  backdrop-filter: blur(2px);
}

@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    z-index: 1050;
    transform: translateX(-100%);
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar.show ~ #sidebarBackdrop,
  .sidebar-backdrop.show { display: block; }
}

/* Top bar mobile */
header {
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* Main content */
main { max-width: 1200px; }

/* Cards */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* KPI Cards */
.kpi-card {
  border-left: 4px solid;
  border-radius: 12px;
  padding: 1.25rem !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}
.kpi-card .text-muted { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-card .fs-4 { font-size: 1.5rem !important; font-weight: 700; }
.kpi-card.income { border-left-color: #198754; }
.kpi-card.expense { border-left-color: #dc3545; }
.kpi-card.profit { border-left-color: #0d6efd; }
.kpi-card.count { border-left-color: #6c757d; }

/* Date filter */
.date-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.date-filter-bar .btn-quick {
  font-size: 0.78rem;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid #dee2e6;
  transition: all 0.15s ease;
}

.date-filter-bar .btn-quick:hover { border-color: var(--brand); color: var(--brand); }

.date-filter-bar .btn-quick.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* Tables */
.table { font-size: 0.85rem; }
.table thead th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #636e72;
  border-bottom: 2px solid #e9ecef;
  padding: 0.75rem;
}
.table td { padding: 0.7rem 0.75rem; vertical-align: middle; }
.table-hover tbody tr:hover { background-color: rgba(183, 28, 28, 0.03); }

.table-responsive { overflow-x: auto; }

/* Badges */
.badge-income { background-color: #198754; font-weight: 500; }
.badge-expense { background-color: #dc3545; font-weight: 500; }
.badge { font-size: 0.72rem; padding: 0.35em 0.65em; border-radius: 6px; font-weight: 500; }

/* Buttons */
.btn-danger {
  background: var(--brand);
  border-color: var(--brand);
}
.btn-danger:hover {
  background: #8e0000;
  border-color: #8e0000;
}

.btn-sm { border-radius: 8px; font-size: 0.8rem; font-weight: 500; }

.btn-outline-primary { border-radius: 6px; }
.btn-outline-danger { border-radius: 6px; }

/* Modal */
.modal-content { border: none; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-header { border-bottom: 1px solid #f1f2f6; padding: 1.1rem 1.5rem; }
.modal-title { font-size: 1.05rem; }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { border-top: 1px solid #f1f2f6; padding: 0.85rem 1.5rem; }
.modal-footer .btn { border-radius: 8px; font-size: 0.85rem; }

/* Forms */
.form-control, .form-select {
  border-radius: 8px;
  border: 1px solid #dee2e6;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.12);
}
.form-label { font-size: 0.8rem; font-weight: 500; color: #636e72; margin-bottom: 0.3rem; }

/* Toast */
.toast { border-radius: 10px; font-size: 0.85rem; }

/* Login page */
.card.shadow {
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

/* Chart cards */
.card h6 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #636e72;
  margin-bottom: 1rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* Pagination */
.pagination .page-link { border-radius: 6px; margin: 0 2px; font-size: 0.8rem; }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
