/**
 * AI Automation Pro - Mobile Responsive Overrides
 * Optimized for performance and mobile touch experience
 */

/* ============================================
   MOBILE TYPOGRAPHY
   ============================================ */

@media (max-width: 767px) {
  .text-display {
    font-size: 2rem;
    line-height: 1.2;
  }

  .text-h1 {
    font-size: 1.75rem;
    line-height: 1.3;
  }

  .text-h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .text-h3 {
    font-size: 1.25rem;
    line-height: 1.4;
  }

  .text-h4 {
    font-size: 1.125rem;
    line-height: 1.4;
  }

  .text-body-lg {
    font-size: 1rem;
  }

  /* Hero typography */
  .hero-title {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
    padding-inline: 0 !important;
    margin-bottom: 1.5rem !important;
  }

  .hero-subtitle {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    padding-inline: 0 !important;
    margin-bottom: 2rem !important;
  }

  /* Reduce inline font sizes */
  div[style*="font-size: 2.5rem"],
  div[style*="font-size: 3rem"] {
    font-size: 2rem !important;
  }
}

/* ============================================
   MOBILE LAYOUT & STRUCTURE
   ============================================ */

@media (max-width: 767px) {
  /* Prevent horizontal overflow */
  body {
    max-width: 100vw;
  }

  /* Hero section */
  .hero {
    max-width: 100vw;
    padding-inline: 1rem;
  }

  .hero-content {
    padding-inline: 0.5rem !important;
  }

  .hero-cta {
    padding-inline: 0 !important;
  }

  /* Container and section spacing */
  .container {
    padding-inline: 1rem;
  }

  .section {
    padding-block: 3rem;
  }

  /* Cards */
  .card {
    padding: 1.5rem;
  }

  /* Grid layouts - convert to single column */
  .grid-cols-2,
  .grid-cols-3,
  .section .grid.grid-cols-3 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ============================================
   PAGE-SPECIFIC LAYOUTS
   ============================================ */

@media (max-width: 767px) {
  /* Home page - Services and testimonials */
  section[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(12, 1fr)"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  div[style*="grid-column: span"] {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  /* Home page - Timeline */
  .timeline-step {
    grid-template-columns: 50px 1fr !important;
    gap: 1rem !important;
    margin-bottom: 2rem !important;
  }

  .timeline-number {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.25rem !important;
  }

  .timeline-line {
    left: 24px !important;
    bottom: -32px !important;
  }

  /* Portfolio page - Grid layouts */
  div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 1.2fr 0.8fr"],
  div[style*="grid-template-columns: 0.8fr 1.2fr"],
  div[style*="grid-template-columns: repeat(2, 1fr)"],
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Portfolio page - Image aspect ratios */
  div[style*="aspect-ratio: 4/3"],
  div[style*="aspect-ratio: 21/9"] {
    aspect-ratio: 16/9 !important;
  }

  /* Stats grids - 2 columns on mobile */
  div[style*="display: grid"][style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Solutions page - Agent sections */
  section[style*="display: grid"][style*="align-items: center"] {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Sales agent - reverse order on mobile (text first, then benefits) */
  #sales-agent .grid > div[style*="order: 1"] {
    order: 2 !important;
  }

  #sales-agent .grid > div[style*="order: 2"] {
    order: 1 !important;
  }

  /* Benefits grid inside cards */
  .card div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }

  /* About page - Grids */
  .section .container > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  div[style*="grid-template-columns: repeat(6, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }
}

/* ============================================
   FOOTER
   ============================================ */

@media (max-width: 767px) {
  footer div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  footer div[style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: column !important;
    gap: 1rem !important;
    text-align: center;
  }
}

/* Footer background - applies to all screen sizes */
footer.section,
footer {
  background: var(--color-bg-deep) !important;
  position: relative !important;
  z-index: 1000 !important;
  overflow: hidden !important;
}

/* Remove any inherited background effects from footer */
footer::before,
footer::after,
footer .grid-background,
footer .tech-lines,
footer .hex-pattern,
footer canvas {
  display: none !important;
}

/* ============================================
   BUTTONS & INPUTS
   ============================================ */

@media (max-width: 767px) {
  .btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
  }

  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  .input-group {
    margin-bottom: 1.25rem;
  }
}

/* ============================================
   FEATURE ICONS
   ============================================ */

@media (max-width: 767px) {
  .feature-icon {
    width: 40px;
    height: 40px;
  }

  .feature-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* ============================================
   TOUCH & INTERACTION
   ============================================ */

@media (max-width: 767px) {
  /* Larger tap targets for better mobile UX */
  .btn,
  .nav-link,
  .link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Remove focus outlines on touch devices */
  *:focus:not(:focus-visible) {
    outline: none;
  }

  /* Ensure smooth scrolling and prevent zoom */
  body,
  html {
    touch-action: manipulation !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Optimize touch interaction for interactive elements */
  .card,
  .btn,
  .nav-link,
  .link {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }
}

/* ============================================
   PERFORMANCE - DISABLE HEAVY EFFECTS ON MOBILE
   ============================================ */

@media (max-width: 767px) {
  /* Hide all background effects for performance */
  .grid-background,
  .tech-lines,
  .hex-pattern,
  .gradient-orb,
  .gradient-orb-1,
  .gradient-orb-2,
  .gradient-orb-3,
  canvas {
    display: none !important;
  }

  /* Disable animations */
  .holographic,
  .glow-border,
  .neon-text,
  .scanline,
  .glitch,
  .rainbow-border,
  .pulse-ring,
  .data-stream {
    animation: none !important;
  }

  /* Disable transforms and transitions for performance */
  .hover-lift,
  .hover-lift:hover,
  .card-3d,
  .card-3d:hover,
  .card,
  .card:hover {
    transform: none !important;
    box-shadow: none !important;
    transition: none !important;
  }

  /* Simplify complex effects */
  .holographic {
    background: var(--color-bg-elevated) !important;
    animation: none !important;
  }

  .glow-border::before {
    display: none !important;
  }

  /* Disable parallax and scroll effects */
  .hero .gradient-orb {
    transform: none !important;
  }

  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .faq-item:hover {
    transform: none !important;
    border-color: var(--color-border-subtle) !important;
  }
}

/* Disable hover effects on touch devices */
@media (max-width: 767px) and (hover: none) {
  .hover-lift:hover {
    transform: none;
  }

  .card:hover {
    transform: none;
  }

  .card-glow:hover::before {
    opacity: 0.3;
  }
}

/* ============================================
   ACCESSIBILITY - REDUCE MOTION
   ============================================ */

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

  .gradient-orb,
  .hex-pattern,
  .tech-lines {
    display: none;
  }
}
