:root {
  --primary-color: #F0A972;
  --primary-gradient: linear-gradient(135deg, #D4956C 0%, #C08556 100%);
  --success-color: #F0A972;
  --danger-color: #E74C3C;
  --warning-color: #F0A972;
  --text-primary: #3d3d3d;
  --text-secondary: #666666;
  --text-light: #999999;
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --border-color: #F0A972;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.app-header {
  background: var(--primary-gradient);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.app-header .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.app-header .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Top Bar */
.top-bar {
  background: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-btn {
  width: 48px;
  height: 26px;
  background: #d4d4d4;
  border: none;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.toggle-slider {
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-slider.active {
  left: 24px;
  background: white;
}

.toggle-btn:has(.toggle-slider.active) {
  background: var(--primary-color);
}

.user-info-top {
  flex: 1;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-info-hidden {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.language-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.language-btn i {
  font-size: 20px;
  color: var(--primary-color);
}

.language-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.balance-card {
  background: var(--primary-gradient);
  border-radius: 4px;
  padding: 16px;
  color: white;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.balance-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.balance-main {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
}

.balance-label {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.balance-amount {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.balance-amount::before {
  content: '¥';
  font-size: 16px;
  margin-right: 4px;
  opacity: 0.8;
}

.balance-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  position: relative;
  z-index: 1;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 8px;
  backdrop-filter: blur(10px);
}

.stat-label {
  font-size: 10px;
  opacity: 0.85;
  margin-bottom: 3px;
  white-space: nowrap;
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
}

.balance-currencies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.currency-item {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 12px;
  backdrop-filter: blur(10px);
}

.currency-code {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.currency-amount {
  font-size: 16px;
  font-weight: 600;
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.filter-tab:hover {
  background: var(--bg-primary);
}

.filter-tab.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

/* Transaction List */
.transaction-list {
  min-height: 200px;
}

.transaction-group {
  margin-bottom: 24px;
}

.transaction-date {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 12px;
  padding: 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transaction-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 4px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
}

.transaction-item:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

.transaction-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
  font-size: 18px;
}

.transaction-icon.income {
  background: transparent;
  color: #666666;
}

.transaction-icon.expense {
  background: transparent;
  color: #E74C3C;
}

.transaction-icon.transfer {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.transaction-icon.refund {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

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

.transaction-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transaction-title.title-income {
  color: #666666;
}

.transaction-title.title-expense {
  color: var(--text-primary);
}

.transaction-meta {
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
}

.transaction-amount {
  font-size: 16px;
  font-weight: 700;
  margin-left: 10px;
  white-space: nowrap;
}

.transaction-amount.positive {
  color: #666666;
}

.transaction-amount.negative {
  color: #E74C3C;
}

.transaction-amount.neutral {
  color: var(--text-secondary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-secondary);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  margin: 0 0 10px 0;
  min-height: calc(100vh - 480px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state i {
  display: none;
}

.empty-state p {
  font-size: 15px;
  margin: 0;
  color: var(--primary-color);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

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

.transaction-item {
  animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 375px) {
  .balance-amount {
    font-size: 32px;
  }
  
  .currency-item {
    padding: 10px;
  }
  
  .currency-amount {
    font-size: 14px;
  }
}

/* Safe area for iOS */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}
