/* ============================================================
   middle.css — main content: layout grid, hero, right column,
   section headings, top categories, featured products, trust bar
   Markup: includes/middle.php
   ============================================================ */

/* ============ LAYOUT ============ */
.page { padding: 22px 0 0; }
.layout {
  display: grid; grid-template-columns: 252px minmax(0, 1fr) 368px; gap: 20px;
  align-items: start;
}

/* ---- Hero ---- */
.hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  align-self: start; min-height: 500px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    linear-gradient(100deg, rgba(15,23,42,.72) 0%, rgba(15,23,42,.45) 45%, rgba(15,23,42,.15) 100%),
    linear-gradient(180deg, #7896b8 0%, #e8a664 55%, #c96f3d 80%, #33445c 100%);
  color: #fff;
}
.hero-content { padding: 56px 48px 0; max-width: 560px; }
.hero h1 { font-size: 42px; line-height: 1.18; font-weight: 800; letter-spacing: -.5px; }
.hero h1 .accent { color: #60a5fa; }
.hero p { margin-top: 18px; font-size: 17px; line-height: 1.55; color: #e5e7eb; max-width: 340px; }
.hero-cta { margin-top: 26px; display: flex; gap: 14px; }
.hero-cta .primary {
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 12px 26px; font-size: 15px; font-weight: 600;
}
.hero-cta .secondary {
  background: rgba(255,255,255,.95); color: var(--text); border: none; border-radius: 8px;
  padding: 12px 26px; font-size: 15px; font-weight: 600;
}
.hero-stats {
  margin: 28px; background: rgba(10,15,30,.82); border-radius: var(--radius);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 20px 10px;
}
/* min-width:0 lets each column shrink below its content width; without it the
   4 columns refuse to shrink on mid-size screens and the grid overflows its
   box, clipping the last stat. */
.stat { display: flex; align-items: center; gap: 12px; padding: 0 18px; min-width: 0; }
.stat + .stat { border-left: 1px solid rgba(255,255,255,.12); }
.stat > div { min-width: 0; }
.stat .num { white-space: nowrap; }         /* keep "150,000+" on one line */
.stat .lbl { overflow-wrap: break-word; }   /* but let the label wrap instead of overflowing */
.stat .s-icon { font-size: 24px; flex-shrink: 0; line-height: 1; }
.stat .num { font-size: 20px; font-weight: 800; }
.stat .lbl { font-size: 12.5px; color: #cbd5e1; margin-top: 2px; }

/* ---- Right column ---- */
.side-card {
  background: #fff; border-radius: var(--radius); padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 18px;
}
.side-card .card-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.side-card .card-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.side-card .card-title.red { color: var(--red); }
.side-card .view-link { font-size: 13px; color: var(--blue); font-weight: 500; }

.em-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px; }
.em-item { text-align: center; font-size: 12px; color: var(--text); }
.em-item .circle {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.c-blue  { background: #e0ecff; }
.c-green { background: #dcfce7; }
.c-red   { background: #fee2e2; }
.c-navy  { background: #e0e7ff; }
.c-amber { background: #fef3c7; }
.c-cyan  { background: #cffafe; }
.c-orange{ background: #ffedd5; }
.c-gray  { background: #f3f4f6; }

.rfq-card { background: var(--green-bg); border: 1px solid #bbf7d0; }
.rfq-card .rfq-title { color: var(--green); font-weight: 700; font-size: 17px; }
.rfq-card .rfq-body { display: flex; gap: 14px; align-items: center; }
.rfq-card .rfq-body > div { flex: 1; min-width: 0; }
.rfq-card p { font-size: 13.5px; color: #374151; margin: 8px 0 14px; line-height: 1.5; }
.rfq-card .rfq-icon { font-size: 52px; flex-shrink: 0; line-height: 1; }
.rfq-btn {
  background: var(--green); color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
}

.company { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; color: inherit; text-decoration: none; }
.company:hover .c-name { color: var(--accent, #1d4ed8); }
.company:last-child { border-bottom: none; }
.company .logo {
  width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px;
}
.company .c-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.company .c-loc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.verified-tick { color: var(--green); font-size: 14px; }

/* ---- Sections ---- */
.section-title { font-size: 19px; font-weight: 700; color: var(--navy); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 16px; }
.section-head .view-link { font-size: 13.5px; color: var(--muted); }

.content-col { grid-column: 1 / 3; }
.full-col { grid-column: 1 / 3; }
.right-col { grid-column: 3; grid-row: 1 / span 3; align-self: start; }

/* Top categories */
.cat-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.cat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 8px 16px; text-align: center; transition: box-shadow .15s, border-color .15s;
}
.cat-card:hover { border-color: var(--blue); box-shadow: 0 4px 12px rgba(29,78,216,.10); }
.cat-card .cc-icon { font-size: 30px; color: var(--blue); }
/* nowrap keeps names on one line; overflow+ellipsis stops a long name from
   overflowing the card (and pushing the whole layout wider) on any screen. */
.cat-card .cc-name { font-size: 13.5px; font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-card.more { border-style: dashed; border-color: #c7d2fe; background: #f8faff; }
.cat-card.more .cc-icon { letter-spacing: 3px; }
.cat-card.more .cc-name { color: var(--blue); }
.cat-card.more:hover { background: #eff4ff; border-color: var(--blue); box-shadow: none; }

/* Featured products */
.product-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.product-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; transition: box-shadow .15s;
}
.product-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.product-img {
  height: 130px; border-radius: 8px; background: #f3f4f6;
  display: flex; align-items: center; justify-content: center; font-size: 52px;
}
.product-card .p-name { font-size: 14.5px; font-weight: 700; margin-top: 12px; }
.product-card .p-moq { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.product-card .p-price { font-size: 16px; font-weight: 800; color: var(--price); margin-top: 6px; }
.product-card .p-seller { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* Trust bar */
.trust-bar {
  background: #fff; border-radius: var(--radius); margin: 32px 0 40px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 22px 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
/* min-width:0 (here + on the text block below) lets the 5 columns shrink so
   the row never overflows and clips the last item — same fix as .hero-stats. */
.trust { display: flex; align-items: center; gap: 14px; padding: 0 22px; min-width: 0; }
.trust > div { min-width: 0; }
.trust + .trust { border-left: 1px solid var(--border); }
.trust .t-icon { font-size: 26px; color: var(--blue); }
.trust .t-title { font-size: 14.5px; font-weight: 700; }
.trust .t-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr 340px; }
  .content-col { grid-column: 1 / 2; }
  .full-col { grid-column: 1 / 2; }
  .right-col { grid-column: 2; grid-row: 1 / span 3; }
  .cat-cards { grid-template-columns: repeat(5, 1fr); }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .trust-bar { grid-template-columns: repeat(3, 1fr); gap: 16px 0; }
  .trust:nth-child(4) { border-left: none; }
  /* Hero shares width with the 340px right column here, so 4 stats get too
     tight — drop to a clean 2x2 grid so all four always show. */
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 18px 8px; }
  .stat + .stat { border-left: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .content-col { grid-column: auto; }
  .full-col { grid-column: auto; }
  .right-col { grid-column: auto; grid-row: auto; }

  /* Full-bleed hero: break out of the container's side padding, edge to edge */
  .hero {
    min-height: auto;
    width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
    border-radius: 0;
  }
  .hero h1 { font-size: 30px; }
  .hero-content { padding: 36px 24px 0; }
  .hero p { max-width: none; }
  .hero-stats { margin: 24px; grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .stat + .stat { border-left: none; }
  .cat-cards { grid-template-columns: repeat(3, 1fr); }
  .cat-card .cc-name { white-space: normal; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-bar { grid-template-columns: 1fr; }
  .trust + .trust { border-left: none; }
}

/* Small tablets / large phones */
@media (max-width: 600px) {
  .hero-content { padding: 30px 20px 0; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; margin-top: 14px; }
  .hero-cta { flex-wrap: wrap; }
  .hero-stats { margin: 18px; padding: 16px 8px; }
  .stat { padding: 0 10px; gap: 9px; }
  .stat .num { font-size: 17px; }
  .stat .lbl { font-size: 11.5px; }
  .cat-cards { grid-template-columns: repeat(2, 1fr); }
  .section-title { font-size: 17px; }
}

/* Small phones */
@media (max-width: 400px) {
  .product-grid { grid-template-columns: 1fr; gap: 10px; }
  .product-card { padding: 10px; }
  .product-img { height: 110px; font-size: 44px; }
  .em-grid { grid-template-columns: repeat(4, 1fr); gap: 12px 4px; }
}

/* Category directory: per-card item count (categories.php) */
.cat-card .cc-count { font-size: 12px; color: var(--muted); margin-top: 4px; }
