/* 外贸AI免费工具箱 - 公共样式 */
/* 配色对齐星拓客默认主题 graphite-green（石墨绿 · 暗色） */

:root {
  /* 主题色 —— 与星拓客 [data-theme="graphite-green"] 一致 */
  --brand: #00dd88;
  --brand-dark: #5cffb8;
  --brand-soft: rgba(0, 221, 136, 0.10);
  --brand-ink: #003b29;
  --brand-light: rgba(0, 221, 136, 0.10);

  --bg: #000000;
  --bg-soft: #0a0a0a;
  --bg-soft-2: #121212;
  --bg-soft-3: #1a1a1a;
  --card: #121212;

  --ink: #ffffff;
  --ink-soft: #cbd5e1;
  --text: #ffffff;
  --text-secondary: #cbd5e1;
  --muted: #9ca3af;
  --muted-2: #6b7280;

  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --tag-bg: rgba(255, 255, 255, 0.08);

  --ok: #34d399;
  --warn: #ffb27a;
  --danger: #ff6b6b;
  --accent: #00dd88;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --shadow: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1100px;
  --header-height: 60px;
  --footer-ad-height: 76px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

::selection { background: var(--brand-soft); color: var(--brand); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--muted-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}

.logo:hover { text-decoration: none; }

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav a {
  display: block;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.nav a:hover, .nav a.active {
  color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

.nav .wechat-link {
  color: var(--brand);
  border: 1px solid var(--brand);
  background: rgba(0, 221, 136, 0.08);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px;
}

/* Layout */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px 100px;
  min-height: calc(100vh - var(--header-height));
}

.section { margin-bottom: 40px; }

.section-title {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.section-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: -10px 0 18px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 44px 16px 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.hero-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.25;
  color: var(--ink);
}

.hero-subtitle {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 auto 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero-tags { color: var(--muted); font-size: 13px; }

/* Buttons —— 对齐星拓客 .btn */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-weight: 500;
}

.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--brand-ink); text-decoration: none; }

.btn-accent { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 500; }
.btn-accent:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--brand-ink); text-decoration: none; }

.btn-outline { border-color: var(--line); color: var(--ink-soft); background: transparent; }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards —— 对齐星拓客 .card */
.card {
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--ink);
}

.card-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  margin-top: 2px;
}

/* Tool cards grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.tool-card {
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

.tool-card .icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  margin-bottom: 12px;
}

.tool-card h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--ink);
}

.tool-card p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
  flex: 1;
}

.tool-card .tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tags —— 暗色下用低透明度底色 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
}

.tag-free { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.tag-ai { background: rgba(0, 221, 136, 0.14); color: var(--brand); }
.tag-quote { background: rgba(255, 178, 122, 0.14); color: var(--warn); }
.tag-shipping { background: rgba(0, 221, 136, 0.12); color: var(--brand); }
.tag-google { background: rgba(255, 107, 107, 0.12); color: var(--danger); }
.tag-doc { background: var(--tag-bg); color: var(--muted); }
.tag-tool { background: var(--tag-bg); color: var(--muted); }
.tag-oversea { background: rgba(255, 107, 107, 0.12); color: var(--danger); }
.tag-freight { background: rgba(0, 212, 255, 0.12); color: #00d4ff; }

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.category-tab {
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
}

.category-tab:hover { color: var(--brand); background: var(--brand-soft); }
.category-tab.active { color: var(--brand-ink); background: var(--brand); font-weight: 500; }

/* Quick entries */
.quick-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.quick-entry {
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.quick-entry:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

.quick-entry .qe-icon { font-size: 24px; margin-bottom: 6px; }
.quick-entry .qe-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }

