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

/* Custom CSS Variables matching the original Tailwind config */
:root {
  --background: 220 20% 97%;
  --foreground: 222 47% 11%;

  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;

  --popover: 0 0% 100%;
  --popover-foreground: 222 47% 11%;

  --primary: 222 60% 18%;
  --primary-foreground: 210 40% 98%;

  --secondary: 220 14% 92%;
  --secondary-foreground: 222 47% 11%;

  --muted: 220 14% 95%;
  --muted-foreground: 220 9% 46%;

  --accent: 220 14% 92%;
  --accent-foreground: 222 47% 11%;

  --destructive: 0 72% 51%;
  --destructive-foreground: 210 40% 98%;

  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 222 60% 18%;

  --radius: 0.75rem;

  /* Custom tokens */
  --profit: 152 69% 31%;
  --profit-foreground: 152 69% 96%;
  --profit-muted: 152 40% 94%;
  --loss: 0 72% 51%;
  --loss-foreground: 0 72% 96%;
  --loss-muted: 0 40% 96%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.text-profit {
  color: hsl(var(--profit));
}

.text-loss {
  color: hsl(var(--loss));
}

.bg-profit-muted {
  background-color: hsl(var(--profit-muted));
}

.bg-loss-muted {
  background-color: hsl(var(--loss-muted));
}

/* Input styles */
input,
select {
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
}

input:focus,
select:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.35);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Dialog overlay */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.dialog-overlay.open {
  display: flex;
}

.dialog-content {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  max-width: 32rem;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.scroll-top-btn {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid hsl(var(--primary) / 0.12);
  border-radius: 1.1rem;
  background:
    linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--secondary) / 0.95) 100%);
  color: hsl(var(--primary));
  box-shadow:
    0 18px 35px hsl(222 47% 11% / 0.16),
    0 4px 12px hsl(222 47% 11% / 0.08);
  z-index: 40;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(1rem) scale(0.92);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  overflow: hidden;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.scroll-top-btn:hover {
  transform: translateY(-0.2rem) scale(1.02);
  background:
    linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--primary-foreground)) 100%);
  box-shadow:
    0 22px 40px hsl(222 47% 11% / 0.2),
    0 6px 16px hsl(222 47% 11% / 0.1);
}

.scroll-top-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px hsl(var(--ring) / 0.18),
    0 18px 35px hsl(222 47% 11% / 0.16);
}

.scroll-top-btn__glow {
  position: absolute;
  inset: -35%;
  background:
    radial-gradient(circle, hsl(var(--primary) / 0.18) 0%, transparent 58%);
  pointer-events: none;
}

@media (max-width: 640px) {
  .scroll-top-btn {
    right: 1rem;
    bottom: 1rem;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
  }
}

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

::-webkit-scrollbar-track {
  background: hsl(220 14% 95%);
}

::-webkit-scrollbar-thumb {
  background: hsl(220 9% 46%);
  border-radius: 4px;
}
