/**
 * 移动端专用样式
 * MindFlow 移动端适配
 */

/* ========== 基础移动端优化 ========== */

/* 防止文本选择（移动端长按复制） */
.no-select {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 允许文本选择 */
.allow-select {
  -webkit-user-select: text;
  user-select: text;
}

/* 禁用长按菜单 */
img, button, a {
  -webkit-touch-callout: none;
}

/* 优化滚动体验 */
.scroll-smooth {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 防止横屏时字体自动调整 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ========== 安全区域适配 ========== */

.safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-x {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ========== 底部导航栏 ========== */

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform 0.3s ease;
}

.mobile-bottom-nav.hidden {
  transform: translateY(100%);
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 11px;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item.active {
  color: #0ea5e9;
}

.mobile-bottom-nav .nav-item .material-icons {
  font-size: 24px;
  margin-bottom: 2px;
}

/* ========== 移动端布局优化 ========== */

@media (max-width: 640px) {
  /* 容器全宽 */
  .mobile-container {
    width: 100%;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* 卡片全宽 */
  .mobile-card {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    border-radius: 12px;
  }
  
  /* 按钮触摸区域优化 */
  .mobile-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 输入框优化 */
  .mobile-input {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 12px 16px;
    border-radius: 8px;
  }
  
  /* 列表项触摸区域 */
  .mobile-list-item {
    min-height: 48px;
    padding: 12px 16px;
  }
  
  /* 隐藏桌面端元素 */
  .hide-mobile {
    display: none !important;
  }
  
  /* 显示移动端元素 */
  .show-mobile {
    display: block !important;
  }
}

@media (min-width: 641px) {
  .hide-desktop {
    display: none !important;
  }
  
  .show-desktop {
    display: block !important;
  }
}

/* ========== 触摸反馈 ========== */

.touch-feedback {
  position: relative;
  overflow: hidden;
}

.touch-feedback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.touch-feedback:active::after {
  transform: translate(-50%, -50%) scale(2);
}

/* ========== 滑动手势区域 ========== */

.swipe-area {
  touch-action: pan-y;
  overflow: hidden;
}

.swipe-horizontal {
  touch-action: pan-x;
  overflow: hidden;
}

.swipe-none {
  touch-action: none;
}

/* ========== 骨架屏动画 ========== */

@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ========== 离线提示 ========== */

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #f97316;
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 14px;
  z-index: 100;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-banner.show {
  transform: translateY(0);
}

/* ========== 安装提示 ========== */

.install-prompt {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 60;
  display: none;
  animation: slideUp 0.3s ease;
}

.install-prompt.show {
  display: block;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 加载动画 ========== */

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: #0ea5e9;
  border-radius: 50%;
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
