/* ========================================
   ZXTOOLX.CN — 工程师/码农风格 v5
   ======================================== */

/* ---- 设计变量 ---- */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #0f172a;
  --accent-hover: #1e293b;
  --accent-bg: #f1f5f9;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --yellow: #f59e0b;
  --yellow-light: #fffbeb;
  --red: #ef4444;
  --red-light: #fef2f2;
  --cyan: #06b6d4;
  --purple: #8b5cf6;
  --mono: "SF Mono", "Fira Code", "Consolas", "Menlo", monospace;
  --r: 4px;
  --r-sm: 2px;
  --r-lg: 6px;
  --mw: 1100px;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

/* ---- 全局重置 ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  padding-top: 56px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background-image: 
    linear-gradient(rgba(0,0,0,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.02) 1px, transparent 1px);
  background-size: 20px 20px;
}
body.lang-zh-tw {
  font-family: "Microsoft JhengHei", sans-serif;
}
body.lang-en {
  font-family: "Inter", "Helvetica Neue", "Arial", sans-serif;
}
body::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }

/* ---- 基础排版 ---- */
a { color: var(--blue); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent); }
h1, h2, h3, h4, h5, h6 { color: var(--text); line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.8rem; margin-bottom: 16px; }
h2 { font-size: 1.4rem; margin-bottom: 12px; }
h3 { font-size: 1.1rem; margin-bottom: 10px; }
h4 { font-size: 1rem; margin-bottom: 8px; }
p { margin-bottom: 12px; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; height: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--accent-bg); font-weight: 600; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-family: var(--mono); }
td { font-size: 13px; color: var(--text-2); font-family: var(--mono); }
select, textarea, input, button { font-family: inherit; font-size: inherit; }

/* ---- 布局 ---- */
.container { max-width: var(--mw); margin: 0 auto; padding: 0 24px; }
.page { padding-top: 40px; padding-bottom: 60px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s var(--ease);
  text-decoration: none; line-height: 1.4; font-family: var(--mono);
  position: relative; overflow: hidden;
}
.btn::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transition: left .5s; display: none;
}
.btn:hover::before { display: block; left: 100%; }
.btn:active { opacity: .85; transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; box-shadow: 0 0 0 2px rgba(15,23,42,.3); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---- 卡片 ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--purple));
  opacity: 0; transition: opacity .3s;
}
.card:hover::before { opacity: 1; }
.card:last-child { margin-bottom: 0; }
.card-lg { max-width: 800px; margin-left: auto; margin-right: auto; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* ---- 表单 ---- */
.form-box {
  max-width: 420px; margin: 48px auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 32px;
  box-shadow: var(--shadow-lg);
}
.form-box h2 { text-align: center; margin-bottom: 24px; font-family: var(--mono); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 13px; color: var(--text); background: var(--surface);
  transition: all .15s var(--ease); outline: none; font-family: var(--mono);
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-control::placeholder { color: #94a3b8; }
.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }
.input-group .btn { white-space: nowrap; }

/* ---- 提示框 ---- */
.alert { padding: 10px 14px; border-radius: var(--r); font-size: 13px; margin-bottom: 14px; border: 1px solid; font-family: var(--mono); }
.alert-success { background: var(--green-light); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--red-light); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--yellow-light); border-color: #fde68a; color: #92400e; }

/* ---- 徽章 ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; font-family: var(--mono); }
.badge-success { background: var(--green-light); color: #065f46; }
.badge-warning { background: var(--yellow-light); color: #92400e; }
.badge-danger { background: var(--red-light); color: #991b1b; }
.badge-primary { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--accent-bg); color: var(--text-3); }

/* ---- 帖子列表 ---- */
.post-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.post-item:hover { background: var(--accent-bg); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--r); }
.post-item:first-child { padding-top: 0; }
.post-item:last-child { border-bottom: none; padding-bottom: 0; }
.post-avatar {
  width: 38px; height: 38px; background: var(--accent-bg);
  border-radius: var(--r); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--text-3); font-family: var(--mono); flex-shrink: 0;
  border: 1px solid var(--border);
}
.post-info { flex: 1; min-width: 0; }
.post-info h3, .post-info h4 { font-size: 14px; margin-bottom: 4px; font-weight: 500; }
.post-info h3 a, .post-info h4 a { color: var(--text); }
.post-info h3 a:hover, .post-info h4 a:hover { color: var(--blue); }
.post-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; align-items: center; font-family: var(--mono); }
.post-snippet { margin: 3px 0 5px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 500px; }
.post-stats { font-size: 12px; color: var(--text-3); text-align: right; white-space: nowrap; font-family: var(--mono); }

