/* ===== 全局 ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e17;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.08);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #6366f1;
  --primary-glow: rgba(99,102,241,0.3);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 粒子背景 ===== */
#particles-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 30%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 70%, rgba(34,197,94,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(245,158,11,0.04) 0%, transparent 60%);
}
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  animation: floatUp linear infinite;
  opacity: 0;
}
@keyframes floatUp {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.2; }
  100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* ===== 玻璃卡片 ===== */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ===== 页面切换 ===== */
.page { display: none; position: relative; z-index: 1; }
.page.active { display: block; }
.panel { display: none; }
.panel.active { display: block; }

/* ===== 登录页 ===== */
#authPage {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
#authPage.active { display: flex; }

.auth-container {
  width: 100%; max-width: 400px; padding: 40px 32px;
  animation: fadeInUp 0.6s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header { text-align: center; margin-bottom: 28px; }
.logo-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 0 30px var(--primary-glow);
}
.auth-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-header p { color: var(--text-dim); font-size: 13px; }

.auth-tabs {
  display: flex; gap: 4px; background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px;
}
.auth-tab {
  flex: 1; padding: 10px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-dim); font-size: 14px;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.auth-tab.active { background: var(--surface-hover); color: var(--text); font-weight: 600; }

.auth-form { display: none; }
.auth-form.active { display: block; }

.input-group { margin-bottom: 14px; }
.input-group input {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: rgba(255,255,255,0.03);
  color: var(--text); font-size: 14px; outline: none; transition: border 0.2s;
  font-family: inherit;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.input-group input::placeholder { color: var(--text-dim); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; font-family: inherit;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 25px var(--primary-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; font-family: inherit; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.auth-msg { text-align: center; margin-top: 14px; font-size: 13px; min-height: 20px; }
.auth-msg.error { color: var(--danger); }
.auth-msg.success { color: var(--success); }

.auth-links { display: flex; justify-content: space-between; margin-top: 14px; }
.auth-links a { color: var(--primary); font-size: 13px; text-decoration: none; transition: opacity 0.2s; }
.auth-links a:hover { opacity: 0.8; }

.input-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.input-row .input-group { margin-bottom: 0; }

.captcha-img { 
  flex-shrink: 0; cursor: pointer; border-radius: var(--radius-sm);
  border: 1px solid var(--border); overflow: hidden; height: 44px;
  transition: border-color 0.2s;
}
.captcha-img:hover { border-color: var(--primary); }
.captcha-img svg { display: block; }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; white-space: nowrap; }

/* ===== 模态弹窗 ===== */
.modal-overlay {
  display: flex; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 20px; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 400px; padding: 28px 24px;
  animation: fadeInUp 0.3s ease;
}
.modal h2 { margin-bottom: 16px; }
.modal hr { border: none; border-top: 1px solid var(--border); }

/* ===== 主面板布局 ===== */
#mainPage { min-height: 100vh; padding-bottom: 80px; }

.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; border-radius: 0;
  border-left: none; border-right: none; border-top: none;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); }
.topbar-brand svg { color: var(--primary); }
.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-points {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 20px;
  background: rgba(245,158,11,0.12); font-size: 13px; color: var(--warning);
}
.points-icon { font-size: 8px; }
.user-name { font-size: 13px; color: var(--text-dim); }

.main-content { display: flex; max-width: 1200px; margin: 0 auto; padding: 20px; gap: 20px; }

/* 侧边栏 */
.sidebar {
  width: 200px; flex-shrink: 0; padding: 12px;
  position: sticky; top: 76px; height: fit-content;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim); font-size: 14px;
  cursor: pointer; transition: all 0.2s; font-family: inherit; text-align: left;
}
.sidebar-item:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-item.active { background: rgba(99,102,241,0.12); color: var(--primary); font-weight: 600; }
.sidebar-item svg { flex-shrink: 0; }

.panel-container { flex: 1; min-width: 0; }

/* 移动端导航 */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10,14,23,0.95); border-top: 1px solid var(--border);
  backdrop-filter: blur(20px); padding: 6px 0 env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px; border: none; background: transparent; color: var(--text-dim);
  font-size: 10px; cursor: pointer; font-family: inherit; transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }

/* ===== QQ扫码面板 ===== */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.qr-section { padding: 24px; text-align: center; }
.qr-section .btn-primary { margin-top: 12px; }

.panel-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

.qr-box {
  width: 180px; height: 180px; margin: 0 auto;
  border-radius: 12px; background: #fff; display: flex;
  align-items: center; justify-content: center; position: relative;
  overflow: hidden;
}
.qr-box img { width: 160px; height: 160px; border-radius: 4px; }
.qr-loading, .qr-error, .qr-expired {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #94a3b8; font-size: 12px;
}
.qr-error { color: var(--danger); }
.qr-expired {
  position: absolute; inset: 0; background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 8px; font-size: 13px; color: #64748b;
}

.spinner-ring {
  width: 28px; height: 28px; border: 3px solid #e2e8f0;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.qr-status { margin-top: 10px; font-size: 13px; min-height: 20px; color: var(--text-dim); }

.scan-info { padding: 24px; }
.info-item {
  display: flex; justify-content: space-between; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--text-dim); font-size: 13px; }
