/* ============================================================
   shared/app.css — MBW 首页样式
   ============================================================ */

/* ===== 全局重置 & 设计令牌 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #ff5e4a;
  --brand-hover: #ff4432;
  --brand-light: #fff0ee;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #b0b4c0;
  --border-light: #f0f0f5;
  --border-medium: #e8e8ee;
  --bg-page: #ffffff;
  --bg-subtle: #fafafa;
  --bg-hero: #fff8f6;
  --shadow-sm: 0 2px 10px rgba(0,0,0,.04);
  --shadow-md: 0 8px 28px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(255,94,74,.10);
  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== 顶部导航栏 ===== */
.navbar {
  border-bottom: 1px solid var(--border-light);
  padding: 0 32px;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  z-index: 100;
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  transition: opacity .15s;
}
.logo:hover { opacity: .75; }

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--brand);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,94,74,.25);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color .15s;
  white-space: nowrap;
}
.nav-menu a:hover { color: var(--text-primary); }
.nav-menu a.active { color: var(--brand); font-weight: 600; }

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

.icon-btn-nav {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-medium);
  background: var(--bg-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-primary);
  flex-shrink: 0;
}
.icon-btn-nav:hover { background: #ebebf0; border-color: #d8d8e0; }

/* 语言切换 */
.lang-switch { position: relative; }

.lang-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
  font-family: var(--font);
  white-space: nowrap;
}
.lang-btn:hover { background: #ebebf0; }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  padding: 6px 0;
  display: none;
  z-index: 100;
  overflow: hidden;
}
.lang-dropdown.show { display: block; }

.lang-dropdown a {
  display: block;
  padding: 9px 18px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: background .1s;
}
.lang-dropdown a:hover { background: var(--bg-subtle); }
.lang-dropdown a.active { color: var(--brand); font-weight: 600; }

/* ===== Hero 区域 ===== */
.hero {
  background: var(--bg-hero);
  padding: 56px 32px 36px;
  text-align: center;
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.15;
}

.hero .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

/* 分类 Tab */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  font-weight: 500;
  font-size: 14px;
}
.tab-item {
  cursor: pointer;
  padding: 4px 0;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color .2s;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
  font-weight: 600;
}

/* 搜索框 */
.search-box-wrapper {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 4px 4px 4px 24px;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}
.search-box-wrapper:focus-within {
  border-color: var(--brand);
  box-shadow: 0 6px 24px rgba(255,94,74,.14), 0 0 0 4px rgba(255,94,74,.08);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 12px 6px 12px 0;
  background: transparent;
  color: var(--text-primary);
  min-width: 0;
  font-family: var(--font);
}
.search-input::placeholder { color: var(--text-muted); font-size: 15px; }

.search-btn {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(255,94,74,.35);
  transition: background .2s, transform .15s;
  flex-shrink: 0;
  margin-left: 4px;
}
.search-btn:hover { background: var(--brand-hover); transform: scale(1.04); }
.search-btn:active { transform: scale(.95); }
.search-btn svg { width: 22px; height: 22px; }

/* 简码下拉 */
.shortcut-dropdown {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: 0 12px 32px rgba(0,0,0,.10);
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 0;
  display: none;
  text-align: left;
}
.shortcut-dropdown.show { display: block; }

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-primary);
  transition: background .1s;
}
.shortcut-item:last-child { border-bottom: none; }
.shortcut-item:hover { background: var(--bg-subtle); }

.shortcut-code {
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-light);
  padding: 3px 10px;
  border-radius: 40px;
  font-size: 13px;
  letter-spacing: .5px;
}
.shortcut-name { font-weight: 500; }
.shortcut-url {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 12px;
  text-align: right;
}

/* 引擎行 */
.engine-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  font-size: 14px;
  font-weight: 500;
}

.engine-item {
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 40px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  transition: all .15s;
}
.engine-item:hover { color: var(--text-primary); background: #fff; border-color: var(--border-light); }
.engine-item.active {
  color: var(--text-primary);
  font-weight: 700;
  background: #fff;
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

/* ===== Tools 区域（紧凑版） ===== */
.tools-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 32px 40px;
}

/* 首页隐藏 "Tools" 标题 */
.section-header {
  display: none;
}

/* 工具分类 Tab */
.tool-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tool-tab {
  background: #fff;
  border: 1.5px solid var(--border-light);
  color: var(--text-secondary);
  padding: 7px 18px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}

.tool-tab:hover {
  background: var(--brand-light);
  border-color: #ffc8bf;
  color: var(--brand);
}

.tool-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255,94,74,.25);
}

/* 工具网格 —— 5 列，卡片更小 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s ease;
  color: var(--text-primary);
  border: 1.5px solid var(--border-light);
  text-decoration: none;
  background: #fff;
}

.tool-card:hover {
  border-color: #ffc8bf;
  background: var(--brand-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.tool-card .card-icon {
  font-size: 20px;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border-radius: 10px;
  transition: background .2s;
}
.tool-card:hover .card-icon { background: #fff; }

.tool-card .card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.tool-card .card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* ===== FAQ 区域 ===== */
.faq-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.faq-section .section-header {
  display: flex;              /* FAQ 标题保留 */
  margin-bottom: 24px;
}

.faq-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 8px 32px;
  text-align: left;
}

.faq-card details {
  border-bottom: 1px solid var(--border-light);
  padding: 18px 0;
}
.faq-card details:last-child { border-bottom: none; }

