/* ============================================
   全局设计系统 - 移动端优化版本
   ============================================ */

/* 字体系统优化 - 移动端友好 */
body.main-shell,
body,
body.app-screen {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
  /* 移动端优化 */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* 外层预览页（index.html）整体背景与排版 */
body.main-shell {
  background: linear-gradient(135deg, #E8F0FF 0%, #F0E6FF 50%, #FFF7E6 100%);
  margin: 0;
  padding: 1.5rem;
}

/* iPad Air 11寸横屏优化 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 单个 App 屏幕（各业务页面 iframe 中使用） */
body.app-screen {
  margin: 0;
  background: linear-gradient(135deg, #F0F7FF 0%, #E8F0FF 50%, #F5F9FC 100%);
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   设计令牌 (Design Tokens)
   ============================================ */

:root {
  /* 颜色系统 - 基于图片的柔和蓝色主题 */
  --color-primary: #2560FF;
  --color-primary-hover: #1E4FE6;
  --color-primary-light: #E8F0FF;
  --color-primary-gradient: linear-gradient(135deg, #4A7AFF 0%, #2560FF 100%);
  --color-success: #52C41A;
  --color-success-light: #F6FFED;
  --color-warning: #FAAD14;
  --color-warning-light: #FFFBE6;
  --color-danger: #FF4D4F;
  --color-danger-light: #FFF1F0;
  --color-info: #2560FF;
  --color-info-light: #E8F0FF;
  
  /* 渐变系统 - 卡片渐变背景 */
  --gradient-card-blue: linear-gradient(135deg, #E8F0FF 0%, #F0E6FF 100%);
  --gradient-card-green: linear-gradient(135deg, #F6FFED 0%, #E6F7FF 100%);
  --gradient-card-purple: linear-gradient(135deg, #F0E6FF 0%, #FFE6F0 100%);
  --gradient-card-orange: linear-gradient(135deg, #FFF7E6 0%, #FFE6F0 100%);
  --gradient-button: linear-gradient(135deg, #2560FF 0%, #1E4FE6 100%);
  
  /* 中性色 - 更柔和、更干净的层次 */
  --color-gray-50: #FAFBFC;
  --color-gray-100: #F5F7FA;
  --color-gray-200: #E8ECF0;
  --color-gray-300: #D1D9E0;
  --color-gray-400: #A8B5C1;
  --color-gray-500: #6B7C8F;
  --color-gray-600: #4A5568;
  --color-gray-700: #2D3748;
  --color-gray-800: #1A202C;
  --color-gray-900: #0D1117;
  
  /* 背景色 - 更干净的浅色背景 */
  --bg-primary: #FAFBFC;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  
  /* 间距系统 - 移动端优化，更大的间距 */
  --spacing-xs: 6px;
  --spacing-sm: 12px;
  --spacing-md: 20px;
  --spacing-lg: 28px;
  --spacing-xl: 36px;
  --spacing-2xl: 52px;
  
  /* 触摸目标大小 - 移动端最小44x44px */
  --touch-target-min: 44px;
  
  /* 圆角系统 - 移动端更大的圆角，更柔和 */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 28px;
  --radius-3xl: 36px;
  --radius-full: 9999px;
  
  /* 阴影系统 - 更柔和、更轻的阴影 */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 16px 0 rgba(0, 0, 0, 0.08), 0 2px 4px 0 rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 8px 24px 0 rgba(0, 0, 0, 0.1), 0 4px 8px 0 rgba(0, 0, 0, 0.06);
  --shadow-card: 0 2px 12px 0 rgba(37, 96, 255, 0.08);
  
  /* 过渡动画 */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* 行高优化 */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
}

/* ============================================
   通用组件样式优化
   ============================================ */

/* 卡片优化 - 基于图片的柔和渐变风格 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  border: 1px solid var(--color-gray-200);
}

.card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.card-elevated {
  box-shadow: var(--shadow-lg);
}

/* 渐变卡片样式 */
.card-gradient-blue {
  background: var(--gradient-card-blue);
  border: 1px solid rgba(37, 96, 255, 0.5);
}

.card-gradient-green {
  background: var(--gradient-card-green);
  border: 1px solid rgba(82, 196, 26, 0.1);
}

.card-gradient-purple {
  background: var(--gradient-card-purple);
  border: 1px solid rgba(160, 120, 240, 0.1);
}

.card-gradient-orange {
  background: var(--gradient-card-orange);
  border: 1px solid rgba(250, 173, 20, 0.1);
}

/* 按钮优化 - 移动端触摸友好 */
.btn {
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--transition-base);
  border-radius: var(--radius-lg);
  padding: 14px 28px;
  font-size: 16px; /* 移动端更大的字体 */
  line-height: 1.5;
  background: var(--gradient-button);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(37, 96, 255, 0.2);
  min-height: var(--touch-target-min); /* 确保触摸目标足够大 */
  -webkit-tap-highlight-color: rgba(37, 96, 255, 0.2);
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 96, 255, 0.3);
  background: linear-gradient(135deg, #1E4FE6 0%, #1A4AD9 100%);
}

.btn:active {
  transform: scale(0.98); /* 移动端按下效果 */
  box-shadow: 0 1px 4px rgba(37, 96, 255, 0.2);
  background: linear-gradient(135deg, #1A4AD9 0%, #163BC7 100%);
}

.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-secondary {
  background: white;
  color: var(--color-primary);
  border: 1.5px solid var(--color-gray-200);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--color-gray-50);
  border-color: rgba(37, 96, 255, 0.5);
  box-shadow: var(--shadow-md);
}

/* 输入框优化 - 移动端友好 */
.input {
  border-radius: var(--radius-md);
  border: 2px solid var(--color-gray-200); /* 移动端更粗的边框 */
  padding: 14px 18px; /* 移动端更大的内边距 */
  font-size: 16px; /* 移动端更大的字体，避免自动缩放 */
  line-height: 1.5;
  transition: all var(--transition-base);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  min-height: var(--touch-target-min);
  -webkit-appearance: none; /* 移除iOS默认样式 */
  appearance: none;
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37, 96, 255, 0.15); /* 移动端更明显的焦点 */
  outline: none;
  background: white;
}

.input:hover:not(:disabled) {
  border-color: var(--color-gray-300);
  box-shadow: var(--shadow-sm);
}

/* 移动端输入框优化 */
@media (max-width: 768px) {
  .input {
    font-size: 16px; /* 防止iOS自动缩放 */
  }
}

/* 标签优化 - 移动端 */
.label {
  font-weight: 600;
  color: var(--color-gray-700);
  font-size: 15px; /* 移动端稍大的字体 */
  margin-bottom: 8px; /* 移动端更大的间距 */
  display: block;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* 渐变背景工具类 */
.bg-gradient-primary {
  background: var(--gradient-button);
}

.bg-gradient-card-blue {
  background: var(--gradient-card-blue);
}

.bg-gradient-card-green {
  background: var(--gradient-card-green);
}

.bg-gradient-card-purple {
  background: var(--gradient-card-purple);
}

.bg-gradient-card-orange {
  background: var(--gradient-card-orange);
}

/* 柔和的阴影工具类 */
.shadow-soft {
  box-shadow: var(--shadow-sm);
}

.shadow-soft-md {
  box-shadow: var(--shadow-md);
}

.shadow-soft-lg {
  box-shadow: var(--shadow-lg);
}

.shadow-card {
  box-shadow: var(--shadow-card);
}

/* 徽章优化 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* 分隔线优化 */
.divider {
  border: none;
  border-top: 1px solid var(--color-gray-200);
  margin: var(--spacing-lg) 0;
}

/* 工具提示优化 */
.tooltip {
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--color-gray-900);
  color: white;
  border-radius: var(--radius-md);
  font-size: 12px;
  white-space: nowrap;
  margin-bottom: 8px;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

/* iPad外壳样式（保留用于其他用途） */
.tablet-shell {
  position: relative;
  border-radius: 36px;
  background: linear-gradient(to bottom, #dbeafe, #bfdbfe);
  padding: 16px;
  box-shadow: 0 20px 50px rgba(59, 130, 246, 0.2), 0 8px 16px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(147, 197, 253, 0.6);
  max-width: 800px;
  margin: 0 auto;
}

.tablet-screen {
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  aspect-ratio: 4 / 3;
}

.tablet-shell::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 60px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

.tablet-shell::after {
  content: "";
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 80px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #4A7AFF, #2560FF);
  opacity: 0.8;
  transform: translateX(-50%);
}

/* ============================================
   iPad Air 11寸真实外观增强
   ============================================ */

/* iPad外壳金属质感 */
.ipad-container {
  position: relative;
}

/* 添加环境光效果 */
.ipad-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 48px;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(0, 0, 0, 0.2) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

/* 屏幕边框高光 */
.ipad-screen::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 30%,
    transparent 70%,
    rgba(0, 0, 0, 0.2) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.iframe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.5rem;
}

.iframe-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.iframe-label {
  color: #1f2937;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.iframe-label span {
  opacity: 0.75;
}

/* ============================================
   移动端特定优化
   ============================================ */

/* 移动端触摸优化 */
* {
  -webkit-tap-highlight-color: transparent;
}

button, a, [role="button"] {
  -webkit-tap-highlight-color: rgba(37, 96, 255, 0.1);
  touch-action: manipulation;
  user-select: none;
}

/* 移动端滚动优化 */
body, html {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* 移动端卡片点击反馈 */
.card {
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.card:active {
  transform: scale(0.98);
}

/* 移动端列表项优化 */
.list-item {
  min-height: var(--touch-target-min);
  padding: var(--spacing-md);
  display: flex;
  align-items: center;
  transition: background-color 150ms ease;
}

.list-item:active {
  background-color: var(--color-gray-100);
}

/* 移动端表单优化 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  font-size: 16px; /* 防止iOS自动缩放 */
  -webkit-appearance: none;
  appearance: none;
}

/* 移动端按钮组 */
.btn-group-mobile {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  width: 100%;
}

.btn-group-mobile .btn {
  width: 100%;
}

/* 移动端模态框优化 */
.modal-mobile {
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 移动端安全区域支持 */
@supports (padding: max(0px)) {
  .safe-area-top {
    padding-top: max(var(--spacing-md), env(safe-area-inset-top));
  }
  
  .safe-area-bottom {
    padding-bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
  }
  
  .safe-area-left {
    padding-left: max(var(--spacing-md), env(safe-area-inset-left));
  }
  
  .safe-area-right {
    padding-right: max(var(--spacing-md), env(safe-area-inset-right));
  }
}

/* 移动端加载状态 */
.loading-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.loading-mobile::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 移动端空状态 */
.empty-state-mobile {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-gray-500);
}

.empty-state-mobile i {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

/* 移动端下拉刷新 */
.pull-to-refresh {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 移动端底部操作栏 */
.action-bar-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: var(--spacing-md);
  padding-bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
}

/* 移动端搜索栏 */
.search-bar-mobile {
  position: sticky;
  top: 0;
  z-index: 50;
  background: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-gray-200);
}

/* 移动端标签页 */
.tabs-mobile {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--color-gray-200);
}

.tabs-mobile::-webkit-scrollbar {
  display: none;
}

.tab-mobile {
  flex-shrink: 0;
  padding: var(--spacing-md) var(--spacing-lg);
  min-height: var(--touch-target-min);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-gray-600);
  border-bottom: 2px solid transparent;
  transition: all 200ms ease;
}

.tab-mobile.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ============================================
   移动端响应式布局优化
   ============================================ */

/* 基础移动端优化 - 流式布局 */
@media (max-width: 767px) {
  /* 容器宽度自适应 */
  .container,
  .container-fluid {
    width: 100%;
    max-width: 100%;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
  }
  
  /* 卡片全宽 */
  .card {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: var(--spacing-md);
  }
  
  /* 按钮组垂直排列 */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
    margin-bottom: var(--spacing-sm);
  }
  
  /* 网格布局改为单列 */
  .grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Flex布局改为垂直 */
  .flex-row {
    flex-direction: column;
  }
  
  /* 隐藏非核心元素 */
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  .text-mobile-center {
    text-align: center;
  }
  
  .full-width-mobile {
    width: 100%;
  }
  
  /* 字体大小优化 */
  body {
    font-size: 16px; /* 防止iOS自动缩放 */
  }
  
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }
  h4 { font-size: 16px; }
  
  /* 间距优化 */
  .spacing-mobile-sm {
    margin-bottom: var(--spacing-sm);
  }
  
  .spacing-mobile-md {
    margin-bottom: var(--spacing-md);
  }
  
  .spacing-mobile-lg {
    margin-bottom: var(--spacing-lg);
  }
}

/* 小屏手机优化 (320px - 374px) */
@media (max-width: 374px) {
  :root {
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
  }
  
  .card {
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 15px;
  }
}

/* 中等手机优化 (375px - 414px) */
@media (min-width: 375px) and (max-width: 414px) {
  :root {
    --spacing-md: 16px;
    --spacing-lg: 20px;
  }
}

/* 大屏手机优化 (415px - 767px) */
@media (min-width: 415px) and (max-width: 767px) {
  .grid-cols-2-mobile {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   表格移动端优化 - 卡片式展示
   ============================================ */

@media (max-width: 767px) {
  /* 表格容器改为垂直滚动 */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
  }
  
  /* 表格改为卡片式 */
  table {
    display: block;
    width: 100%;
  }
  
  thead {
    display: none;
  }
  
  tbody {
    display: block;
  }
  
  tr {
    display: block;
    margin-bottom: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-gray-200);
  }
  
  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border: none;
    border-bottom: 1px solid var(--color-gray-100);
  }
  
  td:last-child {
    border-bottom: none;
  }
  
  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-gray-600);
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
  }
  
  /* 表格操作按钮 */
  .table-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-gray-200);
  }
  
  .table-actions .btn {
    flex: 1;
  }
}

/* ============================================
   表单移动端优化
   ============================================ */

@media (max-width: 767px) {
  /* 表单全宽 */
  form {
    width: 100%;
  }
  
  /* 输入框全宽 */
  .input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  textarea,
  select {
    width: 100%;
    max-width: 100%;
    font-size: 16px; /* 防止iOS自动缩放 */
    padding: 14px 16px;
    min-height: var(--touch-target-min);
    box-sizing: border-box;
  }
  
  /* 表单组垂直排列 */
  .form-group {
    margin-bottom: var(--spacing-md);
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-row > * {
    width: 100%;
    margin-bottom: var(--spacing-sm);
  }
  
  /* 标签优化 */
  label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-gray-700);
  }
  
  /* 复选框和单选框优化 */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin-right: var(--spacing-sm);
  }
  
  /* 文件上传优化 */
  input[type="file"] {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px dashed var(--color-gray-300);
    border-radius: var(--radius-md);
    background: var(--color-gray-50);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ============================================
   弹窗和模态框移动端优化
   ============================================ */

@media (max-width: 767px) {
  /* 模态框全屏或底部弹出 */
  .modal,
  .modal-dialog {
    width: 100%;
    max-width: 100%;
    margin: 0;
    max-height: 90vh;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: translateY(0);
    animation: slideUp 0.3s ease-out;
  }
  
  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* 模态框内容区域 */
  .modal-content {
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--spacing-md);
  }
  
  /* 模态框头部 */
  .modal-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-gray-200);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }
  
  /* 模态框底部 */
  .modal-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-gray-200);
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  /* 关闭按钮优化 */
  .modal-close {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 遮罩层优化 */
  .modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
  }
}

