/* ============================================================
   同花顺资金流向筛选工具 — 响应式样式
   ============================================================ */

/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #0a0e17; color: #e1e5ee; min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ===== 顶栏 ===== */
.header {
  background: linear-gradient(135deg, #1a1f2e, #0d1117);
  border-bottom: 1px solid #1e2a3a;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  flex-wrap: wrap; gap: 8px;
}
.header h1 { font-size: 18px; font-weight: 600; color: #f0f4ff; white-space: nowrap; }
.header .accent { color: #ff6b35; }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crawl-info { font-size: 11px; color: #6b7a99; }
.crawl-info b { color: #8ba3cc; }

/* 用户区 */
.user-area { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 12px; color: #8ba3cc; }
.btn { padding: 7px 16px; border: none; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; color: #8ba3cc; border: 1px solid #2a3548; }
.btn-ghost:hover { background: #1a2332; color: #c0d0e8; }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; }
.btn-orange { background: #ea580c; color: #fff; }
.btn-orange:hover { background: #c2410c; }
.btn-pink { background: #db2777; color: #fff; }
.btn-pink:hover { background: #be185d; }
.btn-blue { background: #2563eb; color: #fff; }
.btn-blue:hover { background: #1d4ed8; }
.btn-blue:disabled { background: #334155; color: #64748b; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-block { width: 100%; margin-top: 10px; padding: 10px; font-size: 14px; }
.btn:disabled { background: #334155; color: #64748b; cursor: not-allowed; }

/* ===== 工具栏 ===== */
.toolbar {
  padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: #0d1117; border-bottom: 1px solid #1a2332;
}
.search-box { flex: 1; min-width: 160px; max-width: 360px; }
.search-box input {
  width: 100%; padding: 9px 12px 9px 34px;
  background: #151c28 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7a99' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 10-1.397 1.398h-.001l3.85 3.85a1 1 0 001.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 110-10 5 5 0 010 10z'/%3E%3C/svg%3E") 10px center no-repeat;
  border: 1px solid #2a3548; border-radius: 6px;
  color: #e1e5ee; font-size: 13px; outline: none;
}
.search-box input:focus { border-color: #2563eb; }

.filter-btns { display: flex; gap: 5px; }
.filter-btns button {
  padding: 6px 14px; border-radius: 16px; font-size: 12px;
  background: #1a2332; color: #8ba3cc; border: 1px solid #2a3548;
  cursor: pointer; transition: all .15s;
}
.filter-btns button.active, .filter-btns button:hover {
  background: #2563eb; color: #fff; border-color: #2563eb;
}

/* ===== 第二行工具栏 ===== */
.toolbar-row2 {
  padding: 8px 16px 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: #0d1117; border-bottom: 1px solid #1a2332;
}
.batch-wrap { flex: 1; min-width: 200px; }
.batch-wrap input {
  width: 100%; padding: 9px 12px;
  background: #151c28; border: 1px solid #2a3548; border-radius: 6px;
  color: #e1e5ee; font-size: 13px; outline: none;
}
.batch-wrap input:focus { border-color: #7c3aed; }
.batch-wrap input::placeholder { color: #4a5568; }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== 统计卡片 ===== */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px; padding: 12px 16px;
}
.stat-card {
  background: #151c28; border: 1px solid #1e2a3a; border-radius: 8px;
  padding: 10px 8px; text-align: center;
}
.stat-card .label { font-size: 10px; color: #6b7a99; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .3px; }
.stat-card .value { font-size: 18px; font-weight: 700; }
.stat-card .value.red { color: #ef4444; }
.stat-card .value.green { color: #22c55e; }
.stat-card .value.blue { color: #3b82f6; }
.stat-card .value.orange { color: #f97316; }
.stat-card .value.pink { color: #ec4899; }

/* ===== 表格 ===== */
.table-wrap { padding: 0 16px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #111827; border-radius: 8px; overflow: hidden; min-width: 700px; }
thead { background: #1a2332; }
th {
  padding: 10px 10px; text-align: left; font-weight: 600;
  color: #8ba3cc; font-size: 11px; cursor: pointer;
  user-select: none; white-space: nowrap; border-bottom: 1px solid #2a3548;
}
th:hover { color: #c0d0e8; }
th.sorted { color: #3b82f6; }
th .arrow { font-size: 10px; margin-left: 3px; }
th.nocursor { cursor: default; }
td {
  padding: 9px 10px; border-bottom: 1px solid #1a2332; white-space: nowrap;
}
tr:hover td { background: #1a2332; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
td.red { color: #ef4444; }
td.green { color: #22c55e; }
td.name { font-weight: 500; color: #f0f4ff; }
td.code { color: #6b7a99; font-size: 12px; }
td.center { text-align: center; }

/* 复选框 & 收藏 */
td input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #2563eb; }
.fav-heart { cursor: pointer; font-size: 16px; transition: all .2s; display: inline-block; line-height: 1; }
.fav-heart:hover { transform: scale(1.3); }

/* ===== 分页 ===== */
.pagination { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.pagination .info { font-size: 12px; color: #6b7a99; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination .pages button {
  min-width: 32px; height: 32px; border-radius: 6px; padding: 0 6px;
  background: #1a2332; color: #8ba3cc; border: 1px solid #2a3548;
  cursor: pointer; font-size: 12px; transition: all .15s;
}
.pagination .pages button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination .pages button:hover:not(.active) { background: #243247; }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s;
  padding: 16px;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #1a2332; border-radius: 12px; padding: 24px;
  width: 100%; max-width: 420px; max-height: 85vh; overflow-y: auto;
  border: 1px solid #2a3548;
  transform: translateY(10px); transition: transform .2s;
}
.modal-wide { max-width: 560px; }
.modal-overlay.show .modal { transform: translateY(0); }
.modal h3 { font-size: 16px; margin-bottom: 16px; color: #f0f4ff; }
.modal input[type="text"],
.modal input[type="password"] {
  width: 100%; padding: 10px 12px; margin-bottom: 10px;
  background: #151c28; border: 1px solid #2a3548; border-radius: 6px;
  color: #e1e5ee; font-size: 14px; outline: none;
}
.modal input:focus { border-color: #2563eb; }
.modal .row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #1e2a3a; }
.modal .row .label { color: #6b7a99; font-size: 13px; }
.modal .row .val { font-weight: 500; font-size: 13px; }
.modal .close-btn {
  margin-top: 14px; width: 100%; padding: 10px;
  background: #2563eb; color: #fff; border: none; border-radius: 8px;
  cursor: pointer; font-size: 14px;
}
.auth-error { color: #ef4444; font-size: 12px; min-height: 16px; margin-bottom: 4px; }
.auth-switch { text-align: center; margin-top: 10px; font-size: 13px; color: #6b7a99; }
.auth-switch a { color: #3b82f6; text-decoration: none; margin-left: 4px; }
.auth-switch a:hover { text-decoration: underline; }

/* 收藏列表 */
.fav-list { margin: 10px 0; }
.fav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid #1e2a3a;
}
.fav-item .fi-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fav-item .fi-code { color: #6b7a99; font-size: 12px; min-width: 55px; }
.fav-item .fi-name { font-weight: 500; color: #f0f4ff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-item .fi-info { color: #8ba3cc; font-size: 11px; white-space: nowrap; }
.fav-item .fi-remove { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 4px; }
.fav-item .fi-remove:hover { background: #1e2a3a; }
.fav-empty { text-align: center; padding: 30px; color: #6b7a99; font-size: 14px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #e2e8f0; padding: 10px 20px;
  border-radius: 8px; font-size: 13px; z-index: 999;
  border: 1px solid #334155; box-shadow: 0 4px 20px rgba(0,0,0,.4);
  opacity: 0; transition: opacity .3s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }

/* 加载 */
.loading { text-align: center; padding: 40px; color: #6b7a99; }
.spinner {
  width: 32px; height: 32px; border: 3px solid #1e2a3a;
  border-top-color: #2563eb; border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 手机端适配 ===== */
@media (max-width: 768px) {
  html { font-size: 13px; }
  .header { padding: 10px 12px; }
  .header h1 { font-size: 16px; }
  .header-right { gap: 6px; }
  .toolbar, .toolbar-row2 { padding: 8px 12px; gap: 8px; }
  .search-box { min-width: 140px; }
  .batch-wrap { min-width: 100%; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 12px; }
  .stat-card { padding: 8px 4px; }
  .stat-card .value { font-size: 15px; }
  .table-wrap { padding: 0 8px 12px; }
  table { font-size: 12px; min-width: 600px; }
  th, td { padding: 7px 6px; }
  .pagination { padding: 10px 12px; }
  .action-btns { width: 100%; justify-content: flex-start; }
  .action-btns .btn { flex: 1; text-align: center; min-width: 0; padding: 8px 6px; font-size: 11px; }
  .filter-btns button { padding: 5px 10px; font-size: 11px; }
  .modal { padding: 18px; border-radius: 10px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-card .value { font-size: 14px; }
  .header h1 { font-size: 14px; }
  .crawl-info { display: none; }
}
