/*
 * Mobile Responsive CSS for Apple Style Theme
 * 移动端响应式样式
 */

/* 移动端断点定义 */
:root {
  --mobile-breakpoint: 768px;
  --tablet-breakpoint: 1024px;
  --small-mobile-breakpoint: 480px;
}

/* 小屏幕设备优化 (手机竖屏) */
@media (max-width: 480px) {
  :root {
    --apple-spacing-xs: 6px;
    --apple-spacing-sm: 12px;
    --apple-spacing-md: 18px;
    --apple-spacing-lg: 30px;
    --apple-spacing-xl: 40px;
    --apple-spacing-xxl: 60px;
  }

  /* 基础排版调整 */
  h1 {
    font-size: clamp(2rem, 8vw, 2.5rem);
    line-height: 1.1;
  }

  h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  h3 {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
  }

  p {
    font-size: 1rem;
    line-height: 1.5;
  }

  /* 容器调整 */
  .container {
    padding: 0 var(--apple-spacing-sm);
  }

  /* Hero区域移动端优化 */
  .hero-section {
    min-height: 60vh;
    padding: var(--apple-spacing-lg) 0;
    text-align: center;
  }

  .hero-title {
    font-size: 2.2rem;
    margin-bottom: var(--apple-spacing-sm);
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: var(--apple-spacing-lg);
  }

  .hero-buttons {
    flex-direction: column;
    gap: var(--apple-spacing-sm);
    align-items: center;
  }

  .hero-buttons .btn-primary,
  .hero-buttons .btn-secondary {
    width: 100%;
    max-width: 280px;
    padding: var(--apple-spacing-md) var(--apple-spacing-lg);
  }

  /* 产品轮播移动端优化 */
  .products-carousel-wrapper {
    width: 100%; /* Reset full width on mobile */
    margin-left: 0; /* Reset break-out on mobile */
  }

  .products-carousel-wrapper .carousel-nav {
    display: none !important; /* 移动端隐藏箭头 */
  }

  .products-carousel {
    padding: var(--apple-spacing-md) 0 var(--apple-spacing-lg) 0; /* 增加底部padding给阴影留空间 */
    overflow-y: visible; /* 允许阴影显示 */
    /* 移动端触摸滚动优化 */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .products-grid {
    padding-left: var(--apple-spacing-md); /* Smaller left padding on mobile */
    padding-right: var(--apple-spacing-md);
  }

  /* Hide desktop gradient on mobile */
  .products-section::after {
    display: none !important;
  }

  .product-card {
    /* 移动端卡片尺寸调整 - 保持比例缩小 */
    flex: 0 0 280px;
    height: 400px;
    scroll-snap-align: start;
    /* 触摸优化 */
    touch-action: manipulation;
  }

  /* Hero产品在移动端的特殊处理 */
  .product-card-hero {
    /* 移动端Hero产品稍大一些 */
    flex: 0 0 320px !important;
    height: 420px !important;
  }

  /* Hero产品移动端内容调整 - 与分类卡片一致 */
  .product-card-hero .product-info {
    /* 移动端调整文字区域位置 */
    top: 40px;
    left: 20px;
    width: 240px;
    height: 100px;
    padding: 0;
  }

  .product-card-hero .product-title {
    font-size: 1.4rem;
    margin-bottom: 6px;
    line-height: 1.2;
  }

  .product-card-hero .product-description {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .product-image-container {
    height: 200px; /* 移动端减小图片高度 */
  }

  /* Apple风格分类轮播 - 移动端优化 */
  .categories-carousel-wrapper {
    width: 100%; /* Reset full width on mobile */
    margin-left: 0; /* Reset break-out on mobile */
  }

  .carousel-nav {
    display: none !important; /* 移动端隐藏箭头 */
  }

  .categories-carousel {
    padding: var(--apple-spacing-md) 0 var(--apple-spacing-lg) 0; /* 增加底部padding给阴影留空间 */
    overflow-y: visible; /* 允许阴影显示 */
    /* 移动端触摸滚动优化 */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .categories-grid {
    padding-left: var(--apple-spacing-md); /* Smaller left padding on mobile */
    padding-right: var(--apple-spacing-md);
  }

  /* Hide desktop gradient on mobile */
  .categories-section::after {
    display: none !important;
  }

  .category-card {
    /* 移动端卡片尺寸调整 - 保持比例缩小 */
    flex: 0 0 280px;
    height: 360px;
    scroll-snap-align: start;
    /* 触摸优化 */
    touch-action: manipulation;
  }

  .category-card-content {
    /* 移动端调整文字区域位置 */
    top: 40px;
    left: 20px;
    width: 240px;
    height: 100px;
    padding: 0;
  }

  .category-title {
    font-size: 1.4rem;
    margin-bottom: 6px;
    line-height: 1.2;
  }

  .category-description {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  /* 特色功能响应式 */
  .features-grid {
    grid-template-columns: 1fr;
    gap: var(--apple-spacing-md);
  }

  .feature-item {
    padding: var(--apple-spacing-lg);
  }

  .feature-icon {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
  }

  .feature-title {
    font-size: 1.3rem;
  }

  .feature-description {
    font-size: 0.95rem;
  }

  /* 产品筛选器调整 */
  .product-filters {
    flex-wrap: wrap;
    gap: var(--apple-spacing-xs);
    justify-content: center;
  }

  .filter-btn {
    padding: var(--apple-spacing-xs) var(--apple-spacing-sm);
    font-size: 0.85rem;
    min-width: auto;
  }

  /* 关于我们区域 */
  .company-content {
    grid-template-columns: 1fr;
    gap: var(--apple-spacing-lg);
    text-align: center;
  }

  .company-section .section-title {
    font-size: 2.2rem;
  }

  .company-description {
    font-size: 1.1rem;
  }

  .company-stats {
    flex-direction: column;
    gap: var(--apple-spacing-md);
    margin: var(--apple-spacing-lg) 0;
  }

  .stat-item {
    flex: none;
    padding: var(--apple-spacing-md);
  }

  .stat-number {
    font-size: 2rem;
  }

  .company-image {
    order: -1;
  }

  /* 联系我们区域 */
  .contact-section .section-title {
    font-size: 2.2rem;
    margin-bottom: var(--apple-spacing-xl);
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--apple-spacing-lg);
  }

  .contact-item {
    flex-direction: row;
    text-align: left;
    gap: var(--apple-spacing-md);
    padding: var(--apple-spacing-lg);
  }

  .contact-info-icon {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }

  .contact-details h4 {
    font-size: 1rem;
  }

  .contact-details p {
    font-size: 0.95rem;
  }

  /* 表单优化 */
  .apple-form {
    padding: var(--apple-spacing-lg);
  }

  .form-group input,
  .form-group textarea {
    padding: var(--apple-spacing-sm);
    font-size: 16px; /* 防止iOS缩放 */
  }
}

/* 平板端适配 (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {

  /* 平板端分类轮播 */
  .categories-carousel-wrapper {
    width: 100vw; /* Partial break-out on tablet */
    margin-left: calc(-50vw + 50%);
  }

  .categories-grid {
    padding-left: 80px; /* Medium left padding for tablets */
    padding-right: var(--apple-spacing-lg);
  }

  .carousel-nav {
    width: 40px;
    height: 40px;
    display: block !important;
  }

  .carousel-nav.prev {
    left: 20px;
  }

  .carousel-nav.next {
    right: 60px; /* Position before tablet fade area */
  }

  /* Tablet gradient */
  .categories-section::after {
    display: block !important;
    width: 60px;
  }

  .category-card {
    flex: 0 0 320px; /* Medium size for tablets */
    height: 400px;
  }

  .category-card-content {
    /* 平板端调整文字区域位置 */
    top: 50px;
    left: 25px;
    width: 270px;
    height: 110px;
    padding: 0;
  }

  .category-title {
    font-size: 1.6rem;
    margin-bottom: 6px;
    line-height: 1.15;
  }

  .category-description {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  /* 移除移动端渐变提示 */
  .categories-carousel::after {
    display: none;
  }

  /* Hero产品在平板端的特殊处理 */
  .product-card-hero {
    /* 平板端Hero产品保持较大尺寸 */
    flex: 0 0 380px !important;
    height: 480px !important;
  }

  /* Hero产品平板端内容调整 - 与分类卡片一致 */
  .product-card-hero .product-info {
    /* 平板端调整文字区域位置 */
    top: 50px;
    left: 25px;
    width: 270px;
    height: 110px;
    padding: 0;
  }

  .product-card-hero .product-title {
    font-size: 1.6rem;
    margin-bottom: 6px;
    line-height: 1.15;
  }

  .product-card-hero .product-description {
    font-size: 0.95rem;
    line-height: 1.3;
  }
}

/* 中等屏幕设备 (手机横屏/小平板) */
@media (min-width: 481px) and (max-width: 768px) {
  /* Hero区域调整 */
  .hero-section {
    min-height: 70vh;
  }

  /* 产品网格两列显示 */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--apple-spacing-md);
  }

  .product-card {
    width: 100%;
    height: auto;
  }

  .product-image-container {
    height: 200px; /* 平板端适中的图片高度 */
  }

  /* 分类网格两列 */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 特色功能保持两列 */
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--apple-spacing-md);
  }

  .feature-item {
    padding: var(--apple-spacing-xl);
  }

  .feature-icon {
    width: 75px;
    height: 75px;
    font-size: 1.9rem;
  }

  .feature-title {
    font-size: 1.4rem;
  }

  /* 关于我们平板优化 */
  .company-section .section-title {
    font-size: 2.5rem;
  }

  .company-stats {
    flex-direction: row;
    justify-content: space-between;
  }

  .stat-item {
    flex: 1;
    max-width: 150px;
  }

  /* 联系我们平板优化 */
  .contact-section .section-title {
    font-size: 2.5rem;
  }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  /* 产品网格三列 */
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Hero区域平板优化 */
  .hero-content {
    max-width: 700px;
  }
}

