/**
 * Sun Team - Mobile Experience Optimizations
 * 移动端体验优化样式
 */

/* ========================================
   Mobile-First Base Styles
   ======================================== */

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Touch action optimization */
* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ========================================
   Responsive Typography
   ======================================== */

@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2;
  }
  
  h2 {
    font-size: 1.5rem !important;
  }
  
  h3 {
    font-size: 1.25rem !important;
  }
  
  p {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  :root {
    font-size: 13px;
  }
  
  h1 {
    font-size: 1.5rem !important;
  }
  
  h2 {
    font-size: 1.25rem !important;
  }
}

/* ========================================
   Mobile Layout Fixes
   ======================================== */

@media (max-width: 768px) {
  /* Container padding */
  main {
    padding: 60px 16px 100px !important;
    max-width: 100% !important;
  }
  
  .header-inner {
    padding: 0 16px;
    height: 56px;
  }
  
  /* Hero section */
  .hero {
    padding: 40px 16px 60px !important;
  }
  
  .hero h1 {
    font-size: 2rem !important;
  }
  
  .hero p {
    font-size: 1rem !important;
    padding: 0 8px;
  }
  
  /* CTA buttons */
  .cta-buttons {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 0 8px !important;
  }
  
  .cta-buttons .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 14px 20px !important;
  }
  
  /* Grid layouts */
  .grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-6 {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  /* Stats grid */
  .stats-grid,
  .stats {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  /* Cards grid */
  .agents-grid,
  .agents-live-grid,
  .model-providers-grid,
  .reviews-grid,
  .services-grid,
  .products-grid,
  .pricing-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  /* Feature cards */
  .feature-card {
    padding: 20px !important;
  }
  
  .feature-card h3 {
    font-size: 1.1rem !important;
  }
  
  .feature-card p {
    font-size: 0.9rem !important;
  }
  
  /* Agent cards */
  .agent-card {
    flex-direction: row !important;
    gap: 16px !important;
    padding: 16px !important;
  }
  
  .agent-icon {
    width: 48px !important;
    height: 48px !important;
    font-size: 24px !important;
  }
  
  /* Pricing cards */
  .pricing-card {
    padding: 24px 20px !important;
  }
  
  .pricing-amount {
    font-size: 2.5rem !important;
  }
  
  /* Footer */
  footer {
    padding: 32px 16px !important;
    margin-bottom: 80px;
  }
  
  footer .footer-content {
    flex-direction: column !important;
    gap: 24px !important;
    text-align: center !important;
  }
  
  /* Newsletter */
  .newsletter {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  .newsletter input,
  .newsletter button {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  /* Smaller screens */
  .hero h1 {
    font-size: 1.75rem !important;
  }
  
  .pricing-amount {
    font-size: 2rem !important;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  
  /* Start cards */
  .start-cards {
    gap: 8px !important;
  }
  
  .start-card {
    padding: 12px 14px !important;
  }
  
  .start-icon {
    font-size: 20px !important;
  }
  
  .start-content strong {
    font-size: 13px !important;
  }
  
  .start-content span {
    font-size: 11px !important;
  }
}

/* ========================================
   Touch Target Optimizations
   ======================================== */

@media (max-width: 768px) {
  /* Minimum touch target size */
  .btn,
  .nav a,
  .nav button,
  .feature-card,
  .agent-card,
  .pricing-card,
  .faq-item,
  .task-filter,
  .stage-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Form inputs */
  input,
  textarea,
  select {
    min-height: 44px;
    font-size: 16px !important; /* Prevent iOS zoom */
  }
  
  /* Active states for touch */
  .btn:active,
  .card:active,
  .agent-card:active,
  .pricing-card:active {
    transform: scale(0.97);
  }
}

/* ========================================
   Table Responsive
   ======================================== */

@media (max-width: 768px) {
  .comparison-table,
  .ability-table,
  .relationship-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  .comparison-table th,
  .comparison-table td,
  .ability-table th,
  .ability-table td {
    padding: 12px 8px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }
}

/* ========================================
   Modal/Overlay Optimizations
   ======================================== */

@media (max-width: 768px) {
  .modal-content {
    margin: 16px !important;
    padding: 24px 16px !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .role-card-content {
    max-width: 90% !important;
    padding: 20px !important;
  }
}

/* ========================================
   Image Optimizations
   ======================================== */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   Safe Area Support (iPhone X+) */
   ======================================== */

@supports (padding: max(0px)) {
  .header {
    padding-top: max(0px, env(safe-area-inset-top));
  }
  
  .mobile-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  
  main {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* ========================================
   Reduced Motion Support
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   Dark Mode Support
   ======================================== */

@media (prefers-color-scheme: dark) {
  /* Already dark by default */
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .header,
  .mobile-nav,
  .nav-toggle,
  .menu-toggle {
    display: none !important;
  }
  
  main {
    padding: 20px !important;
  }
}
