/*
Theme Name: China Manufacturers Directory
Theme URI: https://cn-beta.china-manufacturers.net/
Author: China Manufacturers
Description: Search and directory theme for Chinese manufacturers.
Version: 1.0.0
Text Domain: cm-directory
*/

:root {
  --cm-bg: #f7f8fa;
  --cm-panel: #ffffff;
  --cm-text: #1f2933;
  --cm-muted: #5b6776;
  --cm-line: #d8dee8;
  --cm-soft: #eef2f6;
  --cm-blue: #1769aa;
  --cm-green: #16735a;
  --cm-amber: #996515;
  --cm-red: #9b3f3f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--cm-bg);
  color: var(--cm-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
}
a { color: var(--cm-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(23, 105, 170, .25);
  outline-offset: 2px;
}
.cm-wrap { margin: 0 auto; max-width: 1320px; }
.cm-search-header, .cm-page-header {
  background: var(--cm-panel);
  border-bottom: 1px solid var(--cm-line);
  padding: 18px 20px 14px;
}
.cm-search-header { position: sticky; top: 0; z-index: 20; }
.admin-bar .cm-search-header { top: 32px; }
.cm-page-header h1, .cm-search-header h1 {
  font-size: 25px;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0;
}
.cm-topline {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cm-count, .cm-muted, .cm-list-summary { color: var(--cm-muted); font-size: 14px; }
.cm-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(260px, 1fr) auto auto;
}
.cm-controls input, .cm-controls select, .cm-controls button,
.cm-term-search input, .cm-term-search button, .cm-button {
  background: #fff;
  border: 1px solid var(--cm-line);
  border-radius: 6px;
  color: var(--cm-text);
  min-height: 40px;
}
.cm-controls input, .cm-term-search input { padding: 0 12px; width: 100%; }
.cm-controls select { padding: 0 10px; }
.cm-controls button, .cm-term-search button, button.cm-button { cursor: pointer; padding: 0 13px; }
.cm-controls button:hover, .cm-term-search button:hover, .cm-button:hover { border-color: #9fb3c8; text-decoration: none; }
.cm-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
}
.cm-quick-links a { font-size: 14px; }
.cm-main { padding: 18px 20px 38px; }
.cm-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 280px minmax(0, 1fr);
}
.cm-sidebar {
  align-self: start;
  background: var(--cm-panel);
  border: 1px solid var(--cm-line);
  border-radius: 6px;
  max-height: calc(100vh - 134px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  position: sticky;
  scrollbar-color: #aab6c3 var(--cm-soft);
  scrollbar-width: thin;
  top: 116px;
}
.single .cm-sidebar, .tax-cm_category .cm-sidebar, .tax-cm_tag .cm-sidebar, .tax-cm_product .cm-sidebar { top: 14px; }
.admin-bar .cm-sidebar { top: 148px; }
.admin-bar.single .cm-sidebar, .admin-bar.tax-cm_category .cm-sidebar, .admin-bar.tax-cm_tag .cm-sidebar, .admin-bar.tax-cm_product .cm-sidebar { top: 46px; }
.cm-sidebar::-webkit-scrollbar { width: 10px; }
.cm-sidebar::-webkit-scrollbar-thumb { background: #aab6c3; border: 2px solid var(--cm-soft); border-radius: 6px; }
.cm-sidebar h2 { font-size: 17px; margin: 0 0 11px; }
.cm-filter-group { margin-top: 18px; }
.cm-filter-group h3, .cm-field h3 {
  color: var(--cm-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
}
.cm-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.cm-chip {
  background: var(--cm-soft);
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--cm-text);
  display: inline-block;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  padding: 4px 8px;
}
.cm-chip:hover { border-color: #c0ccd8; text-decoration: none; }
.cm-chip.active {
  background: #e8f2fb;
  border-color: #95badb;
  color: #0f4f84;
  font-weight: 700;
}
.cm-result-area, .cm-detail-column { min-width: 0; }
.cm-result-anchor { height: 1px; scroll-margin-top: 132px; }
.cm-results { align-content: start; display: grid; gap: 14px; }
.cm-pager {
  align-items: center;
  color: var(--cm-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
  min-height: 42px;
}
.cm-pager.bottom { margin: 14px 0 0; }
.cm-pager-controls { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.cm-page-size { align-items: center; display: flex; gap: 6px; }
.cm-page-size select { background: #fff; border: 1px solid var(--cm-line); border-radius: 6px; min-height: 38px; padding: 0 8px; }
.cm-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  padding: 7px 12px;
}
.cm-button.disabled { color: #9aa4b2; cursor: not-allowed; pointer-events: none; }
.cm-company {
  align-self: start;
  background: var(--cm-panel);
  border: 1px solid var(--cm-line);
  border-radius: 6px;
  padding: 16px;
}
.cm-company-head {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cm-company h2 { font-size: 20px; letter-spacing: 0; line-height: 1.3; margin: 0; }
.cm-company h2 > a { color: var(--cm-text); }
.cm-company h2 > a:hover { color: var(--cm-blue); }
.cm-company h2 span {
  color: var(--cm-muted);
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-top: 3px;
}
.cm-company h2 span a { color: var(--cm-muted); }
.cm-company-actions { align-items: flex-end; display: flex; flex-direction: column; gap: 8px; }
.cm-detail-link { font-size: 13px; white-space: nowrap; }
.cm-badge {
  border-radius: 5px;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}
.cm-badge.product { background: #e9f6f2; color: var(--cm-green); }
.cm-badge.engineering { background: #fff4dd; color: var(--cm-amber); }
.cm-badge.mixed { background: #f0eef8; color: #604f8a; }
.cm-badge.review { background: var(--cm-soft); color: var(--cm-muted); }
.cm-columns { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cm-meta {
  border-top: 1px solid var(--cm-soft);
  color: var(--cm-muted);
  font-size: 13px;
  margin-top: 12px;
  overflow-wrap: anywhere;
  padding-top: 10px;
}
mark { background: #fff1a8; border-radius: 3px; padding: 0 2px; }
.cm-empty {
  background: var(--cm-panel);
  border: 1px solid var(--cm-line);
  border-radius: 6px;
  color: var(--cm-muted);
  padding: 24px;
  text-align: center;
}
.cm-section {
  background: var(--cm-panel);
  border: 1px solid var(--cm-line);
  border-radius: 6px;
  padding: 16px;
}
.cm-kv { border-collapse: collapse; margin-top: 12px; width: 100%; }
.cm-kv th, .cm-kv td {
  border-top: 1px solid var(--cm-soft);
  overflow-wrap: anywhere;
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}
.cm-kv th { color: var(--cm-muted); font-size: 14px; font-weight: 700; width: 180px; }
.cm-machine-link { color: var(--cm-muted); font-size: 13px; margin-top: 12px; text-align: right; }
.cm-page-content { min-height: 200px; }
.cm-term-search { display: grid; gap: 8px; grid-template-columns: minmax(220px, 520px) auto; margin-bottom: 14px; }
.cm-term-list, .cm-link-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin-top: 12px;
}
.cm-term-list a, .cm-link-list a {
  align-items: start;
  background: #fff;
  border: 1px solid var(--cm-line);
  border-radius: 6px;
  color: var(--cm-text);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 46px;
  padding: 9px 11px;
}
.cm-term-list a:hover, .cm-link-list a:hover { border-color: #9fb3c8; text-decoration: none; }
.cm-term-list strong { color: var(--cm-muted); font-size: 13px; }
.cm-link-list a { display: block; }
.cm-link-list a span { color: var(--cm-muted); display: block; font-size: 12px; margin-top: 3px; }
.cm-pagination { margin-top: 18px; }
.cm-pagination .page-numbers {
  background: #fff;
  border: 1px solid var(--cm-line);
  border-radius: 5px;
  display: inline-block;
  margin: 2px;
  padding: 6px 10px;
}
.cm-pagination .current { background: #e8f2fb; border-color: #95badb; color: #0f4f84; }
.cm-footer { border-top: 1px solid var(--cm-line); color: var(--cm-muted); font-size: 13px; padding: 18px 20px 28px; }
.cm-footer .cm-wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; }

@media (max-width: 900px) {
  .admin-bar .cm-search-header { top: 46px; }
  .cm-search-header { position: static; }
  .cm-controls { grid-template-columns: 1fr; }
  .cm-layout { grid-template-columns: 1fr; }
  .cm-sidebar, .single .cm-sidebar, .tax-cm_category .cm-sidebar, .tax-cm_tag .cm-sidebar, .tax-cm_product .cm-sidebar {
    max-height: 48vh;
    position: static;
  }
  .cm-columns { grid-template-columns: 1fr; }
  .cm-company-head { display: block; }
  .cm-company-actions { align-items: flex-start; margin-top: 9px; }
  .cm-kv th { width: 135px; }
}

@media (max-width: 560px) {
  .cm-search-header, .cm-page-header { padding: 15px 14px 12px; }
  .cm-main { padding: 14px 12px 28px; }
  .cm-page-header h1, .cm-search-header h1 { font-size: 22px; }
  .cm-company { padding: 13px; }
  .cm-kv, .cm-kv tbody, .cm-kv tr, .cm-kv th, .cm-kv td { display: block; width: 100%; }
  .cm-kv th { border-bottom: 0; padding-bottom: 2px; }
  .cm-kv td { border-top: 0; padding-top: 2px; }
  .cm-term-search { grid-template-columns: 1fr; }
}