.faq-card summary {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: color .15s;
}
.faq-card summary:hover { color: var(--brand); }
.faq-card summary::after {
  content: '＋';
  color: var(--text-muted);
  font-weight: 400;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.faq-card details[open] summary::after { content: '－'; }
.faq-card summary::-webkit-details-marker { display: none; }

.faq-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 12px;
  padding-right: 32px;
}
.faq-card code {
  background: var(--brand-light);
  color: var(--brand);
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, monospace;
}
.faq-card a { color: var(--brand); text-decoration: none; }
.faq-card a:hover { text-decoration: underline; }

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  z-index: 2000;
  max-width: 90%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 设置模态窗口 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 24px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0,0,0,.18);
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
  transition: color .15s;
}
.modal-close:hover { color: #333; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-section { margin-bottom: 28px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-section h3 .sub { font-size: 12px; color: #999; font-weight: 400; }

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.form-row input {
  flex: 1;
  min-width: 110px;
  padding: 9px 13px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: #fafafa;
  color: var(--text-primary);
  font-family: var(--font);
  transition: border-color .15s, background .15s;
}
.form-row input:focus { border-color: var(--brand); background: #fff; }

.btn-primary {
  background: var(--brand);
  border: none;
  color: #fff;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background .15s;
}
.btn-primary:hover { background: var(--brand-hover); }

.btn-secondary {
  background: #f0f0f5;
  border: none;
  color: var(--text-primary);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background .15s;
}
.btn-secondary:hover { background: #e4e4ec; }

.btn-danger {
  background: #fee;
  border: none;
  color: #e74c3c;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background .15s;
}
.btn-danger:hover { background: #fdd; }

.item-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #fafafa;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.list-item:last-child { border-bottom: none; }
.list-item .info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.list-item .info .code-badge {
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-light);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  flex-shrink: 0;
}
.list-item .info .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .info .url {
  color: #999;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.list-item .actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}
.btn-small {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font);
  transition: background .15s, color .15s;
}
.btn-small:hover { background: #f0f0f5; color: var(--text-primary); }
.btn-small.danger:hover { background: #fee; color: #e74c3c; }

.io-group { display: flex; gap: 8px; flex-wrap: wrap; }
.file-input { display: none; }
.empty-state {
  text-align: center;
  color: #aaa;
  padding: 18px;
  font-size: 13px;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .navbar { padding: 0 20px; }
  .navbar-inner { height: 60px; }
  .nav-left { gap: 24px; }
  .nav-menu { gap: 20px; }
  .nav-menu a { font-size: 13px; }
  .hero { padding: 44px 20px 32px; }
  .hero h1 { font-size: 34px; }
  .hero .subtitle { font-size: 15px; margin-bottom: 28px; }
  .tools-section { padding: 28px 20px 32px; }
  .tool-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .faq-section { padding: 32px 20px 64px; }
  .faq-card { padding: 6px 22px; }
  .site-footer { padding: 24px 20px; }
  .site-footer .footer-inner { justify-content: center; text-align: center; }
}

@media (max-width: 700px) {
  .navbar { padding: 0 16px; }
  .navbar-inner { height: 56px; gap: 12px; }
  .logo { font-size: 17px; }
  .logo-icon { width: 30px; height: 30px; font-size: 15px; }
  .nav-left { gap: 16px; }
  .nav-menu { display: none; }
  .hero { padding: 36px 16px 28px; }
  .hero h1 { font-size: 28px; }
  .hero .subtitle { font-size: 14px; margin-bottom: 24px; }
  .nav-tabs { gap: 14px; font-size: 13px; margin-bottom: 16px; }
  .search-box-wrapper { padding: 3px 3px 3px 18px; }
  .search-btn { width: 44px; height: 44px; }
  .search-btn svg { width: 19px; height: 19px; }
  .search-input { font-size: 15px; padding: 10px 4px 10px 0; }
  .engine-row { gap: 8px; font-size: 12px; margin-top: 18px; }
  .engine-item { padding: 4px 10px; font-size: 12px; }
  .shortcut-item { padding: 9px 14px; font-size: 13px; flex-wrap: wrap; gap: 4px; }
  .shortcut-url { max-width: 100%; margin-left: 0; text-align: left; font-size: 11px; }

  .tools-section { padding: 24px 16px 24px; }
  .tool-tabs { gap: 6px; margin-bottom: 16px; }
  .tool-tab { padding: 6px 14px; font-size: 12px; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tool-card { padding: 14px 12px; gap: 6px; }
  .tool-card .card-icon { font-size: 18px; width: 32px; height: 32px; }
  .tool-card .card-name { font-size: 12px; }
  .tool-card .card-desc { font-size: 10px; }

  .faq-section { padding: 24px 16px 56px; }
  .faq-card { padding: 4px 18px; }
  .faq-card summary { font-size: 14px; }
  .faq-card p { font-size: 13px; padding-right: 0; }

  .site-footer { padding: 20px 16px; font-size: 12px; }

  .modal-content { border-radius: 20px; }
  .modal-header { padding: 14px 18px; }
  .modal-body { padding: 16px 18px; }
  .form-row input { min-width: 80px; font-size: 12px; padding: 8px 10px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 24px; }
  .tool-grid { grid-template-columns: 1fr; }
  .lang-btn { padding: 6px 12px; font-size: 12px; }
  .icon-btn-nav { width: 34px; height: 34px; font-size: 14px; }
}