/* 移动端Header优化 */
@media (max-width: 768px) {
  /* 确保Apple Header在移动端正确显示 */
  .apple-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
  }

  .apple-nav {
    height: 44px;
    padding: 0 16px;
  }

  .nav-container {
    height: 100%;
  }

  /* 品牌区域 */
  .nav-brand .brand-text {
    font-size: 18px;
  }

  /* 隐藏桌面导航 */
  .nav-main {
    display: none;
  }

  /* 隐藏桌面联系按钮 */
  .contact-btn {
    display: none;
  }

  /* 显示移动菜单按钮 */
  .mobile-menu-toggle {
    display: flex;
  }

  /* 搜索按钮调整 */
  .search-toggle {
    width: 40px;
    height: 40px;
  }

  .search-icon {
    width: 16px;
    height: 16px;
  }

  /* 移动端搜索优化 */
  .search-container {
    padding: 80px 16px 20px;
  }

  .search-field {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 14px 16px;
  }

  /* 移动菜单内容适配 */
  .mobile-nav-content {
    width: 100%;
    max-width: none;
  }

  .mobile-nav-menu a {
    font-size: 16px;
    padding: 14px 20px;
  }

  .mobile-contact-btn {
    font-size: 16px;
    padding: 14px;
  }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
  .apple-nav {
    padding: 0 12px;
  }

  .nav-brand .brand-text {
    font-size: 16px;
  }

  .search-toggle {
    width: 36px;
    height: 36px;
  }

  .search-icon {
    width: 14px;
    height: 14px;
  }

  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
  }

  .hamburger-line {
    width: 15px;
  }

  .search-container {
    padding: 70px 12px 20px;
  }

  .mobile-nav-header {
    padding: 0 16px;
  }

  .mobile-brand {
    font-size: 16px;
  }

  .mobile-nav-close {
    width: 36px;
    height: 36px;
  }

  .mobile-nav-menu {
    padding: 16px 0;
  }

  .mobile-nav-menu a {
    font-size: 15px;
    padding: 12px 16px;
  }

  .mobile-nav-footer {
    bottom: 30px;
    left: 16px;
    right: 16px;
  }

  .mobile-contact-btn {
    font-size: 15px;
    padding: 12px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .search-toggle,
  .mobile-menu-toggle,
  .mobile-nav-close {
    min-height: 44px;
    min-width: 44px;
  }

  .apple-nav-menu a,
  .mobile-nav-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* 移除悬停效果 */
  .search-toggle:hover,
  .mobile-menu-toggle:hover,
  .mobile-nav-close:hover {
    background: none;
  }

  /* 添加点击反馈 */
  .search-toggle:active,
  .mobile-menu-toggle:active,
  .mobile-nav-close:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-nav-content {
    overflow-y: auto;
  }

  .mobile-nav-menu {
    padding: 10px 0;
  }

  .mobile-nav-menu a {
    padding: 10px 20px;
  }

  .mobile-nav-footer {
    position: relative;
    bottom: auto;
    margin: 20px;
  }

  .search-container {
    padding: 60px 16px 20px;
  }
}

