/* ============================================
   深挖乡村 · 统一设计增强 v3.0
   2026-07-04 UI Upgrade
   ============================================ */

/* ===== 全局动画 ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Glass效果 ===== */
.glass-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.glass-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.glass-dark {
  background: rgba(26, 26, 46, 0.75);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== 统一过渡效果 ===== */
.swxc-fade-in {
  animation: fadeInUp 0.4s ease both;
}
.swxc-fade-in-delay-1 {
  animation: fadeInUp 0.4s ease 0.1s both;
}
.swxc-fade-in-delay-2 {
  animation: fadeInUp 0.4s ease 0.2s both;
}
.swxc-slide-in {
  animation: slideInRight 0.35s ease both;
}
.swxc-scale-in {
  animation: scaleIn 0.3s ease both;
}
.swxc-bounce-in {
  animation: bounceIn 0.5s ease both;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:active {
  background: rgba(0, 0, 0, 0.3);
}

/* ===== 安全区域 ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
  .safe-top { padding-top: env(safe-area-inset-top); }
}

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 24px; margin-bottom: 12px; width: 60%; }
.skeleton-img { aspect-ratio: 1; border-radius: 12px; }

/* ===== 涟漪按压效果 ===== */
.swxc-ripple {
  position: relative;
  overflow: hidden;
}
.swxc-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}
.swxc-ripple:active::after {
  width: 200%;
  height: 200%;
  opacity: 1;
  transition: width 0s, height 0s, opacity 0s;
}

/* ===== 卡片微动效 ===== */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-hover:active {
  transform: scale(0.97) translateY(2px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ===== 顶部导航栏 ===== */
.swxc-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* ===== Toast增强 ===== */
.swxc-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 99999;
  max-width: 80vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.swxc-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.swxc-toast-success {
  background: rgba(7, 193, 96, 0.95);
  color: #fff;
}
.swxc-toast-error {
  background: rgba(231, 76, 60, 0.95);
  color: #fff;
}
.swxc-toast-info {
  background: rgba(42, 157, 143, 0.95);
  color: #fff;
}

/* ===== 价格标签 ===== */
.swxc-price {
  font-weight: 800;
  letter-spacing: -0.5px;
}
.swxc-price-symbol {
  font-size: 0.65em;
  font-weight: 600;
}
.swxc-price-old {
  font-size: 0.7em;
  color: #999;
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 4px;
}

/* ===== 状态徽章 ===== */
.swxc-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1.4;
}
.swxc-badge-green {
  background: #E8F8F5;
  color: #07C160;
  border: 1px solid rgba(7, 193, 96, 0.2);
}
.swxc-badge-orange {
  background: #FFF8F0;
  color: #E76F51;
  border: 1px solid rgba(244, 162, 97, 0.2);
}
.swxc-badge-red {
  background: #FFF0F0;
  color: #E74C3C;
  border: 1px solid rgba(231, 76, 60, 0.2);
}
.swxc-badge-teal {
  background: #E8F8F5;
  color: #2A9D8F;
  border: 1px solid rgba(42, 157, 143, 0.2);
}

/* ===== 分割线 ===== */
.swxc-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06), transparent);
  margin: 16px 0;
}

/* ===== 数量按钮 ===== */
.swxc-qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  -webkit-appearance: none;
  user-select: none;
  touch-action: manipulation;
}
.swxc-qty-btn:active {
  background: #f5f5f5;
  transform: scale(0.9);
}
.swxc-qty-num {
  font-size: 16px;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
  color: #1a1a1a;
}

/* ===== 搜索框 ===== */
.swxc-search {
  position: relative;
}
.swxc-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border-radius: 24px;
  border: 2px solid #e8e8e8;
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}
.swxc-search input:focus {
  border-color: #2A9D8F;
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.08);
}
.swxc-search input::placeholder {
  color: #bbb;
}
.swxc-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #bbb;
  pointer-events: none;
}

/* ===== 底部操作栏 ===== */
.swxc-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 12px 16px env(safe-area-inset-bottom, 0);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

/* ===== 优化字体渲染 ===== */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== 选中文字颜色 ===== */
::selection {
  background: rgba(42, 157, 143, 0.15);
  color: #264653;
}

/* ===== 全局微动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 渐变装饰线 ===== */
.swxc-gradient-line {
  height: 3px;
  background: linear-gradient(90deg, #2A9D8F, #F4A261, #E76F51);
  border-radius: 2px;
}
.swxc-gradient-line-thin {
  height: 2px;
  background: linear-gradient(90deg, #2A9D8F, #F4A261);
  border-radius: 1px;
}
