/* ============================================================
   KeuanganKu — Custom CSS
   ============================================================ */

/* Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

/* CSS Variables */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
  --sidebar-hover: #1e293b;
  --topbar-h: 64px;
  --primary: #3b82f6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --income-color: #10b981;
  --expense-color: #ef4444;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg);
  margin: 0;
  overflow-x: hidden;
}

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-body {
  margin: 0;
  padding: 0;
}

.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-bg::before {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.15) 0%,
    transparent 70%
  );
  top: -200px;
  left: -200px;
  border-radius: 50%;
}

.auth-bg::after {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.12) 0%,
    transparent 70%
  );
  bottom: -100px;
  right: -100px;
  border-radius: 50%;
}

.auth-card-wrapper {
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  color: #f1f5f9;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: white;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin: 0;
}
.auth-subtitle {
  color: #94a3b8;
  margin: 4px 0 0;
}

.auth-card .form-control,
.auth-card .form-floating .form-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white !important;
  border-radius: var(--radius-sm);
}

.auth-card .form-control:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  color: white;
}

.auth-card .form-floating label {
  color: #94a3b8;
}
.auth-card .form-control::placeholder {
  color: #64748b;
}

.btn-auth {
  padding: 14px;
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border: none;
  letter-spacing: 0.3px;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.btn-auth:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.auth-divider {
  text-align: center;
  position: relative;
  margin: 20px 0;
  color: #64748b;
}
.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 43%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.auth-divider::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 43%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-footer-text {
  text-align: center;
  color: #94a3b8;
  margin-top: 20px;
}
.auth-footer-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.demo-credentials {
  text-align: center;
  margin-top: 12px;
}

/* ============================================================
   Layout — Sidebar & Wrapper
   ============================================================ */
.wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 24px 20px;
  font-size: 20px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), transparent);
}

.sidebar-logo i {
  color: var(--primary);
  font-size: 22px;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar {
  color: #64748b;
}
.user-info {
  display: flex;
  flex-direction: column;
}
.user-info strong {
  color: #e2e8f0;
  font-size: 13px;
}

.sidebar-menu {
  list-style: none;
  padding: 12px 12px;
  margin: 0;
  flex: 1;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.sidebar-menu li a:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-menu li a.active {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-menu li a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.menu-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #475569;
  padding: 12px 14px 4px;
  text-transform: uppercase;
}

.menu-separator {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin: 8px 0;
}

/* ============================================================
   Topbar
   ============================================================ */
#content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    margin 0.3s,
    width 0.3s;
}

.topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}

.topbar .btn-link {
  color: var(--text-muted);
  padding: 4px 8px;
}
.topbar .btn-link:hover {
  color: var(--primary);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-user {
  color: var(--text-main);
  font-weight: 500;
  text-decoration: none;
}

/* ============================================================
   Page Content
   ============================================================ */
.page-content {
  padding: 28px 28px;
  flex: 1;
}
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}
.page-subtitle {
  color: var(--text-muted);
  margin: 4px 0 0;
  font-size: 13px;
}

/* ============================================================
   Cards
   ============================================================ */
.card-custom {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-custom-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to right, #f8fafc, #ffffff);
}

.card-custom-header h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.card-custom-body {
  padding: 20px;
}

/* ============================================================
   Stat Cards
   ============================================================ */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: none;
  color: white;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card-income {
  background: linear-gradient(135deg, #10b981, #059669);
}
.stat-card-expense {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.stat-card-balance {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.stat-card-total {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.stat-card-users {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-icon {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stat-label {
  font-size: 12px;
  opacity: 0.85;
  font-weight: 500;
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Badges
   ============================================================ */
.badge-income {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-expense {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-category {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

/* ============================================================
   Text Helpers
   ============================================================ */
.text-income {
  color: var(--income-color) !important;
}
.text-expense {
  color: var(--expense-color) !important;
}
.fw-600 {
  font-weight: 600;
}

/* ============================================================
   Mini Stats
   ============================================================ */
.mini-stat {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.mini-stat.income {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-left: 3px solid #10b981;
}
.mini-stat.expense {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border-left: 3px solid #ef4444;
}
.mini-stat.balance {
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  border-left: 3px solid #3b82f6;
}

/* ============================================================
   Type Toggle (Add Transaction)
   ============================================================ */
.type-toggle {
  display: flex;
  gap: 8px;
}
.type-radio {
  display: none;
}

.type-label {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  color: var(--text-muted);
  background: white;
}

.type-radio:checked + .type-label.income {
  border-color: var(--income-color);
  background: rgba(16, 185, 129, 0.08);
  color: var(--income-color);
}

.type-radio:checked + .type-label.expense {
  border-color: var(--expense-color);
  background: rgba(239, 68, 68, 0.06);
  color: var(--expense-color);
}

/* ============================================================
   Budget Cards
   ============================================================ */
.budget-card {
  padding: 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ============================================================
   Profile Avatar
   ============================================================ */
.profile-avatar {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: white;
}

/* ============================================================
   Tables
   ============================================================ */
.table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  background: #f8fafc;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.table-hover tbody tr:hover {
  background: #f8fafc;
}

/* ============================================================
   Forms
   ============================================================ */
.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: 14px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-group-text {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 600;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

/* ============================================================
   Dropdown
   ============================================================ */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13px;
}

/* ============================================================
   Pagination
   ============================================================ */
.page-link {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  font-size: 13px;
}
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  #content {
    margin-left: 0;
    width: 100%;
  }
  .page-content {
    padding: 16px;
  }
  .stat-value {
    font-size: 15px;
  }
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}
.sidebar-overlay.show {
  display: block;
}

/* Alert */
.alert {
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.opacity-25 {
  opacity: 0.25;
}
