/* ============================================
   PHARMALINK B2B - RESPONSIVE STYLES
   ============================================ */

/* ---- Tablet (1024px and below) ---- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .cat-grid { grid-template-columns: repeat(6, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
  .footer-grid .footer-brand { grid-column: span 2; }
  .about-stats { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: repeat(3, 1fr); }
  .chairman-layout { grid-template-columns: 240px 1fr; gap: var(--space-xl); }
  .header-main-inner { gap: var(--space-md); }
  .mega-menu { min-width: 480px; }
}

/* ---- Small tablet / Large mobile (768px and below) ---- */
@media (max-width: 768px) {
  body {
    padding-top: var(--header-height-mobile);
    padding-bottom: var(--footer-mobile-h);
  }
  body.mobile-search-open {
    padding-top: calc(var(--header-height-mobile) + 56px);
  }

  /* Hide desktop, show mobile */
  #desktop-header { display: none !important; }
  #mobile-header { display: flex !important; }
  #mobile-footer-nav { display: flex !important; }

  /* Slider */
  .hero-slider { height: 280px; }
  .slide-headline { font-size: 1.4rem; }
  .slide-sub { display: none; }
  .slide-image-side { display: none; }
  .slide-inner { max-width: 100%; padding: 0 var(--space-lg); }
  .slide-actions { flex-direction: column; gap: var(--space-sm); }
  .slide-btn-primary, .slide-btn-outline { padding: 10px 20px; font-size: 0.875rem; }

  /* Mini banners */
  .mini-banners { grid-template-columns: 1fr; }

  /* Category grid */
  .cat-grid { grid-template-columns: repeat(4, 1fr); gap: var(--space-sm); }
  .cat-icon-wrap { width: 44px; height: 44px; font-size: 1.3rem; }
  .cat-card { padding: var(--space-md) var(--space-sm); }
  .cat-card span { font-size: 0.7rem; }

  /* Product layouts */
  .page-with-sidebar { grid-template-columns: 1fr; padding: var(--space-md); }
  .cat-sidebar {
    display: none;
  }
  .cat-sidebar.mobile-visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-sidebar);
    overflow-y: auto;
    background: var(--white);
    max-width: 320px;
    padding: var(--space-lg);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }
  .cat-sidebar.mobile-visible.open {
    transform: translateX(0);
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }

  /* Product detail */
  .product-detail-layout { grid-template-columns: 1fr; }
  .product-gallery { position: static; }

  /* About */
  .about-hero-content { grid-template-columns: 1fr; }
  .about-hero-img { order: -1; }
  .about-float-badge { bottom: -10px; left: 10px; }
  .about-stats { grid-template-columns: repeat(2, 1fr); }
  .mv-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .chairman-layout { grid-template-columns: 1fr; }

  /* Contact */
  .contact-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
  .footer-brand { grid-column: span 2; }
  .footer-newsletter-inner { flex-direction: column; }
  .newsletter-form { width: 100%; }

  /* Footer bottom */
  .footer-bottom-inner { flex-direction: column; text-align: center; }
  .footer-bottom-links { justify-content: center; flex-wrap: wrap; }

  /* Page hero */
  .page-hero { padding: var(--space-2xl) 0; }
  .page-hero h1 { font-size: 1.6rem; }

  /* Trust strip */
  .trust-strip-inner { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; gap: var(--space-lg); padding: 0 var(--space-md); }
  .trust-strip { padding: var(--space-sm) 0; }
  .trust-item { white-space: nowrap; }

  /* Sections */
  .section { padding: var(--space-2xl) 0; }
  .section-sm { padding: var(--space-xl) 0; }
  .container { padding: 0 var(--space-md); }

  /* Filter toolbar mobile */
  .products-toolbar { padding: var(--space-sm) var(--space-md); }
  .toolbar-left span:first-child { display: none; }

  /* Product card adjustments */
  .product-img-wrap { padding: var(--space-md); }
  .product-img-wrap img { height: 120px; }
  .product-body { padding: var(--space-sm); }
  .product-name { font-size: 0.82rem; }
  .price-current { font-size: 1rem; }

  /* Vendor steps */
  .vendor-steps { overflow-x: auto; }
  .vendor-step-label { font-size: 0.7rem; white-space: nowrap; }
  .vendor-step-divider { flex: 0 0 20px; }

  /* FAQ */
  .faq-categories { overflow-x: auto; flex-wrap: nowrap; padding-bottom: var(--space-sm); }
  .faq-cat-btn { flex-shrink: 0; }

  /* Back to top */
  #backToTop { bottom: calc(var(--footer-mobile-h) + 12px); }
}

/* ---- Mobile (480px and below) ---- */
@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { grid-column: span 1; }
  .about-stats { grid-template-columns: 1fr 1fr; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: var(--space-lg); }
  .stat-card h3 { font-size: 1.6rem; }

  .product-cta { flex-direction: column; }
  .product-cta .btn { width: 100%; }

  .gallery-main { padding: var(--space-lg); }
  .gallery-main img { max-height: 220px; }

  .chairman-layout { grid-template-columns: 1fr; }
  .chairman-photo { max-width: 200px; margin: 0 auto; }

  .vendor-form-body { padding: var(--space-lg); }
}

/* ---- Large screens ---- */
@media (min-width: 1400px) {
  .cat-grid { grid-template-columns: repeat(10, 1fr); }
}

/* ---- Mobile filter toggle button ---- */
.mobile-filter-btn {
  display: none;
}
@media (max-width: 768px) {
  .mobile-filter-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 16px;
    background: var(--white);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-full);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
  }
}

/* ---- Product tabs mobile ---- */
@media (max-width: 768px) {
  .tab-btn { padding: 12px 16px; font-size: 0.82rem; }
  .tab-content { padding: var(--space-md); }
  .product-tabs .tab-nav { overflow-x: auto; }
}

/* ---- Swipe hint for mobile sliders ---- */
@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-sm) !important;
  }
}

/* ---- Print ---- */
@media print {
  #desktop-header, #mobile-header, #mobile-footer-nav, .site-footer, #backToTop { display: none !important; }
  body { padding: 0; }
}

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