* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
}

body {
  background: #f3f4f6;
  padding: 40px 20px;
}

.app {
  max-width: 650px;
  width: 100%;
  margin: 40px auto;
  background: #ffffff;
  padding: 32px;
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.app-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #4f46e5;
  text-align: center;
}

.app-header p {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  margin-top: 6px;
}

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.card {
  padding: 16px;
  border-radius: 18px;
  text-align: center;
  transition: 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card p {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
}

.balance-card {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: white;
}

.balance-card:hover {
  box-shadow: 0px 10px 25px rgba(124, 58, 237, 0.35);
  transform: translateY(-4px);
}

.income-card {
  background: linear-gradient(135deg, #6ee7b7, #10b981);
  color: white;
}

.income-card:hover {
  box-shadow: 0px 10px 25px rgba(16, 185, 129, 0.35);
  transform: translateY(-4px);
}

.expense-card {
  background: linear-gradient(135deg, #fca5a5, #ef4444);
  color: white;
}

.expense-card:hover {
  box-shadow: 0px 10px 25px rgba(239, 68, 68, 0.35);
  transform: translateY(-4px);
}

.add-transaction h2 {
  font-size: 20px;
  color: #4f46e5;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 12px;
}

label {
  font-size: 14px;
  color: #4b5563;
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-size: 14px;
  color: #374151;
  margin-bottom: 14px;
  transition: 0.25s ease;
}

input:hover,
select:hover {
  border-color: #4f46e5;
  box-shadow: 0px 6px 16px rgba(79, 70, 229, 0.1);
}

input:focus,
select:focus {
  border-color: #4f46e5;
  box-shadow: 0px 0px 0px 3px rgba(79, 70, 229, 0.25);
  outline: none;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

#add-btn {
  background: #4f46e5;
  color: white;
  padding: 12px 20px;
  border-radius: 14px;
  border: none;
  width: 100%;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  margin-top: 6px;
  transition: 0.3s ease;
}

#add-btn:hover {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0px 8px 20px rgba(79, 70, 229, 0.35);
  transform: translateY(-3px);
}

.filters h2 {
  font-size: 20px;
  color: #4f46e5;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-btn {
  background: #e8eaf0;
  color: #374151;
  padding: 8px 18px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: 0.25s ease;
}

.filter-btn:hover {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0px 4px 16px rgba(79, 70, 229, 0.2);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: #4f46e5;
  color: white;
  box-shadow: 0px 4px 16px rgba(79, 70, 229, 0.3);
}

#filter-category {
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid #e0e3f0;
  background: #ffffff;
  font-size: 14px;
  color: #374151;
  transition: 0.25s ease;
  width: 100%;
}

#filter-category:hover {
  border-color: #4f46e5;
  box-shadow: 0px 4px 12px rgba(79, 70, 229, 0.12);
}

.transactions h2 {
  font-size: 20px;
  color: #4f46e5;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 12px;
}

#transaction-list {
  list-style: none;
  padding: 0;
  margin-top: 10px;
}

.transaction {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: #ffffff;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0px 6px 14px rgba(0, 0, 0, 0.05);
  transition: 0.3s ease;
}

.transaction:hover {
  transform: translateY(-4px);
  box-shadow: 0px 12px 24px rgba(79, 70, 229, 0.18);
}

.transaction-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 330px;
}

.transaction .text {
  font-size: 15px;
  font-weight: 500;
  color: #1f2937;
}

.transaction .meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
}

.transaction.income .amount {
  color: #10b981; /* green */
  font-weight: 600;
}

.transaction.expense .amount {
  color: #ef4444; /* red */
  font-weight: 600;
}

.delete-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  transition: 0.3s ease;
}

.delete-btn:hover {
  color: #ef4444;
  transform: scale(1.15);
}

.chart-section {
  margin-top: 30px;
}

.chart-section h2 {
  font-size: 20px;
  color: #4f46e5;
  font-weight: 600;
  margin-bottom: 14px;
}

#expense-chart {
  width: 100%;
  max-height: 260px;
  background: #ffffff;
  padding: 20px;
  border-radius: 18px;
  box-shadow: 0px 6px 14px rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, #eef2ff, #ffffff);
}