.info-value { font-size: 14px; font-weight: 500; }
.success-text { color: var(--success); }
.running-text { color: var(--primary); }
.warning-text { color: var(--warning); }

/* 任务编号 */
.task-no-value { font-family: 'SF Mono','Monaco','Menlo',monospace; color: var(--primary); font-weight: 700; }
.bubble-task-no { font-size: 10px; color: var(--primary); background: rgba(99,102,241,0.12); padding: 1px 6px; border-radius: 4px; margin-left: 4px; font-family: 'SF Mono','Monaco','Menlo',monospace; }
.bubble-progress { color: var(--primary); font-weight: 600; }

/* ===== 任务气泡列表 ===== */
.bubble-list { display: flex; flex-direction: column; gap: 10px; }
.bubble-item {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
}
.bubble-item:hover { background: var(--surface-hover); border-color: var(--primary); transform: translateX(4px); }

.bubble-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
}

.bubble-body { flex: 1; min-width: 0; }
.bubble-name { font-weight: 600; font-size: 15px; }
.bubble-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.bubble-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.bubble-badge.pending { background: rgba(245,158,11,0.12); color: var(--warning); }
.bubble-badge.running { background: rgba(99,102,241,0.12); color: var(--primary); }
.bubble-badge.paused { background: rgba(245,158,11,0.12); color: var(--warning); }
.bubble-badge.completed { background: rgba(34,197,94,0.12); color: var(--success); }

.bubble-arrow { color: var(--text-dim); flex-shrink: 0; opacity: 0.5; }
.bubble-item:hover .bubble-arrow { opacity: 1; }

/* ===== 进度条 ===== */
.progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.progress-bar {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 3px; transition: width 0.5s ease;
}
.progress-fill.paused { background: linear-gradient(90deg, var(--warning), #d97706); }

/* 暂停/恢复按钮 */
.btn-warning {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; font-family: inherit; width: 100%;
  box-shadow: 0 4px 15px rgba(245,158,11,0.3);
}
.btn-warning:hover { transform: translateY(-1px); box-shadow: 0 6px 25px rgba(245,158,11,0.4); }
.btn-warning:active { transform: translateY(0); }

/* ===== 任务面板 ===== */
.task-control { padding: 24px; margin-bottom: 20px; }
.task-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.task-stats { display: flex; gap: 16px; font-size: 13px; color: var(--text-dim); }
.task-stats strong { color: var(--text); }

.task-running {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 13px; color: var(--primary); justify-content: center;
}
.task-count-hint {
  text-align: center; font-size: 12px; color: var(--text-dim); margin-top: 8px;
}
.task-count-hint strong { color: var(--warning); }
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); animation: pulse 1.2s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.8); }
}

.task-list-card { padding: 24px; }
.task-list { max-height: 500px; overflow-y: auto; }
.task-list::-webkit-scrollbar { width: 4px; }
.task-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.task-empty { text-align: center; color: var(--text-dim); padding: 40px 0; font-size: 14px; }

.task-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); animation: slideIn 0.4s ease;
  transition: background 0.2s;
}
.task-item:hover { background: var(--surface-hover); }
.task-item:last-child { border-bottom: none; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.task-item-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(99,102,241,0.12); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--primary); font-size: 16px;
}
.task-item-info { flex: 1; min-width: 0; }
.task-item-ip { font-weight: 600; font-size: 14px; font-family: 'SF Mono','Monaco','Menlo',monospace; }
.task-item-region { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.task-item-meta { text-align: right; flex-shrink: 0; }
.task-item-time { font-size: 11px; color: var(--text-dim); }
.task-item-status { font-size: 11px; color: var(--success); margin-top: 2px; }
.task-item-nickname { font-size: 11px; color: var(--primary); margin-top: 2px; }

/* ===== 分页 ===== */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 0 4px; border-top: 1px solid var(--border); margin-top: 16px;
}

/* ===== 充值面板 ===== */
.panel-desc { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.redeem-msg { margin-top: 12px; font-size: 13px; min-height: 20px; text-align: center; }
.redeem-msg.success { color: var(--success); }
.redeem-msg.error { color: var(--danger); }

.points-info { text-align: center; padding: 20px 0; }
.points-big { font-size: 48px; font-weight: 800; background: linear-gradient(135deg, var(--primary), #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.points-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .main-content { padding: 12px; padding-bottom: 80px; }
  .topbar { padding: 0 14px; }
  .topbar-brand span { display: none; }
  .panel-grid { grid-template-columns: 1fr; }
  .task-header { flex-direction: column; }
  .task-item { flex-wrap: wrap; }
  .task-item-meta { width: 100%; text-align: left; padding-left: 48px; }
  .btn-lg { padding: 12px 24px; font-size: 15px; }
}

@media (max-width: 480px) {
  .auth-container { padding: 24px 20px; }
  .topbar-user { gap: 8px; }
  .user-points { font-size: 11px; padding: 4px 8px; }
  .user-name { font-size: 12px; }
}
