/* =================================================================
   RESPONSIVE — tecnicaindustriale.org
   Mobile-first. One source of truth for all breakpoints.

   xs  : ≤ 480px   — small phones
   sm  : 481–640px  — large phones / landscape
   md  : 641–768px  — small tablets
   lg  : 769–1024px — tablets / small laptops
   xl  : 1025–1280px — laptops
   ================================================================= */

/* ── GLOBAL ──────────────────────────────────────────────────────── */

html, body { overflow-x: hidden; }
img { max-width: 100%; height: auto; }

/* Prevent iOS auto-zoom on input focus (needs font-size ≥ 16px) */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}

/* ── URGENCY BAR ─────────────────────────────────────────────────── */

/* ≤ 640px: single row, hide last 2 children (sep + last item) */
@media (max-width: 640px) {
  .urgency-bar { padding: 6px 8px; }
  .urgency-bar-inner { flex-wrap: nowrap; overflow: hidden; }
  .urgency-sep:nth-of-type(n+3),
  .urgency-item:nth-of-type(n+3) { display: none; }
  .urgency-item { padding: 0 6px; font-size: .72rem; }
}

/* ── HEADER ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .header-inner { padding: 0 10px; gap: 6px; }
  .header-logo img { height: 30px; }
  .header-phone { display: none !important; }
}

/* ── NAV BAR — hamburger mobile menu ─────────────────────────────── */

@media (max-width: 768px) {
  .nav-bar.open .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    min-height: 44px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    width: 100%;
    border-radius: 0;
  }
  .nav-bar.open .nav-link:last-child { border-bottom: none; }
}

/* ── HERO ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .site-hero { padding: 32px 16px; }
  .hero-label { font-size: .75rem; margin-bottom: 8px; }
  .hero-sub { font-size: .9rem; padding: 0 4px; }
  .hero-cta-row {
    flex-direction: column;
    align-items: stretch;
    padding: 0 4px;
    gap: 10px;
  }
  .hero-cta-row .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .site-hero h1 { font-size: clamp(1.35rem, 7.5vw, 2rem); line-height: 1.15; }
  .hero-search-wrap { flex-direction: column; gap: 0; }
  .hero-search-wrap input {
    border-radius: 6px 6px 0 0 !important;
    border-bottom: none !important;
  }
  .hero-search-wrap button {
    border-radius: 0 0 6px 6px !important;
    width: 100%;
  }
}

/* ── PRODUCT DETAIL GRID ─────────────────────────────────────────── */
/*
   Replaces the inline style="display:grid;grid-template-columns:1fr 1fr;..."
   on .product-detail-grid in product.php
*/
.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

@media (max-width: 768px) {
  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ── PRODUCT TRUST GRID ──────────────────────────────────────────── */
/*
   Replaces inline style="display:grid;grid-template-columns:repeat(3,1fr);
   gap:16px;margin-top:40px;padding-top:32px;border-top:1px solid #eee"
   on .product-trust-grid in product.php
*/
.product-trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid #eee;
}

@media (max-width: 768px) {
  .product-trust-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 480px) {
  .product-trust-grid { grid-template-columns: 1fr; gap: 10px; }
}

/* ── RFQ TRUST GRID ──────────────────────────────────────────────── */
/*
   Replaces inline style="display:grid;grid-template-columns:repeat(3,1fr);
   gap:12px;margin-bottom:36px" on .rfq-trust-grid in rfq.php
*/
.rfq-trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}

@media (max-width: 640px) {
  .rfq-trust-grid { grid-template-columns: 1fr; gap: 8px; }
}

/* ── RFQ FORM GRID ───────────────────────────────────────────────── */
/*
   Replaces inline style="display:grid;grid-template-columns:1fr 1fr;gap:16px"
   on .rfq-form-grid in rfq.php
*/
.rfq-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .rfq-form-grid { grid-template-columns: 1fr; }
}

/* ── RFQ PRODUCT TABLE — overflow scroll on mobile ───────────────── */