/* ============================================
   导航栏移动端优化
   ============================================ */

@media (max-width: 767px) {
  /* 侧边栏隐藏，改为底部导航或汉堡菜单 */
  .sidebar,
  .nav-sidebar {
    display: none;
  }
  
  /* 顶部导航栏优化 */
  .top-nav,
  .navbar {
    height: 56px;
    padding: 0 var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
  
  /* 汉堡菜单按钮 */
  .hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
  }
  
  .hamburger-menu span {
    width: 24px;
    height: 3px;
    background: var(--color-gray-700);
    border-radius: 2px;
    transition: all 0.3s ease;
  }
  
  .hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
  }
  
  .hamburger-menu.active span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
  
  /* 抽屉菜单 */
  .drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .drawer.open {
    left: 0;
  }
  
  .drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
  }
  
  .drawer-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* 底部导航栏 */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: white;
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
  }
  
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs);
    min-height: var(--touch-target-min);
    color: var(--color-gray-600);
    text-decoration: none;
    transition: all 0.2s ease;
  }
  
  .bottom-nav-item.active {
    color: var(--color-primary);
  }
  
  .bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
  }
  
  .bottom-nav-item span {
    font-size: 11px;
    font-weight: 500;
  }
  
  /* 主内容区域底部留白 */
  .main-content {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

/* ============================================
   图片移动端优化
   ============================================ */

@media (max-width: 767px) {
  img {
    max-width: 100%;
    height: auto;
    display: block;
  }
  
  /* 响应式图片 */
  .img-responsive {
    width: 100%;
    height: auto;
  }
  
  /* 图片容器 */
  .img-container {
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-md);
  }
  
  /* 背景图片优化 */
  .bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }
}

