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

:root {
  --font-size: 16px;
  --background: #ffffff;
  --foreground: oklch(0.145 0 0);
  --card: #ffffff;
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: #00A63E;
  --primary-foreground: #ffffff;
  --secondary: oklch(0.95 0.0058 264.53);
  --secondary-foreground: #00A63E;
  --muted: #ececf0;
  --muted-foreground: #717182;
  --accent: #e9ebef;
  --accent-foreground: #00A63E;
  --destructive: #d4183d;
  --destructive-foreground: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --input: transparent;
  --input-background: #f3f3f5;
  --switch-background: #cbced4;
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --radius: 0.625rem;
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: #00A63E;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
  
  /* Semantic status colors - Light mode */
  --success: #00A63E;
  --success-foreground: #ffffff;
  --success-muted: #dcfce7;
  --success-muted-foreground: #166534;
  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --warning-muted: #fef3c7;
  --warning-muted-foreground: #92400e;
  --info: #3b82f6;
  --info-foreground: #ffffff;
  --info-muted: #dbeafe;
  --info-muted-foreground: #1e40af;
  --error: #ef4444;
  --error-foreground: #ffffff;
  --error-muted: #fee2e2;
  --error-muted-foreground: #991b1b;
}

.dark {
  --background: #0f1419;
  --foreground: #e7e9ea;
  --card: #1a1f26;
  --card-foreground: #e7e9ea;
  --popover: #1a1f26;
  --popover-foreground: #e7e9ea;
  --primary: #00A63E;
  --primary-foreground: #ffffff;
  --secondary: #374151;
  --secondary-foreground: #e7e9ea;
  --muted: #374151;
  --muted-foreground: #9ca3af;
  --accent: #1f2937;
  --accent-foreground: #e7e9ea;
  --destructive: #ef4444;
  --destructive-foreground: #fecaca;
  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(255, 255, 255, 0.05);
  --input-background: #1f2937;
  --switch-background: #4b5563;
  --ring: rgba(0, 166, 62, 0.5);
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --chart-1: #00A63E;
  --chart-2: #3b82f6;
  --chart-3: #f59e0b;
  --chart-4: #8b5cf6;
  --chart-5: #ec4899;
  --sidebar: #1a1f26;
  --sidebar-foreground: #e7e9ea;
  --sidebar-primary: #00A63E;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #1f2937;
  --sidebar-accent-foreground: #e7e9ea;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-ring: rgba(0, 166, 62, 0.5);
  
  /* Semantic status colors - Dark mode */
  --success: #00A63E;
  --success-foreground: #ffffff;
  --success-muted: rgba(0, 166, 62, 0.15);
  --success-muted-foreground: #4ade80;
  --warning: #f59e0b;
  --warning-foreground: #0f1419;
  --warning-muted: rgba(245, 158, 11, 0.15);
  --warning-muted-foreground: #fbbf24;
  --info: #3b82f6;
  --info-foreground: #ffffff;
  --info-muted: rgba(59, 130, 246, 0.15);
  --info-muted-foreground: #60a5fa;
  --error: #ef4444;
  --error-foreground: #ffffff;
  --error-muted: rgba(239, 68, 68, 0.15);
  --error-muted-foreground: #f87171;
  
  color-scheme: dark;
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-input-background: var(--input-background);
  --color-switch-background: var(--switch-background);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
  
  /* Semantic status colors */
  --color-success: var(--success);
  --color-success-foreground: var(--success-foreground);
  --color-success-muted: var(--success-muted);
  --color-success-muted-foreground: var(--success-muted-foreground);
  --color-warning: var(--warning);
  --color-warning-foreground: var(--warning-foreground);
  --color-warning-muted: var(--warning-muted);
  --color-warning-muted-foreground: var(--warning-muted-foreground);
  --color-info: var(--info);
  --color-info-foreground: var(--info-foreground);
  --color-info-muted: var(--info-muted);
  --color-info-muted-foreground: var(--info-muted-foreground);
  --color-error: var(--error);
  --color-error-foreground: var(--error-foreground);
  --color-error-muted: var(--error-muted);
  --color-error-muted-foreground: var(--error-muted-foreground);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  body {
    @apply bg-background text-foreground;
  }
}