/* 产品详情页移动端优化 */
@media (max-width: 768px) {
  .product-hero-content {
    grid-template-columns: 1fr;
    gap: var(--apple-spacing-lg);
  }

  .product-gallery {
    order: -1;
    position: static;
  }

  .image-thumbnails {
    justify-content: center;
  }

  .product-details {
    padding: var(--apple-spacing-md);
  }

  .product-title {
    font-size: 1.8rem;
    text-align: center;
  }

  .specs-grid {
    grid-template-columns: 1fr;
  }

  .spec-item {
    flex-direction: column;
    gap: var(--apple-spacing-xs);
    text-align: center;
  }

  .product-actions {
    flex-direction: column;
    gap: var(--apple-spacing-sm);
  }

  .product-actions .btn-primary,
  .product-actions .btn-secondary {
    width: 100%;
    text-align: center;
  }

  /* 相关产品移动端 */
  .related-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--apple-spacing-sm);
  }
}

@media (max-width: 480px) {
  .related-products-grid {
    grid-template-columns: 1fr;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  /* 增加触摸目标大小 */
  .btn-primary,
  .btn-secondary,
  .filter-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* 移除悬停效果，使用点击效果 */
  .product-card:hover {
    transform: none;
  }

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

  .category-card:hover {
    transform: none;
  }

  .category-card:active {
    transform: scale(0.96);
    box-shadow:
      0 8px 20px rgba(0, 0, 0, 0.12),
      0 2px 6px rgba(0, 0, 0, 0.08);
  }

  /* 表单输入优化 */
  .form-group input,
  .form-group textarea {
    font-size: 16px; /* 防止iOS Safari缩放 */
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    min-height: 100vh;
    padding: var(--apple-spacing-md) 0;
  }

  .hero-title {
    font-size: 2rem;
    margin-bottom: var(--apple-spacing-sm);
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: var(--apple-spacing-md);
  }
}

/* 可访问性改进 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scroll-indicator {
    animation: none;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .product-card,
  .category-card,
  .feature-item {
    border: 2px solid var(--apple-text-primary);
  }

  .btn-primary {
    border: 2px solid var(--apple-blue);
  }

  .btn-secondary {
    border-width: 3px;
  }
}

/* 深色模式适配 - 暂时禁用，保持浅色主题 */
/*
@media (prefers-color-scheme: dark) {
  注释掉深色模式，确保产品详情页始终保持白色背景
}
*/

/* 打印样式 */
@media print {
  .hero-section,
  .features-section,
  .contact-section {
    break-inside: avoid;
  }

  .product-card {
    break-inside: avoid;
    margin-bottom: var(--apple-spacing-md);
  }

  .btn-primary,
  .btn-secondary {
    border: 2px solid #000;
    background: transparent !important;
    color: #000 !important;
  }
}