#rfq-items-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .rfq-product-table { min-width: 480px; font-size: .78rem; }
  .rfq-product-table td,
  .rfq-product-table th { padding: 7px 8px; }
}

/* ── SEARCH FORM ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
  form[action="/cerca/"] { flex-direction: column !important; }
  form[action="/cerca/"] .btn { width: 100%; border-radius: 0 0 6px 6px !important; }
  form[action="/cerca/"] input {
    border-radius: 6px 6px 0 0 !important;
    border-bottom: none !important;
  }
}

/* ── PAGINATION ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  nav.pagination { gap: 3px; }
  nav.pagination .btn,
  nav.pagination span { min-width: 30px; height: 30px; font-size: .75rem; padding: 0 5px; }
}

/* ── TOUCH TARGETS — minimum 44 × 44 px ─────────────────────────── */

@media (max-width: 768px) {
  .btn:not(.btn-sm) { min-height: 44px; }
  .hamburger { padding: 10px; }
  .add-rfq-btn {
    min-height: 38px;
    padding: 8px 14px;
    font-size: .8rem;
  }
  .product-card-actions { gap: 10px; padding: 10px 14px; }
}

/* ── PRODUCT LISTING padding ─────────────────────────────────────── */

@media (max-width: 480px) {
  .product-listing { padding: 12px !important; }
}

/* ── PRODUCT GRID — 1 column on very small phones ────────────────── */

@media (max-width: 380px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ── CATEGORY GRID — 1 column on tiny screens ───────────────────── */

@media (max-width: 360px) {
  .category-grid { grid-template-columns: 1fr; }
}

/* ── BREADCRUMBS ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .breadcrumbs-inner { font-size: .72rem; gap: 4px; padding: 8px 12px; }
}

/* ── SECTION TITLE ───────────────────────────────────────────────── */

@media (max-width: 480px) {
  .section-title { font-size: 1.1rem; padding: 22px 0 14px; }
}

/* ── FOOTER ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 28px 16px 20px;
  }
  .footer-brands { flex-direction: column; gap: 8px; padding: 14px 16px; }
  .footer-bottom { padding: 12px 16px; font-size: .75rem; }
  .footer-legal { gap: 10px; flex-wrap: wrap; justify-content: center; }
  .brand-disclaimer { font-size: .67rem; padding: 8px 16px; }
}

/* ── FLOATING RFQ — compact on small phones ─────────────────────── */

@media (max-width: 480px) {
  #rfq-float-widget { bottom: 14px; right: 12px; }
  .rfq-float-btn { padding: 10px 14px; font-size: .82rem; gap: 6px; }
  /* Hide text label, show only icon + count */
  .rfq-float-label { display: none; }
}

/* ── HOME TRUST BAR (inline flex items) ─────────────────────────── */

@media (max-width: 640px) {
  /* Items have flex:1;min-width:160px → 2 per row on ≥ 320px */
  /* Reduce min-width on tiny screens to keep 2 columns */
  #trust-bar-inner-home > div { min-width: 130px; padding: 8px 12px; }
}

/* ── RFQ PAGE container ──────────────────────────────────────────── */

@media (max-width: 480px) {
  .product-listing[style] { padding: 16px 12px !important; }
}

/* ── HOME brands section ─────────────────────────────────────────── */

@media (max-width: 480px) {
  .home-brands { padding: 28px 12px; }
}

/* ── Tablet adjustments (769–1024px) ────────────────────────────── */

@media (min-width: 769px) and (max-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* ── Large screens (≥ 1440px) ───────────────────────────────────── */

@media (min-width: 1440px) {
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ── BRAND LOGO (Chiaravalli) ────────────────────────────────────── */

.brand-logo-chi {
  height: 28px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.brand-logo-chi:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .brand-logo-chi {
    height: 22px;
    margin-left: 6px;
  }
}

@media (max-width: 480px) {
  .brand-logo-chi {
    height: 18px;
    margin-left: 4px;
  }
}
