body {
  font-family: "Arial", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #f0f2f5; /* Light grey-blue background */
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  color: #333;
}

.container {
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  padding: 35px;
  max-width: 1200px;
  width: 100%;
  text-align: center;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  color: #007bff; /* Primary blue heading */
  margin-bottom: 25px;
  font-size: 2.5em;
  position: relative;
  padding-bottom: 10px;
}
h1::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background-color: #007bff;
  border-radius: 2px;
}

.instructions {
  background-color: #e9f5ff; /* Lighter blue for instructions */
  border: 1px solid #cce0ff;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 25px;
  text-align: left;
  font-size: 0.9em;
  color: #0056b3;
  line-height: 1.5;
}
.instructions h3 {
  margin-top: 0;
  color: #004085;
  font-size: 1.2em;
  margin-bottom: 10px;
}
.instructions ul {
  margin: 0;
  padding-left: 20px;
}
.instructions li {
  margin-bottom: 5px;
}

.summary-box {
  display: flex;
  justify-content: space-around;
  background-color: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  flex-wrap: wrap;
  gap: 15px;
}
.summary-item {
  flex: 1;
  min-width: 120px; /* Ensure items don't get too small */
  text-align: center;
  padding: 5px;
}
.summary-item h3 {
  margin: 0 0 8px 0;
  font-size: 1.1em;
  color: #555;
}
.summary-amount {
  font-size: 1.5em;
  font-weight: bold;
}
.summary-amount.balance {
  color: #007bff;
}
.summary-amount.income {
  color: #28a745;
} /* Green */
.summary-amount.expense {
  color: #dc3545;
} /* Red */

.form-section {
  background-color: #fdfdfd;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 25px;
  text-align: left;
}
.form-section h2 {
  margin-top: 0;
  color: #495057;
  font-size: 1.5em;
  margin-bottom: 15px;
  text-align: center;
}
.input-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.input-group label {
  font-weight: bold;
  color: #555;
}
.input-group input[type="text"],
.input-group input[type="number"],
.input-group select {
  padding: 12px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  box-sizing: border-box;
  width: 100%;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.input-group input[type="text"]:focus,
.input-group input[type="number"]:focus,
.input-group select:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.button-group {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}
.btn {
  flex: 1;
  padding: 12px 15px;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 0.5px;
}
.btn-income {
  background-color: #28a745; /* Green */
}
.btn-income:hover {
  background-color: #218838;
  transform: translateY(-2px);
}
.btn-expense {
  background-color: #dc3545; /* Red */
}
.btn-expense:hover {
  background-color: #c82333;
  transform: translateY(-2px);
}

.transactions-history {
  text-align: left;
  margin-top: 30px;
}
.transactions-history h2 {
  color: #495057;
  font-size: 1.5em;
  margin-bottom: 15px;
  text-align: center;
}
.transaction-list {
  list-style: none;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background-color: #fdfdfd;
}
.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #eee;
  background-color: #ffffff;
  transition: background-color 0.2s ease;
}
.transaction-item:hover {
  background-color: #f5f5f5;
}
.transaction-item:last-child {
  border-bottom: none;
}
.transaction-item.income {
  border-right: 5px solid #28a745;
}
.transaction-item.expense {
  border-right: 5px solid #dc3545;
}
.transaction-details {
  flex-grow: 1;
}
.transaction-details .description {
  font-weight: bold;
  color: #444;
  margin-bottom: 5px;
}
.transaction-details .date {
  font-size: 0.8em;
  color: #888;
}
.transaction-amount {
  font-weight: bold;
  font-size: 1.1em;
  white-space: nowrap;
}
.delete-btn {
  background-color: #e9ecef;
  color: #6c757d;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 1.2em;
  cursor: pointer;
  margin-left: 15px;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}
.delete-btn:hover {
  background-color: #dc3545;
  color: white;
}
.no-transactions {
  text-align: center;
  padding: 20px;
  color: #888;
}
.error-message {
  color: #dc3545;
  font-weight: bold;
  margin-top: 10px;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .container {
    padding: 15px;
  }
  h1 {
    font-size: 2em;
  }
  .summary-item {
    min-width: 100px;
    flex-basis: 45%; /* Allow two items per row */
  }
  .summary-box {
    gap: 10px;
  }
  .button-group {
    flex-direction: column;
    gap: 10px;
  }
  .btn {
    width: 100%;
    padding: 10px;
    font-size: 0.9em;
  }
  .transactions-history h2,
  .form-section h2 {
    font-size: 1.3em;
  }
}
