/* Reset & General Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background: linear-gradient(135deg, #f4f7fb 0%, #e8eef7 100%);
  color: #2f3a49;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 1000px;
  animation: fadeIn 0.8s ease-in-out;
}

/* Header Animation */
.app-header {
  text-align: center;
  margin-bottom: 30px;
  animation: slideDown 0.6s ease-out;
}

.app-header h1 {
  font-size: 2.2rem;
  color: #375a7f;
  background: -webkit-linear-gradient(45deg, #6ea8cc, #375a7f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header p {
  color: #5f6f83;
  font-size: 0.95rem;
}

/* Dashboard Cards */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.card {
  background: #ffffff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(92, 112, 138, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 36px rgba(92, 112, 138, 0.16);
}

.card h3 {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 10px;
}

.card .amount {
  font-size: 1.8rem;
  font-weight: 700;
}

.budget-card .amount { color: #5b8cb9; }
.spent-card .amount { color: #e16a74; }
.balance-card .amount { color: #4fae8f; }

.btn-sm {
  margin-top: 10px;
  background: #5b8cb9;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.3s ease;
}

.btn-sm:hover {
  background: #7aa6cf;
}

/* Progress Bar */
.progress-section {
  background: #ffffff;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 30px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #4a5568;
}

.progress-bar-bg {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #4fae8f;
  border-radius: 10px;
  transition: width 0.5s ease-in-out, background-color 0.5s ease;
}

/* Warning State for Progress Bar */
.progress-bar-fill.warning {
  background: #ff5555;
  animation: pulse 1.5s infinite;
}

.alert-message {
  display: none;
  color: #d9534f;
  font-size: 0.85rem;
  margin-top: 10px;
  font-weight: 600;
  animation: shake 0.5s ease;
}

/* Main Content Layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 25px;
}

/* Form Styles */
.form-section, .history-section {
  background: #ffffff;
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(92, 112, 138, 0.08);
}

.form-section h2, .history-header h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: #2f3a49;
}

.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: #5f6f83;
  margin-bottom: 5px;
}

.input-group input, .input-group select, .filter-controls input, .filter-controls select {
  width: 100%;
  padding: 12px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #2f3a49;
  outline: none;
  transition: border-color 0.3s ease;
}

.input-group input:focus, .input-group select:focus, .filter-controls input:focus {
  border-color: #5b8cb9;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(45deg, #5b8cb9, #7aa6cf);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(143, 148, 251, 0.4);
}

/* History Controls & List */
.filter-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.expense-list {
  list-style: none;
  max-height: 350px;
  overflow-y: auto;
}

.expense-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fbff;
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 12px;
  animation: slideInRight 0.4s ease-out;
  border-left: 4px solid #5b8cb9;
  box-shadow: 0 10px 20px rgba(94, 123, 153, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.expense-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(94, 123, 153, 0.12);
}

.expense-details h4 {
  font-size: 0.95rem;
  color: #2f3a49;
}

.expense-details span {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
}

.expense-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.expense-amount {
  font-weight: 700;
  color: #e16a74;
}

.delete-btn {
  background: none;
  border: none;
  color: #6272a4;
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.2s ease;
}

.delete-btn:hover {
  color: #ff5555;
}

/* CSS Keyframe Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Responsive Styles (Media Queries) */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .filter-controls {
    flex-direction: column;
  }
}