/* ============================================
   Finance Tracker - style.css
   Author: Sumit Kumar
   Description: All styling for the finance
   tracker app. Dark theme with green accents.
   ============================================ */


/* ── CSS Variables (change colors from here) ── */
:root {
  --bg-main: #0d0f14;
  --bg-card: #151820;
  --bg-input: #1c2030;
  --border: #252a3a;
  --accent-green: #00e5a0;
  --accent-red: #ff4f6d;
  --accent-blue: #4f8eff;
  --accent-yellow: #ffd166;
  --text-primary: #eef0f7;
  --text-secondary: #7a8099;
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}


/* ── Reset - removes default browser spacing ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


/* ── Body - dark background with subtle grid ── */
body {
  background: var(--bg-main);
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  /* this creates the dot grid pattern you see in background */
  background-image: radial-gradient(circle at 1px 1px, #1e2235 1px, transparent 0);
  background-size: 32px 32px;
}


/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  /* frosted glass effect */
  background: rgba(13, 15, 20, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-green);
  letter-spacing: -0.5px;
}

/* "Tracker" part stays white */
.navbar .logo span {
  color: var(--text-primary);
}

.nav-date {
  font-size: 13px;
  color: var(--text-secondary);
}


/* ── Main container ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px;
}


/* ── Summary Cards Grid ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

/* lift up on hover */
.summary-card:hover {
  transform: translateY(-3px);
}

/* colored left bar - different for each card */
.summary-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.summary-card.balance::before { background: var(--accent-blue); }
.summary-card.income::before  { background: var(--accent-green); }
.summary-card.expense::before { background: var(--accent-red); }

.card-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.card-amount {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

/* each amount has its own color */
.card-amount.balance { color: var(--accent-blue); }
.card-amount.income  { color: var(--accent-green); }
.card-amount.expense { color: var(--accent-red); }

/* big emoji in the corner of each card */
.card-icon {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  opacity: 0.15;
}


/* ── Two column layout for form + chart ── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}


/* ── Form Card ── */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* small green dot next to section titles */
.section-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
}

/* income/expense toggle switch */
.type-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}

.type-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* green when income selected */
.type-btn.active-income {
  background: var(--accent-green);
  color: #000;
}

/* red when expense selected */
.type-btn.active-expense {
  background: var(--accent-red);
  color: #fff;
}

/* form input groups */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

/* green border glow when focused */
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-green);
}

.form-group select option {
  background: var(--bg-card);
}

/* submit button */
.add-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-green);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.add-btn:hover {
  background: #00ffb3;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 229, 160, 0.3);
}

.add-btn:active {
  transform: translateY(0);
}


/* ── Chart Card ── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.chart-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* shown when there are no expenses yet */
.chart-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.chart-empty .emoji {
  font-size: 40px;
  margin-bottom: 10px;
}


/* ── Transactions Card ── */
.transactions-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

/* filter buttons row */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* active filter gets green background */
.filter-btn.active {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
  font-weight: 500;
}

/* single transaction row */
.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-input);
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  /* animate in when added */
  animation: slideIn 0.3s ease;
}

/* slides in from left when a new item is added */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.transaction-item:hover {
  border-color: var(--border);
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* emoji icon box for each category */
.tx-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.tx-info .tx-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.tx-info .tx-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.tx-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tx-amount {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
}

/* green for income, red for expense */
.tx-amount.income  { color: var(--accent-green); }
.tx-amount.expense { color: var(--accent-red); }

/* delete button - turns red on hover */
.del-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.del-btn:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}

/* shown when no transactions match the filter */
.no-transactions {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.no-transactions .emoji {
  font-size: 48px;
  margin-bottom: 12px;
}


/* ── Toast Notification ── */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  /* hidden by default - JS adds .show class */
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: var(--shadow);
}

/* JS adds this class to show the toast */
.toast.show {
  transform: translateY(0);
  opacity: 1;
}


/* ── Responsive - mobile screens ── */
@media (max-width: 768px) {
  .summary-grid { grid-template-columns: 1fr; }
  .main-grid    { grid-template-columns: 1fr; }
  .navbar       { padding: 16px 20px; }
  .container    { padding: 20px 16px; }
}
