/* ============================================================
   HK ACE Components Limited — Shared Stylesheet
   Slogan: Bridging Supply Gaps Across Borders
   ============================================================ */

:root {
  --primary:       #0a1f3f;   /* deep navy */
  --primary-light: #152d58;
  --accent:        #d4a843;   /* gold */
  --accent-light:  #f0d78c;
  --bg:            #f7f8fa;
  --surface:       #ffffff;
  --text:          #1a1a2e;
  --text-muted:    #5a6072;
  --border:        #dde1e8;
  --success:       #2e7d32;
  --warning:       #e65100;
  --danger:        #c62828;
  --info:          #0d47a1;
  --radius:        6px;
  --shadow:        0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:     0 6px 28px rgba(0,0,0,.12);
  --font:          "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-cn:       "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --max-w:         1240px;
  --header-h:      64px;
  --transition:    0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.lang-cn { font-family: var(--font-cn), var(--font); }

/* ---- HEADER ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.logo-mark {
  width: 5px; height: 42px; background: var(--accent); border-radius: 3px;
  flex-shrink: 0;
}
.logo-text { display: flex; flex-direction: column; }
.logo-text .brand {
  font-size: 1.15rem; font-weight: 800; color: var(--primary);
  letter-spacing: 0.5px; line-height: 1.2;
}
.logo-text .brand span { color: var(--accent); }
.logo-text .sub {
  font-size: .55rem; font-weight: 600; color: var(--primary-light);
  letter-spacing: 4px; line-height: 1;
}
.logo-text .slogan {
  font-size: .6rem; font-weight: 400; color: var(--text-muted);
  letter-spacing: 0.3px; margin-top: 2px;
}

.nav a {
  color: var(--text); text-decoration: none; padding: 6px 14px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; transition: background var(--transition), color var(--transition);
}
.nav a:hover, .nav a.active { background: var(--primary); color: #fff; }
.lang-toggle {
  margin-left: 14px; cursor: pointer; font-size: .8rem; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 20px; background: none; color: var(--text);
  transition: all var(--transition);
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff; text-align: center; padding: 60px 20px 50px;
}
.hero h1 { font-size: 2.6rem; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.5px; }
.hero .subtitle { font-size: 1.2rem; color: var(--accent-light); margin-bottom: 32px; }

/* ---- SEARCH BAR ---- */
.search-bar-wrap { max-width: 700px; margin: 0 auto; }
.search-bar {
  display: flex; background: #fff; border-radius: 40px; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.search-bar input {
  flex: 1; border: none; padding: 16px 24px; font-size: 1.05rem; outline: none;
  color: var(--text);
}
.search-bar input::placeholder { color: #999; }
.search-bar button {
  background: var(--accent); color: #fff; border: none; padding: 16px 36px;
  font-size: 1.05rem; font-weight: 600; cursor: pointer; transition: background var(--transition);
  white-space: nowrap;
}
.search-bar button:hover { background: #bf8e2e; }

/* ---- SECTION ---- */
.section {
  max-width: var(--max-w); margin: 0 auto; padding: 48px 24px;
}
.section-title {
  font-size: 1.8rem; font-weight: 700; color: var(--primary);
  margin-bottom: 12px; padding-bottom: 14px; border-bottom: 3px solid var(--accent);
  display: inline-block;
}
.section-desc { color: var(--text-muted); margin-bottom: 24px; font-size: .95rem; }

/* ---- CARDS ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 20px; }
.card {
  background: var(--surface); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card h3 { font-size: 1.05rem; margin-bottom: 8px; color: var(--primary); }
.card p { font-size: .875rem; color: var(--text-muted); line-height: 1.5; }
.card .cta {
  display: inline-block; margin-top: 12px; padding: 8px 20px;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  text-decoration: none; font-weight: 600; font-size: .85rem; transition: background var(--transition);
}
.card .cta:hover { background: #bf8e2e; }

/* ---- SERVICE FEATURE LIST ---- */
.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li {
  padding: 8px 0 8px 28px; position: relative; font-size: .92rem; color: var(--text);
}
.feature-list li::before {
  content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700;
}

/* ---- HOT MPN TABLE ---- */
.hot-mpn-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.hot-mpn-table th {
  background: var(--primary); color: #fff; padding: 12px 16px;
  text-align: center !important; vertical-align: middle !important; font-weight: 600; white-space: nowrap; font-size: .9rem;
}
.hot-mpn-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: center !important; vertical-align: middle !important; }
.hot-mpn-table tr:nth-child(even) { background: #f9fafb; }
.hot-mpn-table tr:hover { background: #eef2f7; }
.hot-mpn-table a { color: var(--info); text-decoration: none; font-weight: 500; }
.hot-mpn-table a:hover { text-decoration: underline; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 600;
}
.badge-green { background: #e8f5e9; color: var(--success); }
.badge-amber { background: #fff3e0; color: var(--warning); }
.badge-blue  { background: #e3f2fd; color: #1565c0; }

/* ---- DETAIL TABLE (search results) ---- */
.detail-table-wrap { overflow-x: auto; }
.detail-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 900px; }
.detail-table th, .detail-table td {
  padding: 8px 12px; border: 1px solid var(--border); text-align: left;
  vertical-align: top;
}
.detail-table th {
  background: var(--primary-light); color: #fff; font-weight: 600; white-space: nowrap;
}
.detail-table tr:nth-child(even) { background: #f9fafb; }
.detail-table .field-group-header {
  background: var(--accent); color: #fff; font-weight: 700; font-size: .88rem;
}

.detail-table .group-hdr {
  background: var(--primary-light); color: #fff; font-weight: 700; font-size: .88rem;
}

.detail-table tr.group-hdr:nth-child(even) {
  background: var(--primary-light); color: #fff;
}

.detail-table .group-hdr td {
  padding: 6px 12px; text-transform: none;
}

.detail-table .na-row td {
  color: var(--text-muted); font-style: italic;
}

/* ---- FORMS ---- */
.form-card {
  background: var(--surface); border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow); max-width: 720px; margin: 0 auto;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .88rem; }
.form-group label .optional { font-weight: 400; color: var(--text-muted); font-style: italic; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .92rem; font-family: inherit; transition: border-color var(--transition);
  background: #fafbfc;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,168,67,.15);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Custom file input */
.custom-file { display: flex; align-items: center; gap: 12px; }
.custom-file input[type="file"] { display: none; }
.file-btn {
  display: inline-block; padding: 10px 20px; background: var(--primary);
  color: #fff; border-radius: var(--radius); cursor: pointer; font-size: .9rem;
  font-weight: 500; transition: background var(--transition);
}
.file-btn:hover { background: #1a3a6b; }
.file-name { font-size: .88rem; color: var(--text-muted); }

.btn {
  display: inline-block; padding: 12px 32px; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none;
  border: none; transition: all var(--transition); text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #bf8e2e; transform: translateY(-1px); }
.btn-secondary { background: var(--primary); color: #fff; }
.btn-secondary:hover { background: var(--primary-light); }
.btn-outline { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-lg { padding: 16px 48px; font-size: 1.05rem; }

.btn-rfq {
  position: fixed; bottom: 64px; right: 24px; z-index: 50;
  background: var(--accent); color: #fff; padding: 8px 18px; border-radius: 40px;
  font-size: .82rem; font-weight: 700; text-decoration: none; border: none;
  display: inline-flex; align-items: center;
  box-shadow: 0 4px 20px rgba(212,168,67,.45); transition: all var(--transition);
}
.btn-rfq:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(212,168,67,.6); }

/* ---- CTA BANNER ---- */
.cta-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #1a3a6b 100%);
  color: #fff; text-align: center; padding: 40px 20px; border-radius: var(--radius);
  margin: 40px auto;
}
.cta-banner h2 { font-size: 1.5rem; margin-bottom: 10px; }
.cta-banner p { color: var(--accent-light); margin-bottom: 20px; }
.highlight-banner {
  padding: 16px 24px; margin: 12px auto 24px auto; font-size: 1rem; font-weight: 600;
  background: var(--accent); color: #fff;
  text-align: center; border-radius: var(--radius);
}

/* ---- HIGHLIGHT TAGS ---- */
.hl-tag {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 4px 14px; border-radius: 20px; font-weight: 600;
  font-size: .88rem; margin: 2px 4px;
}

/* ---- FOOTER ---- */
.site-footer {
  background: var(--primary); color: #ccc; text-align: center; padding: 24px 20px;
  margin-top: auto; font-size: .82rem;
}
.site-footer .contact-info { margin-bottom: 8px; color: #aaa; }
.site-footer strong { color: var(--accent-light); }

/* ---- HAMBURGER MENU (mobile-only) ---- */
.nav-toggle-check { display: none; }
.nav-toggle-btn  { display: none; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  /* === HEADER & NAV === */
  .site-header {
    position: relative; /* not sticky — scrolls with pinch-zoom */
  }
  .header-inner {
    flex-wrap: nowrap;
    position: relative;
    max-width: 100%;
  }
  .logo-text .brand { font-size: 1rem; }
  .logo-text .sub   { font-size: .5rem; letter-spacing: 2px; }
  .logo-text .slogan { display: none; }
  .logo-mark { height: 32px; }

  /* Hamburger button */
  .nav-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    font-size: 1.5rem; line-height: 1;
    cursor: pointer;
    color: var(--primary);
    user-select: none;
    flex-shrink: 0;
    margin-left: auto;
    border-radius: var(--radius);
    transition: background var(--transition);
  }
  .nav-toggle-btn:hover { background: #f0f2f5; }

  /* Nav dropdown */
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 8px 0;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 99;
    border: 1px solid var(--border);
    border-top: none;
  }
  .nav-toggle-check:checked ~ .nav { display: flex; }

  .nav a {
    padding: 14px 24px;
    border-radius: 0;
    font-size: .95rem;
    border-bottom: 1px solid #f0f2f5;
    white-space: nowrap;
  }
  .nav a:last-child { border-bottom: none; }

  /* Lang button inside dropdown — full-width */
  .nav .lang-btn {
    margin: 8px 20px 8px;
    border-radius: var(--radius);
    padding: 10px;
    font-size: .9rem;
    text-align: center;
  }

  /* === HERO === */
  .hero { padding: 36px 16px 32px; }
  .hero h1 { font-size: 1.35rem; }
  .hero .subtitle { font-size: .9rem; margin-bottom: 24px; }

  /* === SEARCH === */
  .search-bar-wrap { max-width: 100%; }
  .search-bar { flex-direction: column; border-radius: var(--radius); }
  .search-bar input { border-radius: var(--radius) var(--radius) 0 0; padding: 12px 16px; font-size: .95rem; }
  .search-bar button { border-radius: 0 0 var(--radius) var(--radius); padding: 12px 16px; font-size: .9rem; }

  /* === TYPOGRAPHY === */
  .section { padding: 32px 16px; max-width: 100%; }
  .section-title { font-size: 1.3rem; }

  /* === TABLES === */
  .hot-mpn-table { font-size: .72rem; }
  .hot-mpn-table th, .hot-mpn-table td { padding: 6px 8px; }
  .detail-table { font-size: .72rem; min-width: 700px; }
  .detail-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }

  /* === HL TAGS (Hot Selling badges) === */
  .hl-tag {
    font-size: .72rem !important;
    padding: 4px 10px !important;
    margin: 2px 3px !important;
  }
  .section-desc .hl-tag { font-size: .72rem !important; padding: 4px 10px !important; }

  /* === CARDS === */
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 18px; }

  /* === FORMS === */
  .form-card { padding: 20px; border-radius: var(--radius); }
  .form-row { grid-template-columns: 1fr; }
  .form-group input, .form-group textarea, .form-group select {
    padding: 12px 14px;
    font-size: 1rem; /* prevent iOS zoom on focus */
  }

  /* === BUTTONS & TOUCH === */
  .btn { padding: 12px 24px; min-height: 44px; }
  .btn-rfq { bottom: 16px; right: 16px; font-size: .85rem; padding: 12px 22px; }
  a, button, .lang-btn, [role="button"] { min-height: 44px; display: inline-flex; align-items: center; }

  /* === FLOATING ELEMENTS === */
  .chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 90px; }
  .chat-launcher { bottom: 14px; right: 14px; padding: 8px 16px; font-size: .78rem; }
  .btn-rfq { bottom: 56px; right: 14px; font-size: .78rem; padding: 8px 16px; }

  /* === CTA BANNER === */
  .cta-banner { padding: 28px 16px; margin: 24px 0; border-radius: 0; }
  .cta-banner h2 { font-size: 1.15rem; }

  /* === INLINE STYLE OVERRIDES === */
  div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* === FOOTER === */
  .site-footer { padding: 20px 16px; font-size: .75rem; }
}

/* ---- LANGUAGE ---- */
.lang-en .lang-cn-only { display: none !important; }
.lang-cn .lang-en-only { display: none !important; }

/* Lang toggle button */
/* CN temporarily hidden — uncomment to re-enable */
.lang-btn {
  display: none !important;
  background: var(--accent); color: #fff; border: none;
  padding: 6px 16px; border-radius: 20px; font-size: .78rem;
  font-weight: 600; cursor: pointer; transition: background var(--transition);
  margin-left: 8px;
}
.lang-btn:hover { background: #bf8e2e; }

/* ---- UTILITY ---- */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  font-size: .78rem; font-weight: 500;
}
.pill-yes { background: #e8f5e9; color: #2e7d32; }
.pill-no  { background: #fce4ec; color: #c62828; }
.pill-na  { background: #f5f5f5; color: #9e9e9e; }

.search-hint { text-align: center; color: var(--text-muted); font-size: .85rem; margin-top: 8px; }
.search-hint a { color: var(--accent); font-weight: 600; }

/* ---- FLOATING CHAT WIDGET ---- */
.chat-launcher {
  position: fixed; bottom: 24px; right: 24px; z-index: 51;
  background: var(--accent); color: #fff; padding: 8px 18px; border-radius: 40px;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(212,168,67,.45); transition: all var(--transition);
  font-weight: 700; font-size: .82rem; text-decoration: none; border: none;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(212,168,67,.6); }
.chat-panel {
  display: none;
  position: fixed; bottom: 104px; right: 28px; z-index: 52;
  width: 360px; max-height: 520px; background: #fff;
  border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,.15);
  overflow: hidden;
}
.chat-panel.open { display: flex; flex-direction: column; }
.chat-panel-header {
  background: var(--primary); color: #fff; padding: 14px 18px;
  font-weight: 700; font-size: .95rem; display: flex; justify-content: space-between; align-items: center;
}
.chat-panel-header button { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
.chat-panel-body { padding: 16px; flex: 1; overflow-y: auto; min-height: 200px; max-height: 340px; }
.chat-panel-body .msg { margin-bottom: 12px; line-height: 1.5; font-size: .88rem; }
.chat-panel-body .msg.bot { background: #f0f4fa; padding: 10px 14px; border-radius: 0 12px 12px 12px; color: var(--text); }
.chat-panel-body .msg.user { background: var(--primary); padding: 10px 14px; border-radius: 12px 0 12px 12px; color: #fff; text-align: right; }
.chat-panel-footer {
  border-top: 1px solid #e0e0e0; padding: 10px 14px; display: flex; gap: 8px;
}
.chat-panel-footer input {
  flex: 1; border: 1px solid #ddd; border-radius: 20px; padding: 8px 14px; font-size: .85rem; outline: none;
}
.chat-panel-footer input:focus { border-color: var(--accent); }
.chat-panel-footer button {
  background: var(--accent); color: #fff; border: none; border-radius: 20px; padding: 8px 18px; font-weight: 700; font-size: .82rem; cursor: pointer;
}
