@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  /* ===== LIGHT MODE (Default) ===== */
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;

    /* Additional semantic tokens */
    --success: 142 76% 36%;
    --success-foreground: 0 0% 100%;
    --warning: 38 92% 50%;
    --warning-foreground: 0 0% 0%;
    --info: 199 89% 48%;
    --info-foreground: 0 0% 100%;

    /* Surface variants for depth */
    --surface-1: 0 0% 100%;
    --surface-2: 210 40% 98%;
    --surface-3: 210 40% 96%;
  }

  /* ===== DARK MODE ===== */
  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 47% 11%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 47% 11%;
    --popover-foreground: 210 40% 98%;
    --primary: 217.2 91.2% 59.8%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 50%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 20%;
    --input: 217.2 32.6% 20%;
    --ring: 224.3 76.3% 48%;

    --success: 142 71% 45%;
    --success-foreground: 0 0% 100%;
    --warning: 38 92% 50%;
    --warning-foreground: 0 0% 0%;
    --info: 199 89% 48%;
    --info-foreground: 0 0% 100%;

    --surface-1: 222.2 47% 11%;
    --surface-2: 222.2 47% 13%;
    --surface-3: 222.2 47% 15%;
  }

  /* ===== COLOR SCHEMES ===== */
  /* Blue Theme (Default - no override needed for :root) */

  /* Purple Theme */
  [data-theme="purple"] {
    --primary: 262.1 83.3% 57.8%;
    --ring: 262.1 83.3% 57.8%;
  }
  .dark[data-theme="purple"] {
    --primary: 263.4 70% 60%;
    --ring: 263.4 70% 60%;
  }

  /* Green Theme */
  [data-theme="green"] {
    --primary: 142.1 70.6% 45.3%;
    --ring: 142.1 70.6% 45.3%;
  }
  .dark[data-theme="green"] {
    --primary: 142.1 76.2% 50%;
    --ring: 142.1 76.2% 50%;
  }

  /* Orange Theme */
  [data-theme="orange"] {
    --primary: 24.6 95% 53.1%;
    --ring: 24.6 95% 53.1%;
  }
  .dark[data-theme="orange"] {
    --primary: 20.5 90.2% 55%;
    --ring: 20.5 90.2% 55%;
  }
}

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

/* ===== THEME TRANSITIONS ===== */
@layer utilities {
  .theme-transition {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 200ms;
    transition-timing-function: ease-out;
  }

  .theme-transition * {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 200ms;
    transition-timing-function: ease-out;
  }
}

/* ===== CUSTOM SHADOWS ===== */
@layer utilities {
  .shadow-soft {
    box-shadow:
      0 1px 3px 0 rgb(0 0 0 / 0.05),
      0 1px 2px -1px rgb(0 0 0 / 0.05);
  }

  .shadow-medium {
    box-shadow:
      0 4px 6px -1px rgb(0 0 0 / 0.07),
      0 2px 4px -2px rgb(0 0 0 / 0.07);
  }

  .shadow-elevated {
    box-shadow:
      0 10px 15px -3px rgb(0 0 0 / 0.08),
      0 4px 6px -4px rgb(0 0 0 / 0.08);
  }

  .dark .shadow-soft {
    box-shadow:
      0 1px 3px 0 rgb(0 0 0 / 0.3),
      0 1px 2px -1px rgb(0 0 0 / 0.3),
      0 0 0 1px rgb(255 255 255 / 0.03);
  }

  .dark .shadow-medium {
    box-shadow:
      0 4px 6px -1px rgb(0 0 0 / 0.4),
      0 2px 4px -2px rgb(0 0 0 / 0.4),
      0 0 0 1px rgb(255 255 255 / 0.03);
  }

  .dark .shadow-elevated {
    box-shadow:
      0 10px 15px -3px rgb(0 0 0 / 0.5),
      0 4px 6px -4px rgb(0 0 0 / 0.5),
      0 0 0 1px rgb(255 255 255 / 0.05);
  }
}

/* ===== GRADIENT UTILITIES ===== */
@layer utilities {
  .gradient-primary {
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary) / 0.8) 100%);
  }

  .gradient-subtle {
    background: linear-gradient(180deg, hsl(var(--background)) 0%, hsl(var(--muted) / 0.5) 100%);
  }

  .gradient-card {
    background: linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--card) / 0.95) 100%);
  }
}

/* ===== FOCUS RING UTILITIES ===== */
@layer utilities {
  .focus-ring {
    @apply focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background;
  }
}

/* ===== SCROLLBAR STYLING ===== */
@layer utilities {
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted-foreground) / 0.3) transparent;
  }

  .scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  .scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: hsl(var(--muted-foreground) / 0.3);
    border-radius: 3px;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background-color: hsl(var(--muted-foreground) / 0.5);
  }

  /* Hide scrollbar completely while still allowing scroll */
  .scrollbar-hide {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
  }
}
