/* ============================================================
   SMS Forwarder Dashboard —— 样式
   简洁现代 / 视觉清晰 / 响应式 / 适度动画
   ============================================================ */

:root {
  --bg: #0b1120;
  --bg-soft: #0f172a;
  --card: #ffffff;
  --card-dark: #111a2e;
  --border: #e5e9f0;
  --border-dark: #1e2a44;
  --text: #0f172a;
  --text-dark: #e6ecff;
  --muted: #64748b;
  --muted-dark: #93a3c4;
  --primary: #4f6ef7;
  --primary-2: #7c5cff;
  --accent: #22c55e;
  --danger: #ef4444;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 12px 40px rgba(2, 6, 23, 0.35);
  --shadow-sm: 0 4px 16px rgba(2, 6, 23, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", "Consolas", "Menlo", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ---------------- 背景装饰 ---------------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(128, 140, 200, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 140, 200, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 20%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 20%, #000 0%, transparent 75%);
}
.bg-glow {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  pointer-events: none;
}
.bg-glow-1 { top: -140px; left: -120px; background: radial-gradient(circle, #4f6ef7, transparent 70%); }
.bg-glow-2 { bottom: -160px; right: -140px; background: radial-gradient(circle, #7c5cff, transparent 70%); }

/* ---------------- 顶部导航 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  background: rgba(11, 17, 32, 0.75);
  border-bottom: 1px solid var(--border-dark);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  font-size: 26px;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 20px rgba(79, 110, 247, 0.4);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: 0.3px; }
.brand-sub {
  font-size: 11px;
  color: var(--muted-dark);
  border: 1px solid var(--border-dark);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav { display: flex; gap: 6px; margin-left: 12px; }
.nav-link {
  color: var(--muted-dark);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: all 0.2s;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-link.active { color: #fff; background: rgba(79, 110, 247, 0.22); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------- 容器 ---------------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px 60px;
}

/* ---------------- 状态条 ---------------- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
  margin-bottom: 10px;
}
.status-left { display: flex; align-items: center; gap: 8px; }
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.ok { background: var(--accent); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15); }
.status-dot.err { background: var(--danger); }
#statusText { font-size: 14px; color: var(--muted-dark); }
.badge {
  font-size: 12px;
  color: var(--muted-dark);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-dark);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ---------------- 工具条（搜索） ---------------- */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: 999px;
  padding: 10px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.15);
}
.search-icon { font-size: 14px; opacity: 0.7; }
.search-box input {
  border: none;
  background: transparent;
  color: var(--text-dark);
  font-size: 14px;
  flex: 1;
  outline: none;
}
.search-box input::placeholder { color: var(--muted-dark); opacity: 0.7; }
.toolbar-right { display: flex; gap: 8px; }

/* ---------------- 统计卡片 ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 26px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  transition: transform 0.25s, box-shadow 0.25s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.stat-icon {
  font-size: 26px;
  width: 54px; height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}
.stat-icon-1 { background: rgba(79, 110, 247, 0.18); }
.stat-icon-2 { background: rgba(34, 197, 94, 0.16); }
.stat-icon-3 { background: rgba(124, 92, 255, 0.18); }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted-dark); margin-top: 4px; }

/* ---------------- 最近一条 ---------------- */
.last-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 24px;
  background: rgba(79, 110, 247, 0.08);
  border: 1px solid rgba(79, 110, 247, 0.3);
  border-radius: var(--radius-s);
  font-size: 14px;
}
.last-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #aab6ff;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(79, 110, 247, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
}
.last-text {
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 短信列表 ---------------- */
.list-section { margin-bottom: 20px; }
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.list-head h2 { font-size: 18px; font-weight: 700; }

.sms-list { display: flex; flex-direction: column; gap: 12px; }

.sms-card {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  animation: fadeUp 0.4s ease both;
  transition: border-color 0.2s, transform 0.2s;
}
.sms-card:hover { border-color: var(--primary); transform: translateX(2px); }
.sms-avatar {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f6ef7, #7c5cff);
  text-transform: uppercase;
}
.sms-main { flex: 1; min-width: 0; }
.sms-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.sms-phone { font-weight: 700; font-size: 15px; }
.sms-device {
  font-size: 11px;
  color: var(--muted-dark);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-dark);
}
.sms-time { margin-left: auto; font-size: 12px; color: var(--muted-dark); flex-shrink: 0; }
.sms-content {
  font-size: 14px;
  color: var(--text-dark);
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 90px;
  overflow: hidden;
  position: relative;
}
.sms-content.expanded { max-height: none; }
.sms-actions { display: flex; gap: 8px; margin-top: 10px; }
.sms-actions .btn { padding: 5px 12px; font-size: 12px; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted-dark);
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-dark); margin-bottom: 6px; }
.empty-sub { font-size: 13px; }
.empty-sub a { color: var(--primary); }

