import type { Config } from "tailwindcss";

export default {
  darkMode: ["class"],
  content: ["./client/index.html", "./client/src/**/*.{js,jsx,ts,tsx}"],
  theme: {
    extend: {
      borderRadius: {
        lg: "var(--radius)",
        md: "calc(var(--radius) - 2px)",
        sm: "calc(var(--radius) - 4px)",
      },
      colors: {
        background: "var(--background)",
        foreground: "var(--foreground)",
        card: {
          DEFAULT: "var(--card)",
          foreground: "var(--card-foreground)",
        },
        popover: {
          DEFAULT: "var(--popover)",
          foreground: "var(--popover-foreground)",
        },
        primary: {
          DEFAULT: "var(--primary)",
          foreground: "var(--primary-foreground)",
        },
        secondary: {
          DEFAULT: "var(--secondary)",
          foreground: "var(--secondary-foreground)",
        },
        muted: {
          DEFAULT: "var(--muted)",
          foreground: "var(--muted-foreground)",
        },
        accent: {
          DEFAULT: "var(--accent)",
          foreground: "var(--accent-foreground)",
        },
        destructive: {
          DEFAULT: "var(--destructive)",
          foreground: "var(--destructive-foreground)",
        },
        border: "var(--border)",
        input: "var(--input)",
        ring: "var(--ring)",
        chart: {
          "1": "var(--chart-1)",
          "2": "var(--chart-2)",
          "3": "var(--chart-3)",
          "4": "var(--chart-4)",
          "5": "var(--chart-5)",
        },
        sidebar: {
          DEFAULT: "var(--sidebar-background)",
          foreground: "var(--sidebar-foreground)",
          primary: "var(--sidebar-primary)",
          "primary-foreground": "var(--sidebar-primary-foreground)",
          accent: "var(--sidebar-accent)",
          "accent-foreground": "var(--sidebar-accent-foreground)",
          border: "var(--sidebar-border)",
          ring: "var(--sidebar-ring)",
        },
        // Medical-specific color extensions
        medical: {
          emergency: "hsl(0, 84%, 60%)",
          success: "hsl(120, 70%, 50%)",
          warning: "hsl(45, 90%, 60%)",
          info: "hsl(213, 94%, 68%)",
          gray: "hsl(210, 40%, 94%)",
        },
        // Status-specific colors for medical orders
        status: {
          created: "hsl(213, 94%, 68%)",
          confirmed: "hsl(120, 70%, 50%)",
          assigned: "hsl(280, 70%, 60%)",
          "picked-up": "hsl(45, 90%, 60%)",
          delivered: "hsl(159, 78%, 42%)",
          closed: "hsl(210, 40%, 50%)",
        },
      },
      fontFamily: {
        sans: ["var(--font-sans)"],
        serif: ["var(--font-serif)"],
        mono: ["var(--font-mono)"],
      },
      keyframes: {
        "accordion-down": {
          from: {
            height: "0",
          },
          to: {
            height: "var(--radix-accordion-content-height)",
          },
        },
        "accordion-up": {
          from: {
            height: "var(--radix-accordion-content-height)",
          },
          to: {
            height: "0",
          },
        },
        // Medical-specific animations
        "medical-pulse": {
          "0%, 100%": {
            opacity: "1",
          },
          "50%": {
            opacity: "0.5",
          },
        },
        "emergency-flash": {
          "0%, 50%, 100%": {
            backgroundColor: "hsl(0, 84%, 60%)",
          },
          "25%, 75%": {
            backgroundColor: "hsl(0, 84%, 70%)",
          },
        },
        "heartbeat": {
          "0%": {
            transform: "scale(1)",
          },
          "14%": {
            transform: "scale(1.1)",
          },
          "28%": {
            transform: "scale(1)",
          },
          "42%": {
            transform: "scale(1.1)",
          },
          "70%": {
            transform: "scale(1)",
          },
        },
      },
      animation: {
        "accordion-down": "accordion-down 0.2s ease-out",
        "accordion-up": "accordion-up 0.2s ease-out",
        "medical-pulse": "medical-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
        "emergency-flash": "emergency-flash 1s ease-in-out infinite",
        "heartbeat": "heartbeat 1.5s ease-in-out infinite",
      },
      // Medical-specific spacing
      spacing: {
        "medical-xs": "0.125rem",
        "medical-sm": "0.375rem",
        "medical-md": "0.75rem",
        "medical-lg": "1.25rem",
        "medical-xl": "2rem",
      },
      // Medical-specific shadows
      boxShadow: {
        "medical-sm": "var(--shadow-sm)",
        "medical": "var(--shadow)",
        "medical-md": "var(--shadow-md)",
        "medical-lg": "var(--shadow-lg)",
        "medical-xl": "var(--shadow-xl)",
        "medical-2xl": "var(--shadow-2xl)",
        "emergency": "0 0 0 3px hsl(0, 84%, 60%, 0.5)",
      },
      // Medical-specific typography
      fontSize: {
        "medical-xs": ["0.75rem", { lineHeight: "1rem" }],
        "medical-sm": ["0.875rem", { lineHeight: "1.25rem" }],
        "medical-base": ["1rem", { lineHeight: "1.5rem" }],
        "medical-lg": ["1.125rem", { lineHeight: "1.75rem" }],
        "medical-xl": ["1.25rem", { lineHeight: "1.75rem" }],
      },
      // Medical-specific breakpoints
      screens: {
        "medical-tablet": "768px",
        "medical-desktop": "1024px",
        "medical-wide": "1280px",
      },
    },
  },
  plugins: [
    require("tailwindcss-animate"), 
    require("@tailwindcss/typography"),
    // Medical-specific plugin
    function({ addUtilities, theme }: { addUtilities: Function; theme: Function }) {
      const medicalUtilities = {
        '.medical-gradient-primary': {
          background: `linear-gradient(135deg, ${theme('colors.primary.DEFAULT')} 0%, hsl(213, 94%, 58%) 100%)`,
        },
        '.medical-gradient-emergency': {
          background: 'linear-gradient(135deg, hsl(0, 84%, 60%) 0%, hsl(0, 84%, 50%) 100%)',
        },
        '.medical-gradient-success': {
          background: 'linear-gradient(135deg, hsl(120, 70%, 50%) 0%, hsl(120, 70%, 40%) 100%)',
        },
        '.medical-text-shadow': {
          textShadow: '0 1px 2px rgba(0, 0, 0, 0.1)',
        },
        '.medical-backdrop-blur': {
          backdropFilter: 'blur(10px)',
          backgroundColor: 'rgba(255, 255, 255, 0.8)',
        },
        '.dark .medical-backdrop-blur': {
          backgroundColor: 'rgba(0, 0, 0, 0.8)',
        },
      };
      addUtilities(medicalUtilities);
    },
  ],
} satisfies Config;