/* ---- 帖子详情 ---- */
.post-content { padding: 0; }
.post-content h1 { font-size: 20px; margin-bottom: 14px; }
.post-author-line { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.post-author-name { color: var(--text); font-weight: 600; }
.post-body { color: var(--text-2); line-height: 1.8; white-space: pre-wrap; word-break: break-word; font-size: 14px; }

/* ---- 回复 ---- */
.reply-section { padding: 0; }
.reply-section-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; font-family: var(--mono); }
.reply-form-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; font-family: var(--mono); }
.reply-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.reply-item:last-child { border-bottom: none; }
.reply-content { flex: 1; }
.reply-header { font-size: 12px; color: var(--text-3); margin-bottom: 6px; font-family: var(--mono); }
.reply-body { color: var(--text-2); line-height: 1.7; white-space: pre-wrap; font-size: 14px; }

/* ---- 模态框 ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all .2s var(--ease);
  backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 28px;
  width: 440px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
  transform: translateY(12px); transition: transform .2s var(--ease);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-3); padding: 4px 8px; border-radius: var(--r-sm); }
.modal-close:hover { color: var(--text); }
.modal-title-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* ---- Dashboard ---- */
.dash-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 24px; overflow-x: auto;
}
.dash-tabs a {
  padding: 10px 16px; color: var(--text-3); font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: all .15s var(--ease);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: var(--mono);
}
.dash-tabs a:hover { color: var(--text); }
.dash-tabs a.active { color: var(--blue); font-weight: 600; border-bottom-color: var(--blue); }

/* ---- 统计卡片 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.stat-card .label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; font-family: var(--mono); }
.stat-card .value { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--text); }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { margin: 0; width: 100%; }
.table-wrap tr:hover { background: var(--accent-bg); }
.card { overflow: hidden; }

/* ---- 分页 ---- */
.pagination { display: flex; gap: 4px; margin-top: 20px; justify-content: center; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: 13px; font-family: var(--mono);
  color: var(--text-2); border: 1px solid var(--border); background: var(--surface);
  transition: all .15s var(--ease);
}
.pagination a:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }

/* ---- 个人信息 ---- */
.profile-card { padding: 24px; }
.profile-item { margin-bottom: 20px; }
.profile-item:last-of-type { margin-bottom: 0; }
.value { font-size: 15px; font-weight: 600; color: var(--text); font-family: var(--mono); }

/* ---- 空状态 ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-text { font-size: 14px; color: var(--text-3); font-family: var(--mono); }
.empty-row td { text-align: center; color: var(--text-3); padding: 40px 14px; font-size: 13px; }

/* ---- 内联代码 ---- */
.inline-code, .inline-code-lg {
  font-family: var(--mono); font-size: 12px;
  background: var(--accent-bg); padding: 2px 6px;
  border-radius: var(--r-sm); color: var(--cyan);
  border: 1px solid var(--border);
}
.inline-code-lg { padding: 3px 8px; }

/* ---- 页面标题 ---- */
.page-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; font-family: var(--mono); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.heading-count { font-weight: 400; color: var(--text-3); font-size: 13px; font-family: var(--mono); }

/* ---- 工具类 ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12px; }
.text-primary { color: var(--blue); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-warning { color: var(--yellow); }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.max-w-lg { max-width: 480px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .input-group { flex-direction: column; }
  body { padding-top: 52px; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .post-item { gap: 10px; }
  .form-box { padding: 24px; margin: 24px auto; }
  body { padding-top: 48px; }
}

/* ---- wangEditor 适配 ---- */
.w-e-bar { background: var(--accent-bg) !important; border-color: var(--border) !important; }
.w-e-bar-item button { color: var(--text) !important; }
.w-e-bar-item button:hover { background: var(--surface) !important; }
.w-e-text-container { background: var(--surface) !important; color: var(--text) !important; }
.w-e-text-container [data-slate-editor] { color: var(--text) !important; }
.w-e-toolbar { border-color: var(--border) !important; }
.w-e-text-container { border-color: var(--border) !important; border-top: none !important; }
.w-e-bar .w-e-bar-item-group .w-e-bar-item-menus-container { background: var(--surface) !important; }

/* ---- 帖子内容 HTML 渲染 ---- */
.post-body img { max-width: 100%; height: auto; border-radius: var(--r-sm); margin: 8px 0; }
.post-body a { color: var(--blue); text-decoration: underline; }
.post-body code { font-family: var(--mono); font-size: 13px; background: var(--accent-bg); padding: 2px 6px; border-radius: var(--r-sm); color: var(--cyan); border: 1px solid var(--border); }
.post-body pre { font-family: var(--mono); font-size: 13px; background: var(--accent-bg); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; margin: 8px 0; white-space: pre-wrap; border: 1px solid var(--border); }
.post-body blockquote { border-left: 3px solid var(--blue); padding-left: 14px; margin: 8px 0; color: var(--text-2); background: var(--blue-light); padding: 12px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.reply-body img { max-width: 100%; height: auto; border-radius: var(--r-sm); margin: 8px 0; }
.reply-body a { color: var(--blue); text-decoration: underline; }
.reply-body code { font-family: var(--mono); font-size: 13px; background: var(--accent-bg); padding: 2px 6px; border-radius: var(--r-sm); color: var(--cyan); border: 1px solid var(--border); }

/* ---- 动画 ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
.animate-in { animation: fadeIn .3s ease-out; }
