/* ============================================================
   MONETA — Main Styles
   Glassmorphism + Animated Background + Number Counters
   ============================================================ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ── CSS Variables ── */
:root {
  --orb1: #6366f1;
  --orb2: #8b5cf6;
  --orb3: #06b6d4;
  --orb4: #f59e0b;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  --glass-blur: blur(20px);
  --radius-card: 20px;
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3, .font-bold, .font-semibold {
  font-family: 'Syne', sans-serif;
}

/* ============================================================
   ANIMATED BACKGROUND
   ============================================================ */

/* Background canvas container */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: 
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(99,102,241,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(139,92,246,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 60% 10%, rgba(6,182,212,0.1) 0%, transparent 60%);
}

/* Floating orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 0.6s ease forwards;
}

.bg-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.25), transparent 70%);
  top: -100px; left: -100px;
  animation: orbFloat 0.5s ease forwards, orb1Drift 18s ease-in-out infinite 0.5s;
}
.bg-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.2), transparent 70%);
  bottom: -100px; right: -80px;
  animation: orbFloat 0.7s ease forwards, orb2Drift 22s ease-in-out infinite 0.7s;
}
.bg-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(6,182,212,0.18), transparent 70%);
  top: 40%; left: 60%;
  animation: orbFloat 0.9s ease forwards, orb3Drift 15s ease-in-out infinite 0.9s;
}
.bg-orb-4 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(245,158,11,0.12), transparent 70%);
  top: 20%; right: 20%;
  animation: orbFloat 1.1s ease forwards, orb4Drift 25s ease-in-out infinite 1.1s;
}

@keyframes orbFloat {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes orb1Drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(40px, 60px) scale(1.05); }
  66%       { transform: translate(-20px, 30px) scale(0.95); }
}
@keyframes orb2Drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(-50px, -40px) scale(1.08); }
  70%       { transform: translate(30px, -20px) scale(0.97); }
}
@keyframes orb3Drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(-60px, 50px) scale(1.1); }
}
@keyframes orb4Drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  30%       { transform: translate(30px, -40px) scale(1.05); }
  70%       { transform: translate(-40px, 20px) scale(0.9); }
}

/* Light mode orbs — lighter */
html:not(.dark) .bg-orb-1 {
  background: radial-gradient(circle, rgba(99,102,241,0.12), transparent 70%);
  opacity: 0.7;
}
html:not(.dark) .bg-orb-2 {
  background: radial-gradient(circle, rgba(139,92,246,0.1), transparent 70%);
  opacity: 0.7;
}
html:not(.dark) .bg-orb-3 {
  background: radial-gradient(circle, rgba(6,182,212,0.08), transparent 70%);
}
html:not(.dark) .bg-orb-4 {
  background: radial-gradient(circle, rgba(245,158,11,0.07), transparent 70%);
}

/* Make sure content is above orbs */
nav, .max-w-5xl, #toast-container {
  position: relative;
  z-index: 1;
}

/* ============================================================
   GLASSMORPHISM CARDS
   ============================================================ */

/* Dark mode glass */
.dark .card,
.dark .bg-white.rounded-2xl,
.dark [class*="bg-gray-900"][class*="rounded-2xl"],
.dark [class*="bg-gray-900"][class*="rounded-xl"] {
  background: rgba(17, 24, 39, 0.55) !important;
  backdrop-filter: var(--glass-blur) saturate(1.4);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 
    0 4px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Light mode glass */
html:not(.dark) .card,
html:not(.dark) .bg-white.rounded-2xl,
html:not(.dark) [class*="rounded-2xl"].bg-white {
  background: rgba(255, 255, 255, 0.65) !important;
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 
    0 4px 20px rgba(99, 102, 241, 0.08),
    0 1px 4px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Balance card (indigo) — glass with glow */
.dark .bg-indigo-600.rounded-2xl,
.bg-indigo-600.rounded-2xl {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  box-shadow: 
    0 8px 32px rgba(99, 102, 241, 0.4),
    0 2px 8px rgba(99, 102, 241, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.2) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  backdrop-filter: none !important;
}

/* Card hover */
.card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(99, 102, 241, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

/* Modal glass */
.dark .modal-card {
  background: rgba(15, 20, 35, 0.85) !important;
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.07);
}

html:not(.dark) .modal-card {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(24px) saturate(2);
  -webkit-backdrop-filter: blur(24px) saturate(2);
  border: 1px solid rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 24px 60px rgba(99, 102, 241, 0.15);
}

/* Nav glass */
nav {
  backdrop-filter: blur(20px) saturate(1.5) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.5) !important;
}

.dark nav {
  background: rgba(10, 14, 26, 0.75) !important;
  border-bottom-color: rgba(255, 255, 255, 0.07) !important;
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.3);
}

