/* 
 * Kerrystone Website - 移动端深度优化
 * 专注于移动端用户体验提升
 */

/* 移动端通用优化 */
@media (max-width: 768px) {
  :root {
    --section-padding: 40px 0; /* 减小移动端页面内边距 */
  }
  
  h1 {
    font-size: 2rem !important; /* 调整移动端标题大小 */
    line-height: 1.2;
  }
  
  h2 {
    font-size: 1.75rem !important;
  }
  
  h3 {
    font-size: 1.4rem !important;
  }
  
  p {
    font-size: 1rem !important; /* 确保文本可读性 */
    line-height: 1.6;
  }
  
  /* 改进移动端按钮体验 */
  .btn {
    padding: 12px 25px !important;
    min-height: 48px; /* 确保触摸区域足够大 */
    border-radius: 24px !important;
    font-size: 1rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    width: 100%; /* 全宽按钮更易点击 */
  }
  
  /* 改进移动端导航体验 */
  .mobile-menu {
    padding: 20px;
    max-height: 85vh; /* 限制高度以便滚动 */
    overflow-y: auto;
    scrollbar-width: thin;
  }
  
  .mobile-menu a {
    padding: 15px 0;
    font-size: 1.1rem;
    display: block;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .mobile-menu a:last-child {
    border-bottom: none;
  }
  
  /* 优化移动端表单元素 */
  input, textarea, select {
    font-size: 16px !important; /* 防止iOS自动缩放 */
    padding: 15px !important;
    margin-bottom: 15px;
    border-radius: 12px !important;
    -webkit-appearance: none; /* 移除iOS默认样式 */
  }
  
  /* 改进卡片布局 */
  .card, .feature-card, .team-member, .client-case {
    margin-bottom: 25px !important;
    padding: 20px !important;
  }
  
  /* 改进移动端间距和布局 */
  .row {
    margin-left: -10px !important;
    margin-right: -10px !important;
  }
  
  .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6 {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  
  /* 改进移动端菜单触发器 */
  .mobile-menu-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 3px 10px rgba(24, 144, 255, 0.2);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    outline: none;
    transition: all 0.3s ease;
  }
  
  .mobile-menu-toggle:active {
    transform: scale(0.95);
  }
  
  /* 优化移动端滚动体验 */
  html {
    scroll-padding-top: 80px; /* 确保锚点定位考虑固定头部 */
  }
  
  /* 触摸优化的滑动组件 */
  .touch-slider {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    scroll-snap-type: x mandatory;
    padding-bottom: 15px;
  }
  
  .touch-slider > * {
    scroll-snap-align: start;
    min-width: 85%;
    margin-right: 15px;
    flex-shrink: 0;
  }
  
  /* 底部导航栏 */
  .mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
  }
  
  .mobile-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.7rem;
    width: 25%;
    height: 100%;
  }
  
  .mobile-bottom-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 3px;
  }
  
  .mobile-bottom-nav-item.active {
    color: var(--primary-color);
  }
  
  @media (max-width: 768px) {
    .mobile-bottom-nav {
      display: flex;
    }
    
    .footer {
      padding-bottom: 70px; /* 为底部导航留出空间 */
    }
  }
  
  /* 增强版返回顶部按钮 */
  .back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(24, 144, 255, 0.3);
    z-index: 999;
  }
  
  .back-to-top.visible {
    opacity: 1;
    visibility: visible;
  }
  
  .back-to-top:active {
    transform: scale(0.95);
  }
  
  /* 图片优化 */
  img {
    max-width: 100%;
    height: auto !important;
  }
  
  /* 视频容器优化 */
  .video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 比例 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin: 20px 0;
  }
  
  .video-container iframe,
  .video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
  }
  
  /* 隐藏移动端不必要的元素 */
  @media (max-width: 768px) {
    .desktop-only {
      display: none !important;
    }
  }
  
  /* 只在移动端显示的元素 */
  .mobile-only {
    display: none;
  }
  
  @media (max-width: 768px) {
    .mobile-only {
      display: block;
    }
  }
  
  /* 移动端手势提示 */
  .swipe-hint {
    text-align: center;
    color: var(--primary-color);
    padding: 10px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }
  
  .swipe-hint::before {
    content: "←";
    animation: swipeLeft 1.5s infinite;
  }
  
  .swipe-hint::after {
    content: "→";
    animation: swipeRight 1.5s infinite;
  }
  
  @keyframes swipeLeft {
    0%, 100% { transform: translateX(0); opacity: 0.5; }
    50% { transform: translateX(-5px); opacity: 1; }
  }
  
  @keyframes swipeRight {
    0%, 100% { transform: translateX(0); opacity: 0.5; }
    50% { transform: translateX(5px); opacity: 1; }
  }
}
