@import "tailwindcss";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

:root {
  --radius: 1rem;
  --background: #fafafa;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --popover: #ffffff;
  --popover-foreground: #0a0a0a;
  --primary: #0a0a0a;
  --primary-foreground: #ffffff;
  --secondary: #f5f5f5;
  --secondary-foreground: #0a0a0a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #0a0a0a;
  --destructive: #ef4444;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #0a0a0a;
  --chart-1: #6366f1;
  --chart-2: #8b5cf6;
  --chart-3: #ec4899;
  --chart-4: #f59e0b;
  --chart-5: #10b981;
  --sidebar: #ffffff;
  --sidebar-foreground: #0a0a0a;
  --sidebar-primary: #0a0a0a;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #f5f5f5;
  --sidebar-accent-foreground: #0a0a0a;
  --sidebar-border: #e5e5e5;
  --sidebar-ring: #0a0a0a;
}

.dark {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #171717;
  --card-foreground: #fafafa;
  --popover: #171717;
  --popover-foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #0a0a0a;
  --secondary: #262626;
  --secondary-foreground: #fafafa;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --accent: #262626;
  --accent-foreground: #fafafa;
  --destructive: #dc2626;
  --border: #262626;
  --input: #262626;
  --ring: #fafafa;
  --chart-1: #818cf8;
  --chart-2: #a78bfa;
  --chart-3: #f472b6;
  --chart-4: #fbbf24;
  --chart-5: #34d399;
  --sidebar: #171717;
  --sidebar-foreground: #fafafa;
  --sidebar-primary: #fafafa;
  --sidebar-primary-foreground: #0a0a0a;
  --sidebar-accent: #262626;
  --sidebar-accent-foreground: #fafafa;
  --sidebar-border: #262626;
  --sidebar-ring: #fafafa;
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground antialiased;
  }
}

/* Toast Customization */
[data-sonner-toast] {
  @apply rounded-2xl shadow-lg border-0;
}

[data-sonner-toast] [data-description] {
  color: #525252 !important;
  opacity: 1;
}

[data-sonner-toast][data-type="success"] {
  @apply bg-emerald-50 text-emerald-900;
}

[data-sonner-toast][data-type="error"] {
  @apply bg-red-50 text-red-900;
}

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

::-webkit-scrollbar-track {
  @apply bg-transparent;
}

::-webkit-scrollbar-thumb {
  @apply bg-gray-300 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
  @apply bg-gray-400;
}

.dark ::-webkit-scrollbar-thumb {
  @apply bg-gray-700;
}

.dark ::-webkit-scrollbar-thumb:hover {
  @apply bg-gray-600;
}

@layer utilities {
  .text-fg {
    color: var(--fg);
  }
  .bg-bg {
    background-color: var(--bg);
  }

  /* Custom Gradient Utilities */
  .gradient-primary {
    background: linear-gradient(135deg, #0a0a0a 0%, #262626 100%);
  }

  .gradient-card {
    background: linear-gradient(145deg, #fafafa 0%, #f5f5f5 100%);
  }

  /* Animation Utilities */
  .animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
  }

  .animate-scale-up {
    animation: scaleUp 0.2s ease-in-out;
  }

  .animate-slide-up {
    animation: slideUp 0.3s ease-out;
  }

  /* Shopping Cart Animations */
  .stroke-primary {
    stroke: #0a0a0a;
  }

  .stroke-track {
    stroke: rgba(10, 10, 10, 0.1);
    transition: stroke 0.3s ease;
  }

  @media (prefers-color-scheme: dark) {
    .stroke-track {
      stroke: rgba(250, 250, 250, 0.1);
    }
  }

  .animate-msg {
    animation: msg 0.3s 13.7s linear forwards;
  }

  .animate-msgLast {
    animation: msg 0.3s 14s linear reverse forwards;
  }

  .animate-cartLines {
    animation: cartLines 2s ease-in-out infinite;
  }

  .animate-cartTop {
    animation: cartTop 2s ease-in-out infinite;
  }

  .animate-cartWheel1 {
    animation: cartWheel1 2s ease-in-out infinite;
    transform: rotate(-0.25turn);
    transform-origin: 43px 111px;
  }

  .animate-cartWheel2 {
    animation: cartWheel2 2s ease-in-out infinite;
    transform: rotate(0.25turn);
    transform-origin: 102px 111px;
  }

  .animate-cartWheelStroke {
    animation: cartWheelStroke 2s ease-in-out infinite;
  }
}

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

@keyframes scaleUp {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

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

@keyframes msg {
  from {
    opacity: 1;
    visibility: visible;
  }
  99.9% {
    opacity: 0;
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes cartLines {
  from,
  to {
    opacity: 0;
  }
  8%,
  92% {
    opacity: 1;
  }
}

@keyframes cartTop {
  from {
    stroke-dashoffset: -338;
  }
  50% {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 338;
  }
}

@keyframes cartWheel1 {
  from {
    transform: rotate(-0.25turn);
  }
  to {
    transform: rotate(2.75turn);
  }
}

@keyframes cartWheel2 {
  from {
    transform: rotate(0.25turn);
  }
  to {
    transform: rotate(3.25turn);
  }
}

@keyframes cartWheelStroke {
  from,
  to {
    stroke-dashoffset: 81.68;
  }
  50% {
    stroke-dashoffset: 40.84;
  }
}

/* Focus Visible Improvements */
*:focus-visible {
  @apply outline-2 outline-offset-2 outline-gray-900;
}

.dark *:focus-visible {
  @apply outline-gray-100;
}

/* Selection Styling */
::selection {
  @apply bg-gray-900 text-white;
}

.dark ::selection {
  @apply bg-gray-100 text-gray-900;
}
