/** @format */

// Define variables
$spacing-values: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
  34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72,
  74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100;

$direction-map: (
  t: top,
  r: right,
  b: bottom,
  l: left,
);

$property-map: (
  mg: margin,
  pd: padding,
);

// Mixin to generate spacing utilities
@mixin generate-spacing-utilities($property, $prefix) {
  // Global classes (e.g., .mg-10)
  @each $value in $spacing-values {
    .#{$prefix}-#{$value} {
      #{$property}: #{$value}px !important;
    }
  }

  // Directional classes (e.g., .mgt-10)
  @each $dir-abbr, $dir-full in $direction-map {
    @each $value in $spacing-values {
      .#{$prefix}#{$dir-abbr}-#{$value} {
        #{$property}-#{$dir-full}: #{$value}px !important;
      }
    }
  }
}

// Generate classes for each property
@each $prefix, $property in $property-map {
  @include generate-spacing-utilities($property, $prefix);
}

// 字号 12到72
@mixin font-size($min, $max) {
  @for $i from $min through $max {
    .fs-#{$i} {
      font-size: #{$i}px !important;
    }
  }
}

// 字号
@include font-size(12, 72);

// 字重 400到900
@mixin font-weight($min, $max) {
  @for $i from $min through $max {
    .fw-#{$i} {
      font-weight: $i;
    }
  }
}

@include font-weight(400, 900);

// 颜色
// 例如 .c-333 { color: #333; } .c-255 { color: #255; }
@mixin color($min, $max) {
  @for $i from $min through $max {
    .c-#{$i} {
      color: #{'#' + $i} !important;
    }
  }
}
@include color(0, 999);

@mixin bg-color($min, $max) {
  @for $i from $min through $max {
    .bg-#{$i} {
      background-color: #{'#' + $i} !important;
    }
  }
}

@include bg-color(0, 999);

/* Flex布局 */
.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.column {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-nowrap {
  flex-wrap: nowrap;
}

.flex-1 {
  flex: 1;
}

.flex1 {
  flex: 1;
}

.flex1 {
  flex: 1;
}

.flex-2 {
  flex: 2;
}

.flex-3 {
  flex: 3;
}

/* 主轴对齐方式 */
.just-start {
  justify-content: flex-start;
}

.just-end {
  justify-content: flex-end;
}

.just-center {
  justify-content: center;
}

.space-between {
  justify-content: space-between;
}
.just-between {
  justify-content: space-between;
}

.just-around {
  justify-content: space-around;
}

.just-evenly {
  justify-content: space-evenly;
}

/* 交叉轴对齐方式 */
.align-start {
  align-items: flex-start;
}

.align-end {
  align-items: flex-end;
}

.align-center {
  align-items: center;
}

.align-stretch {
  align-items: stretch;
}

.align-baseline {
  align-items: baseline;
}

/* 常用组合 */
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between-center {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-around-center {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

/* 文本对齐 */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* 文本溢出处理 */
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 遮罩效果 */
.mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mask-light {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.mask-white {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 999;
}

/* 常用动画效果 */
/* 淡入淡出 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out forwards;
}

.fade-out {
  animation: fadeOut 0.3s ease-in-out forwards;
}

/* 缩放 */
@keyframes zoomIn {
  from {
    transform: scale(0.5);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes zoomOut {
  from {
    transform: scale(1);
    opacity: 1;
  }

  to {
    transform: scale(0.5);
    opacity: 0;
  }
}

.zoom-in {
  animation: zoomIn 0.3s ease-in-out forwards;
}

.zoom-out {
  animation: zoomOut 0.3s ease-in-out forwards;
}

/* 滑动 */
@keyframes slideInFromTop {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

.slide-in-top {
  animation: slideInFromTop 0.3s ease-in-out forwards;
}

.slide-in-bottom {
  animation: slideInFromBottom 0.3s ease-in-out forwards;
}

.slide-in-left {
  animation: slideInFromLeft 0.3s ease-in-out forwards;
}

.slide-in-right {
  animation: slideInFromRight 0.3s ease-in-out forwards;
}

/* 旋转 */
@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.rotate {
  animation: rotate360 1s linear infinite;
}

/* 脉冲效果 */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* 阴影效果 */
.shadow-sm {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shadow-md {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.shadow-xl {
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

/* 圆角 */
.rounded-sm {
  border-radius: 2px;
}

.rounded {
  border-radius: 4px;
}

.rounded-md {
  border-radius: 6px;
}

.rounded-lg {
  border-radius: 8px;
}

.rounded-xl {
  border-radius: 12px;
}

.rounded-full {
  border-radius: 9999px;
}

/* 过渡效果 */
.transition {
  transition: all 0.3s ease;
}

.transition-fast {
  transition: all 0.15s ease;
}

.transition-slow {
  transition: all 0.5s ease;
}

/* 鼠标指针 */
.cursor-pointer {
  cursor: pointer;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

/* 位置 */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

/* 显示与隐藏 */
.hidden {
  display: none;
}

.visible {
  visibility: visible;
}

.invisible {
  visibility: hidden;
}

/* 透明度 */
.opacity-0 {
  opacity: 0;
}

.opacity-25 {
  opacity: 0.25;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-75 {
  opacity: 0.75;
}

.opacity-100 {
  opacity: 1;
}



.cursor{
  cursor: pointer;
}