:root {
  /* Modern color palette */
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary: #06b6d4;
  --secondary-dark: #0891b2;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --danger-light: #f87171;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  
  /* Neutral colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Glass and surface effects */
  --surface: rgba(255, 255, 255, 0.95);
  --surface-hover: rgba(255, 255, 255, 1);
  --glass-border: 1px solid rgba(203, 213, 225, 0.4);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  --gradient-success: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  --gradient-danger: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-900);
  /* Finance-themed calm green background with subtle pattern */
  background-color: #f1f8f5;
  background-image:
    radial-gradient(60rem 60rem at 10% -10%, rgba(16, 185, 129, 0.12), transparent 60%),
    radial-gradient(50rem 50rem at 110% 20%, rgba(6, 182, 212, 0.10), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='120' viewBox='0 0 160 120' fill='none'><g opacity='0.12'><path d='M8 96l24-24 28 16 36-44 20 12 16-20' stroke='%2310b981' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/><circle cx='32' cy='72' r='3' fill='%2310b981'/><circle cx='60' cy='88' r='3' fill='%2310b981'/><circle cx='96' cy='44' r='3' fill='%2310b981'/><circle cx='116' cy='56' r='3' fill='%2310b981'/></g><g opacity='0.06'><path d='M0 118h160M0 98h160M0 78h160M0 58h160M0 38h160M0 18h160' stroke='%23000000' stroke-width='1'/></g></svg>");
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Improved glass card */
.glass-card {
  background: var(--surface);
  border-radius: 1.5rem;
  border: var(--glass-border);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2xl);
}

/* Enhanced stat cards */
.stat-card {
  border-radius: 1.5rem;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  color: var(--gray-900);
  background: var(--surface);
  border: var(--glass-border);
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2xl);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.08;
  background: var(--gradient-primary);
  z-index: 0;
}

.stat-card.income::after {
  background: var(--gradient-success);
}

.stat-card.expense::after {
  background: var(--gradient-danger);
}

.stat-card.neutral::after {
  background: var(--gradient-secondary);
}

.stat-card strong,
.stat-card span {
  position: relative;
  z-index: 1;
}

.stat-card strong {
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.2;
  margin-top: 0.5rem;
  display: block;
}

/* Enhanced flash messages */
.flash-message {
  border-radius: 1rem;
  border: var(--glass-border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.flash-message:hover {
  transform: translateX(4px);
}

/* Modern badges */
.badge-income,
.badge-expense {
  border-radius: 999px;
  font-weight: 600;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.badge-income {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
}

.badge-income:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 8px rgba(16, 185, 129, 0.35);
}

.badge-expense {
  background: var(--gradient-danger);
  color: white;
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.25);
}

.badge-expense:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 8px rgba(239, 68, 68, 0.35);
}

/* Enhanced table wrapper */
.table-wrap {
  border-radius: 1.5rem;
  border: var(--glass-border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap thead {
  background: rgba(16, 185, 129, 0.08);
  border-bottom: 2px solid var(--gray-200);
}

.table-wrap th {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  color: var(--gray-600);
  padding: 1rem;
}

.table-wrap td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-100);
}

.table-wrap tbody tr {
  transition: all 0.2s ease;
}

.table-wrap tbody tr:hover {
  background: rgba(16, 185, 129, 0.05);
}

.table-wrap tbody tr:last-child td {
  border-bottom: none;
}

/* Enhanced chart container */
.chart-shell {
  border-radius: 1.5rem;
  border: var(--glass-border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 2rem;
  transition: all 0.3s ease;
}

.chart-shell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

/* Modern gradient buttons */
.btn-gradient {
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 2rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(79, 70, 229, 0.4);
}

.btn-gradient:hover::before {
  left: 100%;
}

.btn-gradient:active {
  transform: translateY(0);
}

.btn-gradient.success {
  background: var(--gradient-success);
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.btn-gradient.success:hover {
  box-shadow: 0 15px 30px rgba(16, 185, 129, 0.4);
}

.btn-gradient.danger {
  background: var(--gradient-danger);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

.btn-gradient.danger:hover {
  box-shadow: 0 15px 30px rgba(239, 68, 68, 0.4);
}

/* Enhanced form fields */
.form-field {
  border-radius: 1rem;
  border: 2px solid var(--gray-200);
  background: var(--surface);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.form-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
  background: rgba(255, 255, 255, 1);
}

.form-field:hover {
  border-color: var(--gray-300);
}

/* Form labels */
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Utility classes */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.bg-gradient-primary {
  background: var(--gradient-primary);
}

.bg-gradient-success {
  background: var(--gradient-success);
}

.bg-gradient-danger {
  background: var(--gradient-danger);
}

/* Enhanced responsive utilities */
@media (max-width: 640px) {
  /* Mobile-specific adjustments */
  .glass-card {
    border-radius: 1rem;
    padding: 1rem;
  }
  
  .stat-card {
    padding: 1.25rem;
  }
  
  .stat-card strong {
    font-size: 1.75rem;
  }
  
  .stat-card .flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }
  
  .chart-shell {
    padding: 1rem;
    margin: 0 -0.5rem;
  }
  
  .btn-gradient {
    padding: 0.625rem 1.25rem;
    font-size: 0.75rem;
    width: 100%;
    justify-content: center;
  }
  
  .table-wrap {
    margin: 0 -0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
  }
  
  .table-wrap th,
  .table-wrap td {
    padding: 0.5rem 0.25rem;
  }
  
  .table-wrap th:nth-child(n+4),
  .table-wrap td:nth-child(n+4) {
    display: none;
  }
  
  /* Mobile table improvements */
  .table-wrap::before {
    content: "Deslize para ver mais →";
    display: block;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 768px) {
  /* Tablet and below adjustments */
  .stat-card {
    padding: 1.5rem;
  }
  
  .stat-card strong {
    font-size: 1.875rem;
  }
  
  .chart-shell {
    padding: 1.5rem;
  }
  
  .btn-gradient {
    padding: 0.625rem 1.5rem;
    font-size: 0.8125rem;
  }
  
  .table-wrap {
    font-size: 0.8125rem;
  }
  
  .table-wrap th,
  .table-wrap td {
    padding: 0.75rem 0.5rem;
  }
  
  /* Form adjustments */
  .form-field {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }
  
  .glass-card {
    padding: 1.5rem;
  }
}

/* Large mobile and small tablet specific */
@media (min-width: 641px) and (max-width: 768px) {
  .table-wrap th:nth-child(6),
  .table-wrap td:nth-child(6) {
    display: none;
  }
}

/* Touch-friendly targets */
@media (hover: none) and (pointer: coarse) {
  .btn-gradient {
    min-height: 44px;
    min-width: 44px;
  }
  
  .badge-income,
  .badge-expense {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
  
  .table-wrap button {
    min-height: 36px;
    padding: 0.5rem 0.75rem;
  }
}

/* Landscape mobile optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .stat-card {
    padding: 1rem;
  }
  
  .stat-card strong {
    font-size: 1.5rem;
  }
  
  .glass-card {
    padding: 1rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .glass-card {
    border-width: 0.5px;
  }
  
  .form-field {
    border-width: 1px;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Animation utilities */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}
