/* =============================================
   ix-anti 云端控制面板 - 浅色主题
   支持移动端响应式
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base:        #f4f6f9;
  --bg-primary:     #ffffff;
  --bg-secondary:   #f0f2f5;
  --bg-hover:       #e8edf3;
  --border:         #dde1e7;
  --border-light:   #eef0f3;
  --text-primary:   #1a1f2e;
  --text-secondary: #5a6475;
  --text-muted:     #9aa3b0;
  --accent-blue:    #2563eb;
  --accent-blue-lt: #eff6ff;
  --accent-green:   #16a34a;
  --accent-green-lt:#f0fdf4;
  --accent-orange:  #ea580c;
  --accent-orange-lt:#fff7ed;
  --accent-red:     #dc2626;
  --accent-red-lt:  #fef2f2;
  --accent-purple:  #7c3aed;
  --accent-yellow:  #ca8a04;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 4px 16px rgba(0,0,0,.1);
  --radius:         10px;
  --radius-sm:      6px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 顶部导航 ── */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -.3px; }
.logo-highlight { color: var(--accent-blue); }

.header-right { display: flex; align-items: center; gap: 10px; }
.status-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-secondary); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; color: var(--text-secondary);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); transition: background .3s; }
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }

/* ── 标签导航 ── */
.tab-nav {
  background: var(--bg-primary);
  border-bottom: 2px solid var(--border);
  padding: 0 20px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 14px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--accent-blue); background: var(--accent-blue-lt); }
.tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); font-weight: 600; }
.tab-btn.admin-tab { color: var(--accent-orange); }
.tab-btn.admin-tab:hover { background: var(--accent-orange-lt); }
.tab-btn.admin-tab.active { color: var(--accent-orange); border-bottom-color: var(--accent-orange); }

/* ── 主内容区 ── */
.main-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px;
  display: none;
}
.main-container.active { display: block; }

/* ── 卡片 ── */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s;
  background: var(--bg-primary);
  color: var(--text-primary);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-success { background: var(--accent-green); border-color: var(--accent-green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--accent-red); border-color: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--accent-orange); border-color: var(--accent-orange); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* 移动端全宽按钮辅助 */
.btn-block { width: 100%; justify-content: center; }

/* ── 表单 ── */
textarea, input[type="text"], input[type="password"], select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 160px; }
textarea:focus, input:focus, select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: var(--bg-primary);
}
label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}
.form-group { margin-bottom: 14px; }

/* ── 统计卡 ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-num  { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-lbl  { font-size: 11px; color: var(--text-muted); margin-top: 5px; font-weight: 500; }
.stat-card.c-success .stat-num { color: var(--accent-green); }
.stat-card.c-failed  .stat-num { color: var(--accent-red); }
.stat-card.c-running .stat-num { color: var(--accent-blue); }
.stat-card.c-pending .stat-num { color: var(--accent-yellow); }
.stat-card.c-skip    .stat-num { color: var(--text-muted); }

/* ── 表格 ── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.tbl th {
  text-align: left; padding: 10px 14px;
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.tbl th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.tbl th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border-light); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-secondary); }

/* ── 状态徽章 ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--accent-green-lt); color: var(--accent-green); }
.badge-failed  { background: var(--accent-red-lt);   color: var(--accent-red); }
.badge-running { background: var(--accent-blue-lt);  color: var(--accent-blue); }
.badge-pending { background: #fefce8; color: var(--accent-yellow); }
.badge-skipped { background: var(--bg-secondary);    color: var(--text-muted); }
.badge-assigned{ background: #f5f3ff;                color: var(--accent-purple); }
.badge-success_unverified { background: #fefce8; color: var(--accent-yellow); }
.badge-gcp_suspended      { background: var(--accent-orange-lt); color: var(--accent-orange); }

/* ── 日志区 ── */
.log-box {
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 240px;
  overflow-y: auto;
  padding: 12px;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
}
.log-entry { margin-bottom: 5px; display: flex; gap: 8px; align-items: baseline; }
.log-time  { color: var(--text-muted); flex-shrink: 0; font-size: 11px; }
.log-email { color: var(--accent-blue); flex-shrink: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.log-msg   { color: var(--text-primary); word-break: break-all; }
.log-warn  .log-msg { color: var(--accent-orange); }
.log-error .log-msg { color: var(--accent-red); }
.log-success .log-msg { color: var(--accent-green); font-weight: 500; }

/* ── 提示框 ── */
.hint-box {
  background: var(--accent-blue-lt);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.8;
}
.hint-box.warn {
  background: var(--accent-orange-lt);
  border-left-color: var(--accent-orange);
}
.hint-box code {
  background: rgba(0,0,0,.06);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: monospace;
  color: var(--accent-blue);
  font-size: 12px;
}

/* ── 管理员弹窗 ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ── 空状态 ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

/* ── 工具行 ── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 分割线 ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ==================== 响应式 ==================== */

/* 平板（768px 以下） */
@media (max-width: 768px) {
  .main-container { padding: 12px; }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .stat-num { font-size: 22px; }

  .card { padding: 16px; }

  .tab-btn { padding: 12px 14px; font-size: 12px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { justify-content: flex-end; }
}

/* 移动端（480px 以下） */
@media (max-width: 480px) {
  .header { padding: 0 14px; }
  .logo-text { font-size: 14px; }
  #wsText { display: none; }  /* 小屏上只显示圆点 */

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card.c-skip { display: none; } /* 小屏省略"跳过"统计 */

  .main-container { padding: 10px; }
  .card { padding: 14px; margin-bottom: 12px; }
  .card-title { font-size: 13px; }

  textarea { min-height: 120px; }

  .btn { padding: 9px 12px; font-size: 12px; }

  .modal { padding: 20px 16px; }

  /* 记录表格在小屏上精简列 */
  .tbl .hide-mobile { display: none; }
}

/* ── 预检结果表格 ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.data-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg-secondary);
}
.data-table tbody tr:hover {
  background: var(--bg-hover);
}

/* ── 状态徽章 ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success {
  background: var(--accent-green-lt);
  color: var(--accent-green);
}
.badge-danger {
  background: var(--accent-red-lt);
  color: var(--accent-red);
}
.badge-warn {
  background: var(--accent-orange-lt);
  color: var(--accent-orange);
}
.badge-info {
  background: var(--accent-blue-lt);
  color: var(--accent-blue);
}
.badge-cancelled {
  background: #f3f4f6;
  color: #6b7280;
}
.badge-gcp_suspended {
  background: var(--accent-orange-lt);
  color: var(--accent-orange);
}
