/* ═══════════════════════════════════════════════════════════════════════════
   Real Cash Flow — Design System v2.0
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ─── Color Palette ──────────────────────────────────────────────────── */
  --bg:              #F0F2F5;
  --bg-gradient:     linear-gradient(135deg, #F0F2F5 0%, #E8ECF1 100%);
  --card-bg:         #FFFFFF;
  --card-border:     #E5E7EB;
  --card-shadow:     0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --card-shadow-lg:  0 10px 25px -5px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --glass-bg:        rgba(255,255,255,0.75);
  --glass-blur:      blur(16px);
  --glass-border:    rgba(255,255,255,0.5);
  
  --text:            #111827;
  --text-secondary:  #4B5563;
  --text-muted:      #6B7280;
  --text-faint:      #9CA3AF;
  
  --income:          #059669;
  --income-light:    #D1FAE5;
  --expense:         #DC2626;
  --expense-light:   #FEE2E2;
  --asset:           #2563EB;
  --asset-light:     #DBEAFE;
  --liability:       #D97706;
  --liability-light: #FEF3C7;
  --passive:         #7C3AED;
  --passive-light:   #EDE9FE;
  --accent:          #059669;
  --warn:            #F59E0B;
  --surface:         #F3F4F6;
  --border:          #E5E7EB;

  /* ─── Typography ─────────────────────────────────────────────────────── */
  --font-body:       'Inter', -apple-system, system-ui, sans-serif;
  --font-heading:    'Outfit', 'Inter', sans-serif;
  --fs-xs:           0.6875rem;   /* 11px */
  --fs-sm:           0.8125rem;   /* 13px */
  --fs-base:         0.9375rem;   /* 15px */
  --fs-lg:           1.125rem;    /* 18px */
  --fs-xl:           1.5rem;      /* 24px */
  --fs-2xl:          2rem;        /* 32px */
  --fs-3xl:          2.5rem;      /* 40px */

  /* ─── Spacing ────────────────────────────────────────────────────────── */
  --radius-sm:       8px;
  --radius-md:       12px;
  --radius-lg:       16px;
  --radius-xl:       20px;
  --radius-pill:     9999px;
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: var(--bg-gradient);
  font-family: var(--font-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  margin: 0;
  font-weight: 700;
}

input, select, button, textarea {
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

a { text-decoration: none; color: inherit; }

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ─── Animations ───────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out; }
.animate-slide-up { animation: slideUp 0.5s ease-out; }
.animate-fade-scale { animation: fadeInScale 0.3s ease-out; }

/* ─── Utility Classes ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 20px;
}

.card-hover {
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.card-hover:hover {
  box-shadow: var(--card-shadow-lg);
  transform: translateY(-2px);
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: var(--fs-base);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-shadow: 2px 0 8px rgba(0,0,0,0.03);
  z-index: 10;
}

.sidebar-brand {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  font-family: inherit;
  position: relative;
}

.sidebar-item:hover {
  background: var(--surface);
  color: var(--text);
}

.sidebar-item.active {
  font-weight: 700;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 4px 4px 0;
  transition: all 0.2s;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ─── Mobile Responsiveness ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar becomes bottom nav */
  .app-layout {
    flex-direction: column !important;
  }
  .sidebar {
    width: 100%;
    height: 70px;
    flex-direction: row;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--card-border);
    justify-content: space-around;
    align-items: center;
    background: var(--card-bg);
  }
  .sidebar-brand, .sidebar-footer {
    display: none !important;
  }
  .sidebar-nav {
    flex-direction: row;
    width: 100%;
    justify-content: flex-start;
    padding: 0 10px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }
  .sidebar-item {
    flex-direction: column;
    padding: 8px 12px;
    font-size: 0.65rem;
    gap: 4px;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: auto;
    min-width: 72px;
    flex-shrink: 0;
  }
  .sidebar-item.active::before {
    display: none !important;
  }

  /* Adjust main container padding */
  main.main-content {
    padding: 1.5rem 1rem 85px 1rem !important; /* Extra padding at bottom for nav */
  }

  /* Welcome Page adjustments */
  .welcome-layout {
    flex-direction: column !important;
  }
  .welcome-left {
    padding: 2rem 1.5rem !important;
  }
  .welcome-right {
    padding: 1rem 1.5rem 3rem 1.5rem !important;
  }

  /* Modal full screen */
  .modal-card {
    height: 100%;
    max-height: 100vh;
    border-radius: 0 !important;
    padding: 20px 16px !important;
    overflow-y: auto;
  }

  /* Typography tweaks */
  h1 { font-size: 2rem !important; }
  .grid-2, .grid-auto { grid-template-columns: 1fr !important; }
}