.list-status { text-align: center; font-size: 13px; color: var(--muted-dark); padding: 16px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  transition: all 0.2s;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-dark);
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: none;
  color: #fff;
  box-shadow: 0 6px 20px rgba(79, 110, 247, 0.35);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border-dark); }
.btn-soft { background: rgba(79, 110, 247, 0.15); border-color: rgba(79, 110, 247, 0.35); }
.btn-danger-ghost { color: #ffa0a0; border-color: rgba(239, 68, 68, 0.4); }
.btn-danger-ghost:hover { background: rgba(239, 68, 68, 0.15); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- 页脚 ---------------- */
.footer {
  text-align: center;
  padding: 26px 20px 40px;
  color: var(--muted-dark);
  font-size: 13px;
}
.footer strong { color: var(--text-dark); }

/* ---------------- 动画 ---------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .nav { order: 3; width: 100%; justify-content: center; }
  .nav-link { padding: 6px 12px; font-size: 13px; }
  .brand-icon { width: 38px; height: 38px; font-size: 22px; }
  .brand-name { font-size: 16px; }
  /* 统计卡片保持三列紧凑，避免堆叠成三行把内容推低 */
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
  .stat-card { flex-direction: column; gap: 6px; padding: 12px 8px; text-align: center; }
  .stat-icon { width: 34px; height: 34px; font-size: 18px; border-radius: 10px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; margin-top: 2px; }
  .container { padding: 10px 14px 50px; }
  .empty { padding: 44px 16px; }
  .sms-card { flex-direction: column; }
  .sms-avatar { width: 40px; height: 40px; }
  .sms-time { margin-left: 0; }
}
@media (max-width: 420px) {
  .brand-sub { display: none; }
  .toolbar { flex-direction: column; }
  .toolbar-right { width: 100%; }
  .toolbar-right .btn { flex: 1; }
  .search-box { min-width: 0; padding: 9px 14px; }
}

/* ---------------- 登录页 ---------------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
  animation: pop 0.35s ease both;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand .brand-icon { flex: 0 0 auto; }
.login-title { font-size: 19px; font-weight: 800; letter-spacing: 0.3px; }
.login-sub { font-size: 12.5px; color: var(--muted-dark); margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-label { font-size: 12.5px; color: var(--muted-dark); }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-s);
  padding: 12px 44px 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input::placeholder { color: var(--muted-dark); opacity: 0.6; }
.login-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.16); }
.login-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none;
  background: transparent;
  color: var(--muted-dark);
  font-size: 15px;
  cursor: pointer;
  border-radius: 8px;
}
.login-eye:hover { background: rgba(255, 255, 255, 0.07); }
.login-msg { min-height: 18px; font-size: 13px; line-height: 1.5; }
.login-msg.err { color: #ff9c9c; }
.login-msg.ok { color: #86efac; }
.login-msg.info { color: var(--muted-dark); }
.login-submit { justify-content: center; width: 100%; margin-top: 4px; padding: 11px 16px; }
.login-foot {
  margin-top: 18px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted-dark);
  border-top: 1px dashed var(--border-dark);
  padding-top: 14px;
}
.login-foot code {
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ---------------- 面板错误提示条 ---------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-s);
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #ffd0d0;
}
.alert[hidden] { display: none; }
.alert-icon { flex: 0 0 auto; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; margin-bottom: 2px; }
.alert-detail { color: #ffbcbc; word-break: break-word; }
.alert-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.alert .btn { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); }
.alert .btn:hover { background: rgba(255, 255, 255, 0.18); }
.alert-info {
  border-color: rgba(79, 110, 247, 0.45);
  background: rgba(79, 110, 247, 0.12);
  color: #cdd8ff;
}
.alert-info .alert-detail { color: #b9c8ff; }
