/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #FAFAFA;
  color: #1A1A1A;
  padding-bottom: 72px;
  overflow-x: hidden;
}

/* Header */
.header {
  background: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.app-title {
  font-size: 20px;
  font-weight: 600;
  color: #1A1A1A;
  letter-spacing: -0.3px;
}

/* Main Content */
#main-content {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: calc(100vh - 140px);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Balance Card */
.balance-card {
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
  margin-bottom: 24px;
}

.balance-label {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.balance-amount {
  color: #FFFFFF;
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 6px;
  word-wrap: break-word;
}

.balance-trend {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
}

/* Summary Grid */
.summary-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.summary-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  width: 100%;
}

.summary-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  flex-shrink: 0;
}

.income-card .summary-icon {
  background: #E8F5E9;
  color: #4CAF50;
}

.expense-card .summary-icon {
  background: #FFEBEE;
  color: #F44336;
}

.summary-details {
  flex: 1;
  min-width: 0;
}

.summary-label {
  font-size: 14px;
  color: #757575;
  margin-bottom: 6px;
  font-weight: 500;
}

.summary-value {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  color: #1A1A1A;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
}

/* Quick Actions - REMOVED FROM HOME TAB */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 32px;
}

.action-btn {
  background: #FFFFFF;
  border: 2px solid #E0E0E0;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:active {
  transform: scale(0.98);
}

.income-btn {
  border-color: #4CAF50;
  color: #4CAF50;
}

.income-btn:hover {
  background: #E8F5E9;
}

.expense-btn {
  border-color: #F44336;
  color: #F44336;
}

.expense-btn:hover {
  background: #FFEBEE;
}

.action-icon {
  font-size: 28px;
  font-weight: bold;
}

/* Section Header */
.section-header {
  font-size: 18px;
  font-weight: 700;
  color: #1A1A1A;
  margin-bottom: 16px;
}

/* Transaction List */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transaction-item {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.transaction-icon.income {
  background: #E8F5E9;
}

.transaction-icon.expense {
  background: #FFEBEE;
}

.transaction-info {
  flex: 1;
  min-width: 0;
}

.transaction-category {
  font-size: 15px;
  font-weight: 600;
  color: #1A1A1A;
  margin-bottom: 3px;
}

.transaction-date {
  font-size: 13px;
  color: #757575;
}

.transaction-amount {
  font-size: 16px;
  font-weight: 700;
}

.transaction-amount.income {
  color: #4CAF50;
}

.transaction-amount.expense {
  color: #F44336;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 18px;
  font-weight: 600;
  color: #424242;
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 14px;
  color: #9E9E9E;
}

/* Add Tab */
.add-tab-toggle {
  display: flex;
  background: #F5F5F5;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}

.toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #757575;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: #FFFFFF;
  color: #1A1A1A;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Form */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #424242;
}

.form-group input {
  background: #FFFFFF;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  color: #1A1A1A;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #667EEA;
}

.submit-btn {
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: transform 0.2s;
}

.submit-btn:active {
  transform: scale(0.98);
}

/* Insights Menu */
.insights-menu,
.more-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-option,
.more-option {
  background: #FFFFFF;
  border: none;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: all 0.2s;
  text-align: left;
}

.insight-option:active,
.more-option:active {
  transform: scale(0.99);
}

.option-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F5F5F5;
  border-radius: 10px;
}

.option-text {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #1A1A1A;
}

.option-arrow {
  font-size: 20px;
  color: #BDBDBD;
}

.more-option.danger .option-text {
  color: #F44336;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFFFFF;
  display: flex;
  justify-content: space-around;
  padding: 8px 16px 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  z-index: 100;
}

.nav-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
  flex: 1;
  max-width: 80px;
}

.nav-icon {
  font-size: 22px;
  filter: grayscale(100%);
  opacity: 0.5;
  transition: all 0.2s;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  color: #9E9E9E;
  transition: color 0.2s;
}

.nav-btn.active .nav-icon {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.1);
}

.nav-btn.active .nav-label {
  color: #667EEA;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FAFAFA;
  z-index: 200;
  display: none;
  flex-direction: column;
}

.overlay.active {
  display: flex;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.overlay-header {
  background: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.back-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: #667EEA;
  cursor: pointer;
  padding: 8px;
}

.overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1A1A1A;
  color: #FFFFFF;
  padding: 14px 24px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transition: all 0.3s;
  z-index: 300;
  max-width: 90%;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #F44336;
}

.toast.success {
  background: #4CAF50;
}

/* Charts */
.chart-container {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A1A;
  margin-bottom: 16px;
}

.chart-canvas {
  max-height: 280px;
}

.category-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.category-bar-label {
  min-width: 100px;
  font-size: 14px;
  font-weight: 600;
  color: #424242;
}

.category-bar-fill {
  flex: 1;
  height: 32px;
  background: #F5F5F5;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.category-bar-progress {
  height: 100%;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  border-radius: 8px;
  transition: width 0.5s ease;
}

.category-bar-amount {
  min-width: 80px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: #667EEA;
}

.time-filter {
  display: flex;
  background: #F5F5F5;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.time-filter button,
.time-filter-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #757575;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.time-filter button.active,
.time-filter-btn.active {
  background: #FFFFFF;
  color: #1A1A1A;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
/* Context Menu (Long Press) */
.context-menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 9998;
  transition: background 0.3s;
}

.context-menu-backdrop.active {
  background: rgba(0, 0, 0, 0.5);
}

.context-menu {
  position: fixed;
  bottom: -300px;
  left: 0;
  right: 0;
  background: #FFFFFF;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px 30px;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transition: bottom 0.3s ease;
  max-width: 480px;
  margin: 0 auto;
}

.context-menu.active {
  bottom: 0;
}

.context-menu-item {
  width: 100%;
  background: #F5F5F5;
  border: none;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.context-menu-item:active {
  transform: scale(0.98);
}

.context-menu-item.edit {
  background: #E3F2FD;
  color: #1976D2;
}

.context-menu-item.delete {
  background: #FFEBEE;
  color: #D32F2F;
}

.context-menu-item.cancel {
  background: #E0E0E0;
  color: #424242;
  margin-bottom: 0;
}