.chart-placeholder {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: #6b7280;
}

.app-footer {
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-info {
  font-size: 13px;
  color: #6b7280;
}

#reset-btn {
  background: #ef4444;
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: 0.25s ease;
}

#reset-btn:hover {
  background: #ffffff;
  color: #ef4444;
  border: 2px solid #ef4444;
  box-shadow: 0px 8px 20px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

.toast {
  position: fixed;
  top: 20px;
  right: -320px;
  background: white;
  color: #333;
  padding: 14px 18px;
  border-radius: 8px;
  width: auto;
  max-width: 300px;
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.15);
  justify-content: space-between;
}

.toast-close {
  cursor: pointer;
  font-size: 20px;
  color: #333;
  margin-left: 10px;
}

.toast.show {
  right: 20px;
  opacity: 1;
}

.toast-line {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  animation: toastLine 3s linear forwards;
}

.toast-line.success {
  background: #10b981 !important;
}

.toast-line.error {
  background: #ef4444 !important;
}

.toast-line.info {
  background: #3b82f6 !important;
}
@keyframes toastLine {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

#confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.hidden {
  display: none !important;
}

.modal-box {
  background: white;
  padding: 20px 25px;
  border-radius: 14px;
  width: 300px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.3s ease;
}

.modal-buttons {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
}

#confirm-cancel,
#confirm-ok {
  background: #e5e7eb;
  color: #111;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

#confirm-ok:hover,
#confirm-cancel:hover {
  background: #4f46e5;
  color: white;
  box-shadow: 0px 4px 16px rgba(79, 70, 229, 0.2);
  transform: translateY(-2px);
}

@keyframes fadeIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#confirm-ok.active {
  background: #4f46e5;
  color: white;
  box-shadow: 0px 4px 16px rgba(79, 70, 229, 0.3);
}

@media (max-width: 480px) {
  .app {
    max-width: 100% !important;
    width: 100% !important;
    padding: 16px !important;
    margin: 0 auto !important;
  }
  .card {
    padding: 12px !important;
    border-radius: 12px !important;
    text-align: center;
  }

  .card h3 {
    font-size: 16px !important;
  }

  .card p {
    font-size: 16px !important;
    margin-top: 4px !important;
  }

  .summary {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
  }

  .summary .card {
    padding: 8px !important;
    border-radius: 12px !important;
    width: 100% !important;
  }

  .summary .card h2 {
    font-size: 18px !important;
  }

  .summary .card p {
    font-size: 14px !important;
  }

  .app-header h1 {
    font-size: 20px !important;
  }

  .app-header p {
    font-size: 12px !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  input,
  select {
    padding: 10px 12px;
    font-size: 13px;
  }

  #add-btn {
    font-size: 14px;
    padding: 10px;
    border-radius: 12px;
  }

  .filter-btn {
    font-size: 13px;
    padding: 8px 14px;
  }

  #filter-category {
    font-size: 13px;
    padding: 9px 12px;
  }

  .transaction {
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px;
  }

  .transaction-main {
    flex: 1 !important;
  }

  .delete-btn {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    font-size: 18px !important;
  }

  .transaction .text {
    font-size: 14px;
  }

  .transaction .amount {
    font-size: 14px;
  }

  #expense-chart {
    padding: 10px;
    max-height: 200px;
  }

  .app-footer {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  #reset-btn {
    width: 100%;
    font-size: 14px;
    padding: 12px;
    border-radius: 12px;
  }

  .save-info {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .app {
    padding: 24px;
  }

  .summary {
    grid-template-columns: 1fr 1fr !important;
    gap: 14px;
  }

  .transaction {
    gap: 12px;
  }

  .transaction-main {
    max-width: 100%;
  }

  #expense-chart {
    max-height: 230px;
  }
}

@media (max-width: 1024px) {
  .app {
    max-width: 90%;
  }

  .summary {
    grid-template-columns: 1fr 1fr 1fr;
  }

  #expense-chart {
    max-height: 260px;
  }
}
