/* ============================================================
   XuanJi Technology - Global mobile adaptation
   Loaded after each page's own styles. Fixes phone browsing:
   fixed bottom contact bar / floating buttons overflow,
   grids, hero sizing, product modal, tabs, forms, horizontal scroll.
   ============================================================ */

/* Tablet / phone */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }
  img, iframe, video { max-width: 100%; }

  /* Header: give hamburger a comfortable tap area */
  .mobile-menu-btn { display: block; padding: 6px 10px; }
  nav { padding: 12px 0; }
  .logo { font-size: 1.25rem; }
  .lang-btn { padding: 7px 12px; font-size: 0.85rem; }

  /* Mobile nav dropdown (opened via hamburger) */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--card-bg, #112240);
    border-bottom: 1px solid var(--border-color, #1E3A5F);
    padding: 10px 20px 15px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .nav-links.active { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 12px 0; font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .lang-selector { margin: 12px 0 0; }
  .lang-dropdown { position: static; min-width: 100%; margin-top: 8px; }

  /* Hero */
  .hero {
    min-height: auto;
    padding: 110px 0 60px;
  }
  .hero h1, .hero-content h1 { font-size: 2rem !important; line-height: 1.25; margin-bottom: 16px; }
  .hero p, .hero-content p { font-size: 1rem !important; margin-bottom: 18px; }
  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }
  .hero-buttons .btn { width: 100%; text-align: center; padding: 14px 20px; }

  /* Sections */
  .section { padding: 50px 0 !important; }
  .section-title { margin-bottom: 35px; }
  .section-title h2 { font-size: 1.7rem; }
  .section-title p { font-size: 1rem; }
  .about-section { padding-top: 100px; }
  .about-section h2 { font-size: 1.9rem; }
  .about-section p { font-size: 1rem; }

  /* All multi-column grids -> single column */
  .industries,
  .features,
  .testimonial-grid,
  .footer-content,
  .categories,
  .advantages,
  .service-process,
  .certifications,
  .contact-info,
  .product-list,
  .product-grid,
  .news-grid,
  .case-studies-grid,
  .contact-container {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  #industry-contacts { grid-template-columns: 1fr !important; gap: 20px !important; padding: 25px !important; }

  /* Cards */
  .industry-card, .category-card { padding: 30px 22px; }
  .feature-card, .process-step, .cert-card, .contact-item { padding: 25px 20px; }
  .industry-card .icon, .feature-card .icon { font-size: 2.6rem; }

  /* Category / filter tabs: horizontal scroll instead of cramped wrap */
  .product-category-tabs,
  .category-filter {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-bottom: 25px;
    gap: 8px;
  }
  .tab-btn, .filter-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  /* Product detail modal -> full screen, stacked */
  .product-modal-overlay { padding: 0; align-items: stretch; }
  .product-modal {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .product-modal-content {
    grid-template-columns: 1fr !important;
    padding: 20px 18px 30px;
    gap: 18px;
  }
  .product-modal-image-wrapper { height: 240px !important; border-radius: 10px; }
  .product-modal-info h2 { font-size: 1.4rem; margin-bottom: 12px; }
  .product-modal-info .price { font-size: 1.1rem; margin-bottom: 12px; }
  .product-modal-info .category { margin-bottom: 12px; }
  .product-modal-info .specifications-content { padding: 15px; max-height: 220px; }
  .product-modal-close { top: 10px; right: 10px; width: 38px; height: 38px; }
  .image-lightbox img { max-width: 94%; max-height: 78%; }

  /* Inquiry form inside modal */
  #product-inquiry-form .form-group,
  #inquiry-form .form-row,
  .form-row { flex-direction: column; }
  #product-inquiry-form input,
  #product-inquiry-form textarea,
  #product-inquiry-form select { font-size: 16px; }

  /* Forms */
  .contact-form { padding: 25px 20px !important; border-radius: 15px; }
  .contact-container { padding-top: 100px !important; }
  .contact-info { padding: 20px; }
  /* 16px+ inputs prevent iOS auto-zoom on focus */
  input, textarea, select { font-size: 16px !important; }
  .btn { padding: 14px 26px; }

  /* Footer */
  footer { padding: 45px 0 25px; }
  .footer-content { gap: 28px; margin-bottom: 25px; }

  /* ---- Fixed floating elements (inline-styled) ---- */
  /* WhatsApp / Email float stack: compact round icon buttons, tucked to corner */
  body > div[style*="bottom: 30px"] {
    right: 12px !important;
    bottom: 12px !important;
    gap: 10px !important;
  }
  [data-whatsapp-bar], [data-email-bar] {
    padding: 13px !important;
    border-radius: 50% !important;
    gap: 0 !important;
    width: 52px;
    height: 52px;
    justify-content: center;
  }
  [data-whatsapp-bar] span:first-child, [data-email-bar] span:first-child { font-size: 1.4rem !important; }
  [data-whatsapp-bar] span:nth-child(2), [data-email-bar] span:nth-child(2) { display: none !important; }

  /* Bottom fixed "Need help?" contact bar: hide on phones
     (same contacts are reachable via FABs and the Contact page) */
  body > div[style*="bottom: 0; left: 0; right: 0"] { display: none !important; }

  /* Long strings/emails never cause horizontal scroll */
  p, a, li, td, th { word-break: break-word; }
}

/* Small phones */
@media (max-width: 480px) {
  .hero h1, .hero-content h1 { font-size: 1.6rem !important; }
  .section-title h2, .about-section h2 { font-size: 1.45rem; }
  .product-image-wrapper { height: 220px; }
  .container { padding: 0 15px; }
  [data-whatsapp-bar], [data-email-bar] { width: 46px; height: 46px; }
  [data-whatsapp-bar] span:first-child, [data-email-bar] span:first-child { font-size: 1.25rem !important; }
}
