/* ============================================================
   /certificates page — light industrial, same brand system.
   Banner → breadcrumb → title → tabs+search → 4-col cards →
   pagination → CTA. Data lives in CMS certifications table.
   ============================================================ */

/* ---------- banner ---------- */
.cert-banner {
  position: relative;
  min-height: 240px;
  display: flex;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.72) 0%, rgba(17, 17, 17, 0.45) 55%, rgba(17, 17, 17, 0.25) 100%),
    url('/uploads/factory-banner.jpg') center 58% / cover no-repeat;
  color: #FFFFFF;
}
.crumbs {
  font-size: 12.5px;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
  opacity: 0.85;
}
.crumbs a { color: #FFFFFF; text-decoration: none; }
.crumbs a:hover { color: var(--yellow); text-decoration: underline; }
.crumb-here { color: var(--yellow); }
.cert-banner-title {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
}
.cert-banner-title em {
  display: block;
  font-style: normal;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--yellow);
  margin-top: 6px;
}
.cert-banner-sub { margin: 0; font-size: 14px; opacity: 0.9; }

/* ---------- title block ---------- */
.cert-page-head { padding: 52px 0 8px; text-align: center; }
.cert-h2 {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 700;
  color: #111111;
  letter-spacing: 0.5px;
}
.cert-h2sub { margin: 0 0 14px; font-size: 15px; color: #777777; letter-spacing: 0.4px; }
.cert-page-head .cert-rule {
  display: inline-block;
  width: 56px;
  height: 3px;
  background: var(--yellow);
}
.cert-intro {
  max-width: 800px;
  margin: 20px auto 0;
  font-size: 14px;
  line-height: 1.7;
  color: #666666;
}

/* ---------- filter bar ---------- */
.cert-filters-bar {
  border-top: 1px solid #F0F0EE;
  border-bottom: 1px solid #F0F0EE;
  background: #FCFCFB;
  position: sticky;
  top: var(--header-h, 64px);
  z-index: 50;
}
.cert-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0;
  min-height: 58px;
}
.cert-tabs {
  display: flex;
  align-items: center;
  gap: 26px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cert-tabs::-webkit-scrollbar { display: none; }
.cert-tab {
  position: relative;
  flex: 0 0 auto;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 18px 2px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: #555555;
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}
.cert-tab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--yellow);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.cert-tab:hover { color: #111111; }
.cert-tab.active { color: #000000; font-weight: 700; }
.cert-tab.active::after { transform: scaleX(1); }
.cert-tab .cnt { color: #AAAAAA; font-size: 11.5px; margin-left: 3px; }

.cert-search {
  position: relative;
  flex: 0 0 240px;
}
.cert-search svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: #999999;
  pointer-events: none;
}
.cert-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 32px;
  border: 1px solid #DDDDDD;
  border-radius: 3px;
  font-size: 13.5px;
  font-family: inherit;
  color: #222222;
  background: #FFFFFF;
  outline: none;
  transition: border-color 0.2s ease;
}
.cert-search input:focus { border-color: var(--yellow); }

/* ---------- grid ---------- */
.cert-page-grid-wrap { padding: 34px 0 26px; min-height: 420px; }
.cert-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.cert-item {
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 4px rgba(20, 20, 20, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cert-item:hover {
  transform: translateY(-3px);
  border-color: #D8D8D8;
  box-shadow: 0 10px 26px rgba(20, 20, 20, 0.09);
}
.cert-item-img {
  height: 230px;
  background: #F7F7F5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  cursor: zoom-in;
}
.cert-item-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}
.cert-item:hover .cert-item-img img { transform: scale(1.03); }
.cert-item-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
.cert-item-name { font-size: 15px; font-weight: 700; color: #111111; line-height: 1.3; }
.cert-item-en { font-size: 12.5px; color: #888888; }
.cert-item-meta { margin-top: 8px; font-size: 12.5px; color: #666666; line-height: 1.65; }
.cert-item-meta b { color: #444444; font-weight: 600; }
.cert-item-ops {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #F0F0EE;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cert-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid #DDDDDD;
  background: #FFFFFF;
  color: #333333;
  font-family: inherit;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.cert-btn:hover { border-color: var(--yellow); color: #000000; }
.cert-btn.primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #111111;
}
.cert-btn.primary:hover { background: #E6A900; border-color: #E6A900; }

/* ---------- empty / pager ---------- */
.cert-empty { text-align: center; padding: 70px 0 40px; color: #888888; font-size: 15px; }
.cert-empty p { margin: 0 0 16px; }
.cert-reset {
  padding: 9px 22px;
  background: var(--yellow);
  border: 0;
  border-radius: 3px;
  font-weight: 700;
  font-size: 13.5px;
  color: #111111;
  cursor: pointer;
  font-family: inherit;
}
.cert-reset:hover { background: #E6A900; }
.cert-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 26px 0 8px;
}
.cert-pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #DDDDDD;
  background: #FFFFFF;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  color: #444444;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.cert-pager button:hover:not(:disabled) { border-color: var(--yellow); }
.cert-pager button.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #111111;
  font-weight: 700;
}
.cert-pager button:disabled { opacity: 0.4; cursor: default; }
.cert-perpage { margin-left: 14px; font-size: 12.5px; color: #888888; display: flex; align-items: center; gap: 6px; }
.cert-perpage select {
  height: 30px;
  border: 1px solid #DDDDDD;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12.5px;
  padding: 0 6px;
  background: #FFFFFF;
}

/* ---------- CTA ---------- */
.cert-cta { background: #111111; padding: 34px 0; }
.cert-cta-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.cert-cta-text { color: #FFFFFF; font-size: 19px; font-weight: 700; letter-spacing: 0.4px; }
.cert-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 30px;
  background: var(--yellow);
  color: #111111;
  font-size: 14px;
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none;
  letter-spacing: 0.4px;
  transition: background 0.2s ease;
}
.cert-cta-btn:hover { background: #E6A900; }

/* ---------- modal ---------- */
.cert-modal {
  position: fixed;
  inset: 0;
  /* Must sit above the sticky header shell (z-index 9999). */
  z-index: 10050;
  display: none;
}
.cert-modal.open { display: block; }
.cert-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cert-modal-body {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 60px);
  background: #FFFFFF;
  border-radius: 5px;
  overflow: auto;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  padding: 26px 26px 22px;
}
.cert-modal.open .cert-modal-mask { opacity: 1; }
.cert-modal.open .cert-modal-body { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cert-modal-x {
  position: absolute;
  top: 10px; right: 12px;
  width: 34px; height: 34px;
  border: 0;
  background: #F2F2F0;
  border-radius: 3px;
  font-size: 20px;
  line-height: 1;
  color: #333333;
  cursor: pointer;
  z-index: 2;
}
.cert-modal-x:hover { background: var(--yellow); }
.cert-modal-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F7F7F5;
  border: 1px solid #EEEEEE;
  min-height: 300px;
}
.cert-modal-img-wrap img {
  max-width: 100%;
  max-height: 66vh;
  object-fit: contain;
  transition: transform 0.25s ease;
  cursor: zoom-in;
}
.cert-modal-img-wrap img.zoomed {
  max-width: none;
  max-height: none;
  transform: scale(1.6);
  cursor: zoom-out;
}
.cert-modal-meta { margin-top: 14px; font-size: 13.5px; color: #555555; line-height: 1.7; }
.cert-modal-meta b { color: #111111; font-size: 15px; display: block; margin-bottom: 4px; }
.cert-modal-ops { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .cert-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cert-filter-row { flex-direction: column; align-items: stretch; padding: 0 0 10px; }
  .cert-search { flex: 1 1 auto; }
  .cert-cta-row { flex-direction: column; text-align: center; }
}
@media (max-width: 560px) {
  .cert-grid { grid-template-columns: 1fr; }
  .cert-banner-title { font-size: 26px; }
  .cert-modal-body { width: calc(100vw - 24px); padding: 18px 14px 16px; }
}

/* ============================================================
   V2 — international certification logo wall
   (replaces the scan-grid: 4-col centered cards, logo + name)
   ============================================================ */
.cert-banner { min-height: 240px; }

/* tighter top whitespace: header → title ≈ 64px */
.cert-page-head { padding: 64px 0 8px; }

/* flex wall: last incomplete row stays centered, never stretched */
.cert-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 36px 8px;
}
.cert-grid .cert-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: calc((100% - 66px) / 4);
  min-height: 200px;
  padding: 22px 18px;
  background: #FFFFFF;
  border: 1px solid #E6E6E6;
  border-radius: 4px;
  box-sizing: border-box;
  cursor: default;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.cert-grid .cert-card:hover {
  transform: translateY(-2px);
  border-color: var(--yellow);
}
.cert-grid .cert-card-img {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  width: 100%;
}
.cert-grid .cert-card-img img {
  max-width: 150px;
  max-height: 110px;
  object-fit: contain;
  transition: transform 0.2s ease;
}
.cert-grid .cert-card:hover .cert-card-img img { transform: scale(1.03); }
.cert-grid .cert-card-name {
  font-size: 16px;
  font-weight: 600;
  color: #222222;
  text-align: center;
  line-height: 1.3;
  transition: color 0.2s ease;
}
.cert-grid .cert-card:hover .cert-card-name { color: var(--yellow); }
.cert-grid .cert-card-desc {
  font-size: 12.5px;
  color: #888888;
  text-align: center;
  line-height: 1.5;
  margin-top: -6px;
}
.cert-empty { text-align: center; color: #888888; padding: 40px 0 60px; }

/* responsive: tablet 2-col, mobile 2-col → 1-col when tight */
@media (max-width: 1100px) {
  .cert-grid .cert-card { width: calc((100% - 22px) / 2); }
}
@media (max-width: 480px) {
  .cert-grid { padding: 0 20px 8px; gap: 14px; }
  .cert-grid .cert-card { width: 100%; min-height: 170px; }
}
