@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Inter:wght@400;500&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #f0f2f5 0%, #e0e7ff 100%);
  color: #1a202c;
  transition: background 0.5s, color 0.5s;
  overflow-x: hidden;
}

body.dark-mode {
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  color: #e2e8f0;
}

h1, h2, h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}

header {
  background: linear-gradient(90deg, #10b981, #3b82f6);
  color: #ffffff;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

main {
  padding: 20px;
}

/* Pembungkus section */
.section-wrapper {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

body.dark-mode .section-wrapper {
  background: rgba(45, 55, 72, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.section-wrapper:hover {
  transform: translateY(-5px);
}

/* Section tanpa pembungkus (Top Aset Investasi) */
section:not(.section-wrapper) {
  margin-bottom: 40px;
}

/* Untuk section di dalam section-wrapper, hapus margin bawaan */
.section-wrapper section {
  margin-bottom: 0;
}

/* Chart container for expense and income charts */
.expense-income-chart {
  width: 100%;
  min-height: 400px; /* Minimum height to ensure visibility */
  max-height: 600px; /* Maximum height to prevent overflow */
  height: auto; /* Allow dynamic height */
  position: relative;
  margin-bottom: 20px;
}

/* Specific styling for budget chart */
#budgetChart {
  width: 100%;
  height: 100%;
}

/* Chart container for TradingView widgets */
.tradingview-chart {
  width: 100%;
  height: 300px; /* Fixed height suitable for TradingView widgets */
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

#expenseList, #incomeList {
  max-height: 300px;
  overflow-y: auto;
}

.expense-item, .income-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  transition: background-color 0.3s ease;
}

.expense-item {
  background: #fee2e2;
  border-left: 4px solid #ef4444;
}

body.dark-mode .expense-item {
  background: #4b1b1b;
  border-left: 4px solid #f87171;
}

.income-item {
  background: #d1fae5;
  border-left: 4px solid #22c55e;
}

body.dark-mode .income-item {
  background: #1e3a3a;
  border-left: 4px solid #34d399;
}

.expense-item:hover, .income-item:hover {
  background: #fecaca;
}

body.dark-mode .expense-item:hover {
  background: #7f1d1d;
}

body.dark-mode .income-item:hover {
  background: #2a5a5a;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

button:hover {
  transform: scale(1.05);
}

button:active {
  transform: scale(0.95);
}

.bg-green-600 {
  background-color: #22c55e;
}

.bg-red-600 {
  background-color: #ef4444;
}

body.dark-mode .bg-green-600 {
  background-color: #34d399;
}

body.dark-mode .bg-red-600 {
  background-color: #f87171;
}

.loading-spinner {
  border: 4px solid #e5e7eb;
  border-top: 4px solid #22c55e;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

body.dark-mode .loading-spinner {
  border-color: #4b5563;
  border-top-color: #34d399;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease-out;
}

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

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

/* Perbaikan warna teks input dan placeholder */
input, select {
  color: #1a202c; /* Warna teks default untuk mode terang */
  background-color: #ffffff; /* Latar belakang untuk mode terang */
  border: 1px solid #d1d5db; /* Border untuk mode terang */
  transition: color 0.3s, background-color 0.3s, border-color 0.3s;
}

body.dark-mode input,
body.dark-mode select {
  color: #e2e8f0; /* Warna teks untuk dark mode */
  background-color: #374151; /* Latar belakang untuk dark mode */
  border-color: #4b5563; /* Border untuk dark mode */
}

/* Perbaikan warna placeholder */
input::placeholder,
select::placeholder {
  color: #9ca3af; /* Warna placeholder untuk mode terang */
  opacity: 1; /* Pastikan opacity penuh */
}

body.dark-mode input::placeholder,
body.dark-mode select::placeholder {
  color: #9ca3af; /* Warna placeholder untuk dark mode */
}

/* Styles for theme toggle button and icons */
#themeToggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background-color: #ffffff;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}

body.dark-mode #themeToggle {
  background-color: #374151;
  border-color: #4b5563;
}

#themeToggle:hover {
  background-color: #f0f2f5;
}

body.dark-mode #themeToggle:hover {
  background-color: #4b5563;
}

#lightBulb, #moon {
  width: 24px;
  height: 24px;
  fill: #1a202c;
}

body.dark-mode #lightBulb,
body.dark-mode #moon {
  fill: #e2e8f0;
}

.hidden {
  display: none;
}