/* Custom animations & utilities for Tabungan App */

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

* {
  font-family: 'Inter', sans-serif;
}

/* Scrollbar custom */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #6366f1; border-radius: 3px; opacity: 0.5; }
::-webkit-scrollbar-thumb:hover { background: #4f46e5; }

:root {
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(99, 102, 241, 0.1);
  --card-bg: rgba(255, 255, 255, 0.6);
  --card-shadow: 0 10px 40px -10px rgba(31, 38, 135, 0.1);
  --sidebar-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --nav-hover-bg: rgba(99, 102, 241, 0.05);
  --nav-hover-text: #4f46e5;
}

.dark {
  --glass-bg: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(255, 255, 255, 0.05);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
  --sidebar-bg: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --nav-hover-bg: rgba(255, 255, 255, 0.05);
  --nav-hover-text: #ffffff;
}

/* Base Text */
body {
  color: var(--text-main);
}

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

/* Glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
}

.nav-btn {
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--nav-hover-bg);
  color: var(--nav-hover-text);
}

.nav-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
  color: #6366f1;
  border-left: 3px solid #6366f1;
}

/* Premium Gradients */
.bg-premium-indigo {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  position: relative;
  overflow: hidden;
}
.bg-premium-indigo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  pointer-events: none;
}

.bg-premium-green {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
}

.bg-premium-red {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #a5b4fc, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glow effects */
.glow-indigo { box-shadow: 0 0 30px rgba(99, 102, 241, 0.2), inset 0 0 20px rgba(99, 102, 241, 0.1); }
.glow-green { box-shadow: 0 0 30px rgba(34, 197, 94, 0.15); }
.glow-red { box-shadow: 0 0 30px rgba(239, 68, 68, 0.15); }

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.6); }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

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

.animate-fade-in-up { animation: fadeInUp 0.5s ease both; }
.animate-fade-in { animation: fadeIn 0.3s ease both; }
.animate-slide-right { animation: slideInRight 0.4s ease both; }
.animate-slide-left { animation: slideInLeft 0.4s ease both; }
.animate-pulse-glow { animation: pulse-glow 2s infinite; }
.animate-bounce-in { animation: bounce-in 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

/* Delay utilities */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Number counter */
.counter { animation: countUp 0.6s ease both; }

/* Sidebar transition */
.sidebar-transition { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

/* Card hover */
.card-hover {
  transition: all 0.3s ease;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Button press effect */
.btn-press {
  transition: all 0.15s ease;
}
.btn-press:active {
  transform: scale(0.97);
}

/* Toast animations */
@keyframes toast-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}
.toast-enter { animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.toast-leave { animation: toast-out 0.3s ease both; }

/* Progress bar */
.progress-bar {
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal backdrop */
.modal-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Active nav */
.nav-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
  color: #6366f1;
  border-left: 3px solid #6366f1;
}

/* Spinning loader */
.spinner {
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Transaction amount colors */
.amount-income { color: #4ade80; }
.amount-expense { color: #f87171; }

/* Responsive utilities */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
}
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}

/* Number formatting */
.currency { font-variant-numeric: tabular-nums; }

/* Input focus ring */
.input-focus:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
  border-color: #6366f1;
}

/* Ripple effect */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.ripple:hover::after { opacity: 1; }