/* Form elements */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, .select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus, .select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.input::placeholder, textarea::placeholder { color: var(--muted-2); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.input-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.input-row .input, .input-row .select { flex: 1; min-width: 120px; }

/* Tool page */
.tool-page { max-width: 760px; margin: 0 auto; }

.tool-page-header { margin-bottom: 20px; }

.tool-page-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.tool-page-header p { color: var(--muted); margin: 0; font-size: 13px; }

.result-box {
  background: rgba(0, 221, 136, 0.07);
  border: 1px solid rgba(0, 221, 136, 0.22);
  border-radius: var(--r-md);
  padding: 16px;
  margin-top: 16px;
}

.result-box.warn {
  background: rgba(255, 178, 122, 0.08);
  border-color: rgba(255, 178, 122, 0.25);
}

.result-title { font-weight: 600; margin-bottom: 10px; color: var(--ink); font-size: 14px; }
.result-value { font-size: 24px; font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.result-meta { font-size: 13px; color: var(--ink-soft); line-height: 1.8; }

/* Tables */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

th { color: var(--muted); font-weight: 500; font-size: 12px; }
td { color: var(--ink-soft); }

/* CTA sections */
.cta-section {
  background: rgba(0, 221, 136, 0.06);
  border: 1px solid rgba(0, 221, 136, 0.20);
  border-radius: var(--r-md);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 24px;
}

.cta-section h2 { font-size: 20px; font-weight: 600; margin: 0 0 8px; color: var(--ink); }
.cta-section p { color: var(--ink-soft); max-width: 520px; margin: 0 auto 18px; font-size: 13.5px; }

/* WeChat hooks */
.wechat-card {
  background: rgba(0, 221, 136, 0.06);
  border: 1px solid rgba(0, 221, 136, 0.20);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wechat-card .content h3 { font-size: 15px; font-weight: 500; margin: 0 0 4px; color: var(--ink); }
.wechat-card .content p { font-size: 12.5px; color: var(--ink-soft); margin: 0; }

/* Bottom ad */
.bottom-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.6);
  z-index: 90;
  display: none;
}

.bottom-ad.show { display: block; }

/* 底部广告是 fixed 定位，显示时必须给页面留出空间，否则会遮住页脚和正文末尾。
   由 main.js 在广告显示时给 body 加 has-bottom-ad，关闭后移除。 */
body.has-bottom-ad { padding-bottom: calc(var(--footer-ad-height) + 8px); }

.bottom-ad-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--footer-ad-height);
}

.bottom-ad .ad-text { flex: 1; min-width: 0; }
.bottom-ad .ad-title { font-weight: 500; font-size: 14px; margin: 0 0 2px; color: var(--ink); }
.bottom-ad .ad-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-ad .ad-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-soft-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.7);
}

.modal-header { padding: 18px 20px 0; }
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
.modal-body { padding: 16px 20px; }
.modal-footer { padding: 0 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.modal-footer .btn { flex: 1; }

/* Checkbox group */
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-soft);
  transition: border-color 0.15s, background 0.15s;
}

.checkbox-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.checkbox-item input { margin: 0; accent-color: var(--brand); }

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-soft-3);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* PWA install banner —— 对齐星拓客 .fx-source-note */
.install-banner {
  background: rgba(0, 221, 136, 0.08);
  border: 1px solid rgba(0, 221, 136, 0.30);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.install-banner .text { font-size: 13.5px; color: var(--ink-soft); }

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 24px 16px 100px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.footer a { color: var(--muted); margin: 0 8px; }
.footer a:hover { color: var(--brand); }

/* Mobile */
@media (max-width: 768px) {
  :root { --footer-ad-height: 70px; }

  .header-inner { padding: 0 12px; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 8px 12px;
    gap: 4px;
  }
  .nav.show { display: flex; }
  .nav a { width: 100%; }
  .menu-toggle { display: block; }

  .hero { padding: 28px 16px; }
  .hero-title { font-size: 22px; }
  .hero-subtitle { font-size: 14px; }

  .main { padding-bottom: 90px; }

  .tool-grid { grid-template-columns: 1fr; }
  .quick-entries { grid-template-columns: repeat(2, 1fr); }

  .bottom-ad-inner { flex-wrap: wrap; }
  .bottom-ad .ad-subtitle { white-space: normal; }

  .modal { max-width: 100%; }
}

/* Print —— 单据预览保持白底黑字 */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .header, .bottom-ad, .footer, .install-banner, .wechat-card, .cta-section { display: none !important; }
  .main { padding-bottom: 24px; }
  .card { background: #fff !important; border-color: #ccc !important; }
}