html:not(.dark) nav {
  background: rgba(255, 255, 255, 0.75) !important;
  border-bottom-color: rgba(99, 102, 241, 0.12) !important;
  box-shadow: 0 1px 20px rgba(99, 102, 241, 0.08);
}

/* ============================================================
   SKELETON LOADERS
   ============================================================ */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.dark .skeleton {
  background: rgba(255, 255, 255, 0.06);
}

html:not(.dark) .skeleton {
  background: rgba(0, 0, 0, 0.07);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 40%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.12) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

html:not(.dark) .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.7) 40%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0.7) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton elements */
.skeleton-text   { height: 14px; border-radius: 6px; margin-bottom: 8px; }
.skeleton-num    { height: 36px; width: 140px; border-radius: 8px; }
.skeleton-num-sm { height: 28px; width: 100px; border-radius: 8px; }
.skeleton-line   { height: 12px; border-radius: 5px; margin-bottom: 6px; }
.skeleton-dot    { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.skeleton-bar    { height: 8px; border-radius: 4px; }

/* ============================================================
   NUMBER COUNTER ANIMATION
   ============================================================ */

.count-up {
  display: inline-block;
  transition: opacity 0.2s ease;
}

.count-up.counting {
  animation: countPulse 0.08s ease-in-out;
}

@keyframes countPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ============================================================
   INPUT GLASS STYLE
   ============================================================ */

.dark input, .dark select {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #f3f4f6 !important;
}
.dark input:focus, .dark select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
.dark input::placeholder { color: rgba(255,255,255,0.25) !important; }

html:not(.dark) input:focus,
html:not(.dark) select:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.bg-indigo-600 {
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
  transition: all 0.18s ease !important;
}
.bg-indigo-600:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}
.bg-indigo-600:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ============================================================
   PROGRESS BAR GLOW
   ============================================================ */

.progress-fill.bg-indigo-500 {
  box-shadow: 0 0 8px rgba(99,102,241,0.5);
}
.progress-fill.bg-emerald-500 {
  box-shadow: 0 0 8px rgba(16,185,129,0.5);
}
.progress-fill.bg-red-500 {
  box-shadow: 0 0 8px rgba(239,68,68,0.4);
}
.progress-fill.bg-amber-400 {
  box-shadow: 0 0 8px rgba(251,191,36,0.4);
}

/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */

.page-fade {
  animation: pageFadeNew 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pageFadeNew {
  from { 
    opacity: 0; 
    transform: translateY(12px) scale(0.99); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

/* Stagger children of page-fade */
.page-fade > * {
  animation: childFade 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.page-fade > *:nth-child(1) { animation-delay: 0.05s; }
.page-fade > *:nth-child(2) { animation-delay: 0.1s; }
.page-fade > *:nth-child(3) { animation-delay: 0.15s; }
.page-fade > *:nth-child(4) { animation-delay: 0.2s; }
.page-fade > *:nth-child(5) { animation-delay: 0.25s; }

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

/* ============================================================
   TOAST IMPROVEMENTS
   ============================================================ */

.toast {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
  background: rgba(99,102,241,0.3); 
  border-radius: 4px; 
}
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.5); }

/* ============================================================
   TRANSACTION ROW HOVER
   ============================================================ */

.dark [class*="border-gray-50"] {
  border-color: rgba(255,255,255,0.05) !important;
}

/* Glowing dot for transaction type */
.tx-icon-income {
  background: rgba(16,185,129,0.15) !important;
  box-shadow: 0 0 10px rgba(16,185,129,0.2);
}
.tx-icon-expense {
  background: rgba(239,68,68,0.12) !important;
  box-shadow: 0 0 10px rgba(239,68,68,0.18);
}

/* ============================================================
   LOGO GLOW
   ============================================================ */

.w-8.h-8.bg-indigo-600.rounded-lg {
  box-shadow: 0 0 12px rgba(99,102,241,0.4), 0 2px 6px rgba(0,0,0,0.2);
}

/* ============================================================
   ACTIVE NAV LINK
   ============================================================ */

.dark .nav-link.active {
  background: rgba(99, 102, 241, 0.2) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