/* ============================================
   列表移动端优化
   ============================================ */

@media (max-width: 767px) {
  /* 列表项优化 */
  .list-item {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    min-height: var(--touch-target-min);
  }
  
  /* 列表项点击反馈 */
  .list-item:active {
    background: var(--color-gray-100);
    transform: scale(0.98);
  }
  
  /* 列表分隔线 */
  .list-divider {
    height: 1px;
    background: var(--color-gray-200);
    margin: var(--spacing-sm) 0;
  }
}

/* ============================================
   手势支持优化
   ============================================ */

/* 滑动操作 */
.swipeable {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.swipeable-content {
  transition: transform 0.3s ease;
}

/* 轮播图优化 */
.carousel {
  position: relative;
  overflow: hidden;
  touch-action: pan-x;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
}

.carousel-item {
  flex: 0 0 100%;
  width: 100%;
}

/* 下拉刷新 */
.pull-to-refresh-indicator {
  text-align: center;
  padding: var(--spacing-md);
  color: var(--color-gray-500);
  font-size: 14px;
}

/* ============================================
   性能优化
   ============================================ */

/* 懒加载图片 */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* 减少动画（低性能设备） */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   移动端响应式工具类
   ============================================ */

@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  .text-mobile-center {
    text-align: center;
  }
  
  .full-width-mobile {
    width: 100%;
  }
  
  .flex-mobile-column {
    flex-direction: column;
  }
  
  .grid-mobile-1 {
    grid-template-columns: 1fr;
  }
  
  .grid-mobile-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}