/* 推薪客移动端深度适配 */

/* 移动端基础优化 */
@media (max-width: 768px) {
  /* 容器优化 */
  .container {
    padding: 0 16px;
  }
  
  /* 字体优化 */
  html {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }
  
  h2 {
    font-size: 1.5rem;
    margin-bottom: 0.875rem;
  }
  
  h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }
  
  /* 按钮优化 */
  .btn {
    min-height: 44px; /* 最小触摸目标尺寸 */
    padding: 12px 20px;
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  .btn-sm {
    min-height: 36px;
    padding: 8px 16px;
  }
  
  .btn-lg {
    min-height: 52px;
    padding: 16px 24px;
  }
  
  /* 表单优化 */
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px; /* 防止iOS缩放 */
    min-height: 44px;
    padding: 12px 16px;
  }
  
  /* 导航优化 */
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
  }
  
  .nav-container {
    padding: 12px 16px;
  }
  
  .nav-links {
    display: none; /* 移动端隐藏导航链接，使用汉堡菜单 */
  }
  
  .mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
  }
  
  .mobile-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: none;
  }
  
  .mobile-menu.active {
    display: block;
  }
  
  .mobile-menu .nav-link {
    display: block;
    padding: 16px;
    border-bottom: 1px solid #E2E8F0;
  }
  
  /* 卡片优化 */
  .card {
    margin-bottom: 16px;
    border-radius: 12px;
  }
  
  .card-header {
    padding: 16px;
  }
  
  .card-body {
    padding: 16px;
  }
  
  .card-footer {
    padding: 16px;
  }
  
  /* 表格优化 */
  .table-container {
    margin: 0 -16px;
    padding: 0 16px;
  }
  
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table th,
  .table td {
    min-width: 100px;
    padding: 12px 8px;
  }
  
  /* 模态框优化 */
  .modal {
    width: 90% !important;
    max-width: 400px !important;
    max-height: 80vh;
    border-radius: 16px;
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .modal-body {
    padding: 16px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 底部安全区域 */
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  /* 手势优化 */
  .swipe-area {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  
  .swipe-item {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  
  /* 触摸反馈 */
  .touch-feedback:active {
    opacity: 0.7;
    transform: scale(0.98);
  }
}

/* 小屏幕手机优化 */
@media (max-width: 375px) {
  .container {
    padding: 0 12px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  .btn {
    padding: 10px 16px;
  }
}

/* 平板优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 0 24px;
  }
  
  .nav-links {
    gap: 12px;
  }
  
  .nav-link {
    padding: 8px 12px;
  }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .navbar {
    position: static;
  }
  
  .modal {
    max-height: 90vh;
  }
  
  .modal-body {
    max-height: calc(90vh - 120px);
  }
}

/* 暗色模式移动端优化 */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
  .mobile-menu {
    background: #1F2937;
  }
  
  .mobile-menu .nav-link {
    border-bottom-color: #374151;
    color: #D1D5DB;
  }
  
  .mobile-menu .nav-link:hover {
    background: #374151;
    color: white;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .btn,
  .form-input,
  .nav-link {
    border-width: 0.5px;
  }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 鸿蒙系统优化 */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari特有优化 */
  .btn,
  .form-input {
    -webkit-appearance: none;
  }
  
  .modal-body {
    -webkit-overflow-scrolling: touch;
  }
}

/* 安卓系统优化 */
@supports not (-webkit-touch-callout: none) {
  .btn,
  .form-input {
    outline: none;
  }
  
  .btn:focus,
  .form-input:focus {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
  }
}

/* 移动端特定组件 */
.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }
  
  .desktop-only {
    display: none;
  }
}

/* 底部导航栏（移动端） */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  text-decoration: none;
  color: #64748B;
  flex: 1;
}

.mobile-bottom-nav-item.active {
  color: #4F46E5;
}

.mobile-bottom-nav-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.mobile-bottom-nav-label {
  font-size: 10px;
}

/* 上拉加载更多 */
.pull-to-refresh {
  position: relative;
  overflow: hidden;
}

.pull-to-refresh-indicator {
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
}

/* 下拉刷新 */
.infinite-scroll-loader {
  padding: 20px;
  text-align: center;
  color: #64748B;
}

/* 移动端图片优化 */
.mobile-image {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 移动端视频优化 */
.mobile-video {
  width: 100%;
  height: auto;
  max-height: 50vh;
}

/* 移动端地图优化 */
.mobile-map {
  width: 100%;
  height: 300px;
}

/* 移动端聊天优化 */
.mobile-chat {
  height: calc(100vh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-chat-input {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #E2E8F0;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* 移动端支付优化 */
.mobile-payment {
  max-width: 400px;
  margin: 0 auto;
}

/* 移动端分享优化 */
.mobile-share-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 1001;
}

/* 移动端通知优化 */
.mobile-notification {
  position: fixed;
  top: 60px;
  left: 16px;
  right: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 16px;
  z-index: 1000;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 移动端搜索优化 */
.mobile-search {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  z-index: 1001;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  font-size: 16px;
}

/* 移动端筛选优化 */
.mobile-filter {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 1001;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 移动端引导页优化 */
.mobile-onboarding {
  height: 100vh;
  overflow: hidden;
}

.mobile-onboarding-slide {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.mobile-onboarding-image {
  max-width: 80%;
  max-height: 40vh;
  margin-bottom: 40px;
}

.mobile-onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.mobile-onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E2E8F0;
}

.mobile-onboarding-dot.active {
  background: #4F46E5;
}

/* 移动端错误页面优化 */
.mobile-error {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.mobile-error-icon {
  font-size: 64px;
  margin-bottom: 20px;
  color: #EF4444;
}

.mobile-error-title {
  font-size: 24px;
  margin-bottom: 12px;
  color: #1E293B;
}

.mobile-error-message {
  color: #64748B;
  margin-bottom: 32px;
}

/* 移动端空状态优化 */
.mobile-empty {
  padding: 60px 20px;
  text-align: center;
}

.mobile-empty-icon {
  font-size: 48px;
  margin-bottom: 20px;
  color: #9CA3AF;
}

.mobile-empty-title {
  font-size: 18px;
  margin-bottom: 8px;
  color: #374151;
}

.mobile-empty-description {
  color: #6B7280;
  margin-bottom: 24px;
}

/* 移动端加载状态优化 */
.mobile-loading {
  padding: 60px 20px;
  text-align: center;
}

.mobile-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #E2E8F0;
  border-radius: 50%;
  border-top-color: #4F46E5;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.mobile-loading-text {
  color: #64748B;
}

/* 移动端性能优化 */
.mobile-performance {
  /* 减少重绘和重排 */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 移动端无障碍优化 */
.mobile-accessibility {
  /* 增加触摸目标尺寸 */
  min-height: 44px;
  min-width: 44px;
  
  /* 增加对比度 */
  color: #1F2937;
  background: white;
  
  /* 支持屏幕阅读器 */
  -webkit-tap-highlight-color: transparent;
}

/* 移动端测试类 */
.mobile-test-border {
  border: 1px solid red;
}

.mobile-test-bg {
  background: rgba(255, 0, 0, 0.1);
}