// ========================================== // 统一 SCSS Mixins // ========================================== // ---- 卡片 ---- @mixin card-base { background: $bg-card-glass; border-radius: $radius-xl; padding: $spacing-lg; border: 1.5rpx solid $border-card; box-shadow: $shadow-card; } @mixin card-solid { background: $bg-card; border-radius: $radius-2xl; padding: $spacing-xl; box-shadow: $shadow-sm; } @mixin card-glass { background: $bg-card-glass; border-radius: $radius-xl; padding: $spacing-lg; border: 1.5rpx solid $border-card; box-shadow: $shadow-card; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); } @mixin card-elevated { @include card-base; box-shadow: $shadow-md; border-color: $border-light; } @mixin card-subtle { background: $gradient-card-subtle; border-radius: $radius-md; padding: $spacing-lg; border: 1rpx solid $border-light; box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, 0.9); } // ---- 按钮 ---- @mixin btn-base { display: flex; align-items: center; justify-content: center; border-radius: $radius-full; font-weight: $font-weight-bold; transition: all $transition-fast; } @mixin btn-primary { @include btn-base; height: 96rpx; background: $gradient-primary; color: $text-inverse; font-size: $font-lg; box-shadow: $shadow-btn; } @mixin btn-secondary { @include btn-base; height: 96rpx; background: $bg-card; color: $text-primary; font-size: $font-lg; border: 2rpx solid $border-light; box-shadow: $shadow-sm; } @mixin btn-outline { @include btn-base; height: 96rpx; background: transparent; color: $color-primary-dark; font-size: $font-lg; border: 2rpx solid rgba($color-primary, 0.32); } @mixin btn-pill { @include btn-base; padding: $spacing-xs $spacing-lg; font-size: $font-sm; font-weight: $font-weight-semibold; } // ---- 标签/徽章 ---- @mixin chip { display: inline-flex; align-items: center; justify-content: center; padding: $spacing-xs $spacing-md; border-radius: $radius-full; font-size: $font-sm; font-weight: $font-weight-semibold; } @mixin chip-primary { @include chip; background: $color-primary-bg; color: $color-primary-dark; border: 1rpx solid $color-primary-border; } @mixin chip-muted { @include chip; background: $bg-muted; color: $text-muted; } @mixin badge { @include chip; font-size: $font-xs; padding: 6rpx 14rpx; background: $color-primary-bg; color: $color-primary-dark; } // ---- 进度条 ---- @mixin progress-bar($height: 10rpx) { height: $height; background: rgba($color-primary, 0.1); border-radius: $radius-full; overflow: hidden; } @mixin progress-fill { height: 100%; border-radius: $radius-full; background: linear-gradient(90deg, $color-primary, $color-primary-light); transition: width $transition-slow; } // ---- 圆环 ---- @mixin ring($size: 110rpx) { width: $size; height: $size; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; } @mixin ring-inner { border-radius: 50%; background: $bg-card; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 4rpx 12rpx $color-primary-shadow; } // ---- 布局 ---- @mixin flex-center { display: flex; align-items: center; justify-content: center; } @mixin flex-between { display: flex; align-items: center; justify-content: space-between; } @mixin flex-col { display: flex; flex-direction: column; } // ---- 文字 ---- @mixin text-number { font-family: $font-family-number; font-weight: $font-weight-heavy; } @mixin text-heading { font-weight: $font-weight-bold; color: $text-primary; } @mixin text-label { font-size: $font-sm; color: $text-tertiary; } @mixin text-kicker { font-size: $font-xs; font-weight: $font-weight-semibold; color: $text-muted; } // ---- 动画骨架 ---- @mixin skeleton-shimmer { background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; } // ---- 安全区域 ---- @mixin safe-area-bottom { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); } // ---- 悬浮按钮 ---- @mixin fab { position: fixed; z-index: 100; border-radius: $radius-full; background: $gradient-primary; box-shadow: $shadow-fab; display: flex; align-items: center; justify-content: center; animation: fabFloat 3.6s ease-in-out infinite; } // ---- 空状态 ---- @mixin empty-state { @include flex-col; align-items: center; padding: 80rpx $spacing-xl; border-radius: $radius-2xl; background: $gradient-card; box-shadow: $shadow-md; } // ---- 菜单项 ---- @mixin menu-item { display: flex; align-items: center; gap: $spacing-lg; padding: $spacing-lg 0; background: transparent; } @mixin menu-icon($bg: $color-primary-soft) { width: 72rpx; height: 72rpx; border-radius: 50%; @include flex-center; flex-shrink: 0; background: $bg; }