// Background Mixins for ui-backgrounds library

// Base background mixin
@mixin ui-background-base() {
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

// Full screen background mixin
@mixin ui-background-fullscreen($z-index: -1) {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: $z-index;
}

// Solid color background
@mixin ui-background-solid($color) {
  background-color: $color;
  background-image: none;
}

// Linear gradient background
@mixin ui-background-linear-gradient($direction: 'to bottom', $colors...) {
  background: linear-gradient(#{$direction}, $colors);
}

// Radial gradient background
@mixin ui-background-radial-gradient($shape: 'ellipse', $size: 'farthest-corner', $position: 'center', $colors...) {
  background: radial-gradient(#{$shape} #{$size} at #{$position}, $colors);
}

// Conic gradient background
@mixin ui-background-conic-gradient($angle: 0deg, $position: 'center', $colors...) {
  background: conic-gradient(from #{$angle} at #{$position}, $colors);
}

// Pattern backgrounds
@mixin ui-pattern-dots($primary: #000, $secondary: transparent, $size: 20px) {
  background-image: radial-gradient(circle, #{$primary} 20%, #{$secondary} 20%);
  background-size: $size $size;
  background-repeat: repeat;
}

@mixin ui-pattern-grid($color: #000, $size: 20px, $line-width: 1px) {
  background-image: 
    linear-gradient(#{$color} #{$line-width}, transparent #{$line-width}),
    linear-gradient(90deg, #{$color} #{$line-width}, transparent #{$line-width});
  background-size: $size $size;
  background-repeat: repeat;
}

@mixin ui-pattern-stripes($primary: #000, $secondary: transparent, $size: 20px) {
  background-image: linear-gradient(45deg, #{$primary} 25%, #{$secondary} 25%, #{$secondary} 50%, #{$primary} 50%, #{$primary} 75%, #{$secondary} 75%);
  background-size: $size $size;
  background-repeat: repeat;
}

@mixin ui-pattern-diagonal-stripes($primary: #000, $secondary: transparent, $size: 20px) {
  background-image: linear-gradient(-45deg, #{$primary} 25%, #{$secondary} 25%, #{$secondary} 50%, #{$primary} 50%, #{$primary} 75%, #{$secondary} 75%);
  background-size: $size $size;
  background-repeat: repeat;
}

@mixin ui-pattern-chevron($primary: #000, $secondary: transparent, $size: 20px) {
  background-image: 
    linear-gradient(45deg, #{$primary} 25%, #{$secondary} 25%),
    linear-gradient(-45deg, #{$primary} 25%, #{$secondary} 25%);
  background-size: $size $size;
  background-repeat: repeat;
  background-position: 0 0, 0 ($size / 2);
}

@mixin ui-pattern-waves($primary: #000, $secondary: transparent, $size: 40px) {
  background-image: radial-gradient(circle at 50% 100%, #{$secondary} 40%, #{$primary} 40%, #{$primary} 60%, #{$secondary} 60%);
  background-size: $size ($size / 2);
  background-repeat: repeat-x;
}

@mixin ui-pattern-checkerboard($primary: #000, $secondary: #fff, $size: 20px) {
  background-image: 
    linear-gradient(45deg, #{$primary} 25%, transparent 25%, transparent 75%, #{$primary} 75%),
    linear-gradient(45deg, #{$primary} 25%, transparent 25%, transparent 75%, #{$primary} 75%);
  background-color: $secondary;
  background-size: $size $size;
  background-position: 0 0, ($size / 2) ($size / 2);
  background-repeat: repeat;
}

// Animated backgrounds
@mixin ui-background-animated($duration: 5s, $timing: ease-in-out, $iteration: infinite) {
  animation: ui-background-animation $duration $timing $iteration;
}

@mixin ui-background-mesh-animated($duration: 15s) {
  background-size: 400% 400%;
  animation: ui-mesh-animation $duration ease infinite;
}

// Glass/blur backgrounds
@mixin ui-background-glass($blur: 10px, $tint: rgba(255, 255, 255, 0.1), $opacity: 0.8) {
  background: $tint;
  backdrop-filter: blur($blur);
  opacity: $opacity;
}

// Responsive background utilities
@mixin ui-background-responsive($mobile-bg, $tablet-bg: null, $desktop-bg: null) {
  background: $mobile-bg;
  
  @if $tablet-bg {
    @media (min-width: 768px) {
      background: $tablet-bg;
    }
  }
  
  @if $desktop-bg {
    @media (min-width: 1024px) {
      background: $desktop-bg;
    }
  }
}

// Accessibility utilities
@mixin ui-background-high-contrast() {
  @media (prefers-contrast: high) {
    filter: contrast(1.5);
  }
}

@mixin ui-background-reduced-motion() {
  @media (prefers-reduced-motion: reduce) {
    animation: none !important;
  }
}