/**
 * Base typography. This is not applied to elements which have an ancestor with a Tailwind text class.
 */
@layer base {
  :where(:not(:has([class*=" text-"]), :not(:has([class^="text-"])))) {
    h1 {
      font-size: var(--text-2xl);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    h2 {
      font-size: var(--text-xl);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    h3 {
      font-size: var(--text-lg);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    h4 {
      font-size: var(--text-base);
      font-weight: 600;
      line-height: 1.5;
      color: var(--foreground);
    }

    p {
      font-size: var(--text-base);
      font-weight: var(--font-weight-normal);
      line-height: 1.5;
    }

    label {
      font-size: var(--text-sm);
      font-weight: 600;
      line-height: 1.5;
      color: var(--muted-foreground);
      text-transform: uppercase;
      letter-spacing: 0.025em;
    }

    button {
      font-size: var(--text-base);
      font-weight: var(--font-weight-medium);
      line-height: 1.5;
    }

    input {
      font-size: var(--text-base);
      font-weight: var(--font-weight-normal);
      line-height: 1.5;
    }
  }
}

html {
  font-size: var(--font-size);
}

/* Field value styling for forms and detail views */
@layer components {
  .field-value {
    @apply mt-2 text-base text-foreground px-3 py-2 bg-muted rounded-md min-h-[2.5rem] flex items-center transition-colors;
  }
  
  .field-value-inline {
    @apply mt-2 text-base text-foreground;
  }
}

/* Water wave animation for fertilizer tank - Enhanced sloshing effect */
@keyframes wave-flow {
  0% {
    transform: translateX(0) translateZ(0) scaleY(1) rotate(0deg);
  }
  25% {
    transform: translateX(-15%) translateZ(0) scaleY(0.92) rotate(-1deg);
  }
  50% {
    transform: translateX(-25%) translateZ(0) scaleY(0.88) rotate(0deg);
  }
  75% {
    transform: translateX(-40%) translateZ(0) scaleY(0.93) rotate(1deg);
  }
  100% {
    transform: translateX(-50%) translateZ(0) scaleY(1) rotate(0deg);
  }
}

@keyframes wave-flow-reverse {
  0% {
    transform: translateX(0) translateZ(0) scaleY(1) rotate(0deg);
  }
  25% {
    transform: translateX(15%) translateZ(0) scaleY(0.93) rotate(1deg);
  }
  50% {
    transform: translateX(25%) translateZ(0) scaleY(0.85) rotate(0deg);
  }
  75% {
    transform: translateX(40%) translateZ(0) scaleY(0.91) rotate(-1deg);
  }
  100% {
    transform: translateX(50%) translateZ(0) scaleY(1) rotate(0deg);
  }
}

@keyframes wave-sloshing {
  0% {
    transform: translateX(0) translateY(0) scaleX(1);
  }
  25% {
    transform: translateX(-3%) translateY(-2%) scaleX(1.02);
  }
  50% {
    transform: translateX(0) translateY(0) scaleX(1);
  }
  75% {
    transform: translateX(3%) translateY(-2%) scaleX(0.98);
  }
  100% {
    transform: translateX(0) translateY(0) scaleX(1);
  }
}

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

.water-wave {
  position: relative;
  overflow: hidden;
  animation: wave-sloshing 2s ease-in-out infinite;
}

.water-wave::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: wave-flow 2.5s ease-in-out infinite;
  will-change: transform;
}

.water-wave::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  animation: wave-flow-reverse 2s ease-in-out infinite;
  animation-delay: 0.3s;
  will-change: transform;
}

.water-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

.water-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  animation: ripple 2s ease-out infinite;
}

@keyframes ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 100px;
    height: 100px;
    opacity: 0;
  }
}

/* Auth page background animations */
@keyframes blob {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
  100% {
    transform: translate(0px, 0px) scale(1);
  }
}

.animate-blob {
  animation: blob 7s infinite;
}

.animation-delay-2000 {
  animation-delay: 2s;
}

.animation-delay-4000 {
  animation-delay: 4s;
}

/* Grid pattern background */
.bg-grid-pattern {
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 40px 40px;
}
