/* ========== 全局样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  padding-top: 60px;
}

/* ========== 导航栏 ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #eee;
  z-index: 1000;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, #3498db, #2ecc71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  text-decoration: none;
  font-size: 13px;
  color: #555;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-link:hover { background: #f0f2f5; color: #333; }
.nav-register {
  background: #3498db;
  color: white !important;
}
.nav-register:hover { background: #2980b9 !important; }
.nav-admin {
  background: #8e44ad;
  color: white !important;
}
.nav-admin:hover { background: #7d3c98 !important; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid #eee;
}
.nav-email { color: #888; }
.nav-level { margin-right: 4px; }
.nav-logout { color: #e74c3c; }

/* ========== Flash 消息 ========== */
.flash {
  max-width: 800px;
  margin: 12px auto;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.flash-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
}
.flash-close:hover { opacity: 1; }

/* ========== 主内容 ========== */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* ========== 认证页 ========== */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-header h1 { font-size: 24px; }
.auth-header p { color: #888; font-size: 14px; margin-top: 4px; }
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 4px;
}
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
  background: #fafafa;
}
.auth-form input:focus { border-color: #3498db; background: white; }
.form-checkbox label {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #888;
}
.auth-footer a { color: #3498db; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.btn-block { width: 100%; }

/* ========== 卡片样式 ========== */
.card {
  background: white;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2c3e50;
}

/* ========== 表单 ========== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 4px; }
.form-group .hint { font-size: 11px; color: #999; margin-top: 2px; }
input[type="text"], input[type="password"], input[type="email"], select, textarea {
  width: 100%; padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 8px;
  font-size: 14px; transition: border-color 0.2s; outline: none; background: #fafafa;
}
input:focus, select:focus, textarea:focus { border-color: #3498db; background: white; }
input[type="file"] {
  width: 100%; padding: 20px; border: 2px dashed #ccc; border-radius: 10px;
  font-size: 14px; cursor: pointer; text-align: center; transition: all 0.2s; background: #fafafa;
}
input[type="file"]:hover { border-color: #3498db; background: #f0f7ff; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hidden { display: none; }

/* ========== 按钮 ========== */
.btn {
  padding: 12px 28px; border: none; border-radius: 10px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #3498db; color: white; }
.btn-primary:hover:not(:disabled) { background: #2980b9; transform: translateY(-1px); }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover:not(:disabled) { background: #219a52; transform: translateY(-1px); }
.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover:not(:disabled) { background: #d68910; transform: translateY(-1px); }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover:not(:disabled) { background: #c0392b; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 2px solid #ccc; color: #666; }
.btn-outline:hover:not(:disabled) { border-color: #999; color: #333; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ========== 进度条 ========== */
.progress-wrap {
  background: #e8ecf1; border-radius: 10px; height: 24px; overflow: hidden;
  margin: 12px 0;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 10px; transition: width 0.5s ease;
}
.progress-bar.indeterminate {
  width: 30% !important;
  animation: slide 1.5s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
.progress-text {
  margin-top: 4px;
  font-size: 12px; font-weight: 600; color: #333;
  text-align: center;
}

/* ========== 日志 ========== */
.log {
  background: #1a1a2e; color: #e4e4e4; border-radius: 10px;
  padding: 16px; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; line-height: 1.7; max-height: 400px;
  overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.log .t-info { color: #6a9955; }
.log .t-warn { color: #dcdcaa; }
.log .t-error { color: #f48771; }
.log .t-success { color: #4ec9b0; }
.log .t-cmd { color: #569cd6; }
.log .t-detail { color: #888; }
.log .t-wait { color: #c5a55a; }
.log .t-divider { color: #444; border-top: 1px solid #333; margin: 6px 0; padding: 0; }
.log .dim { color: #666; }

/* ========== 状态栏 ========== */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 10px;
}
.status-bar.idle { background: #f0f2f5; color: #666; }
.status-bar.processing { background: #fff3cd; color: #856404; }
.status-bar.success { background: #d1fae5; color: #065f46; }
.status-bar.error { background: #fee2e2; color: #991b1b; }
.spinner {
  width: 16px; height: 16px; border: 2px solid #ddd;
  border-top: 2px solid #3498db; border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 结果框 ========== */
.result-box {
  border-radius: 10px; padding: 16px; margin-top: 10px; font-size: 14px; line-height: 1.8;
}
.result-box.success { background: #f0fdf4; border: 1px solid #86efac; }
.result-box.error { background: #fef2f2; border: 1px solid #fca5a5; }

/* ========== 标签 ========== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tag.blue { background: #dbeafe; color: #1d4ed8; }
.tag.green { background: #d1fae5; color: #065f46; }
.tag.orange { background: #fef3c7; color: #92400e; }
.tag.red { background: #fee2e2; color: #991b1b; }
.tag.gold { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.tag.purple { background: #f3e8ff; color: #6d28d9; border: 1px solid #a78bfa; }

/* ========== WS 状态 ========== */
.ws-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 3px 10px; border-radius: 12px;
}
.ws-indicator.connected { background: #d1fae5; color: #065f46; }
.ws-indicator.disconnected { background: #fee2e2; color: #991b1b; }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; }
.ws-indicator.connected .ws-dot { background: #27ae60; }
.ws-indicator.disconnected .ws-dot { background: #e74c3c; }

/* ========== Tab ========== */
.tab-bar { display: flex; border-bottom: 2px solid #eee; margin-bottom: 16px; }
.tab {
  padding: 10px 20px; cursor: pointer; color: #999; font-size: 14px;
  font-weight: 500; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
}
.tab:hover { color: #666; }
.tab.active { color: #3498db; border-bottom-color: #3498db; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== 模式选择 ========== */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.mode-option { position: relative; }
.mode-option input[type="radio"] { display: none; }
.mode-option label {
  display: block; padding: 14px 12px; border: 2px solid #e8ecf1; border-radius: 10px;
  text-align: center; cursor: pointer; transition: all 0.15s; background: #f8f9fb;
}
.mode-option input:checked + label {
  border-color: #3498db; background: #eff6ff; box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}
.mode-option label:hover { border-color: #b0c4de; }
.mode-option .icon { font-size: 26px; }
.mode-option .name { font-weight: 600; font-size: 14px; margin-top: 4px; }
.mode-option .desc { font-size: 11px; color: #999; margin-top: 2px; }

/* ========== 个人中心 ========== */
.profile-page { max-width: 700px; margin: 0 auto; }
.profile-header {
  display: flex; align-items: center; gap: 16px;
  background: white; border-radius: 16px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 20px;
}
.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #3498db, #2ecc71);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: bold;
}
.profile-info h2 { font-size: 20px; }
.profile-email { color: #888; font-size: 13px; margin: 2px 0; }
.quota-display { display: flex; align-items: center; gap: 20px; margin: 16px 0; }
.quota-stat { text-align: center; flex: 1; }
.quota-number { font-size: 36px; font-weight: 700; color: #3498db; display: block; }
.quota-label { font-size: 12px; color: #888; }
.quota-divider { width: 1px; height: 40px; background: #eee; }
.quota-bar-wrap {
  height: 8px; background: #f0f2f5; border-radius: 4px;
  overflow: hidden; margin: 10px 0;
}
.quota-bar {
  height: 100%; background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 4px; transition: width 0.5s;
}
.quota-hint { font-size: 11px; color: #999; text-align: center; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.plan-card {
  text-align: center; padding: 20px; border: 2px solid #eee;
  border-radius: 14px; background: #fafafa; position: relative;
}
.plan-card.plan-current { border-color: #3498db; background: #eff6ff; }
.plan-name { font-size: 18px; font-weight: 700; }
.plan-quota { font-size: 13px; color: #888; margin: 4px 0; }
.plan-price { margin: 10px 0; }
.price-num { font-size: 28px; font-weight: 700; color: #e67e22; }
.price-free { font-size: 20px; color: #27ae60; font-weight: 600; }
.plan-desc { font-size: 12px; color: #999; margin: 4px 0; }
.plan-badge {
  display: inline-block; background: #3498db; color: white;
  padding: 3px 12px; border-radius: 12px; font-size: 11px;
  margin-top: 8px;
}
.order-list { font-size: 13px; }
.order-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #f0f2f5;
}
.order-level { font-weight: 600; }
.order-amount { color: #e67e22; }
.order-paytype { color: #888; font-size: 12px; }
.order-time { color: #999; font-size: 11px; }

/* ========== 下载按钮 ========== */
.download-btn-sm {
  display: inline-block; padding: 4px 10px; background: #3498db; color: #fff;
  text-decoration: none; border-radius: 4px; font-size: 12px; white-space: nowrap;
}
.download-btn-sm:hover { background: #2980b9; }
.check-btn-sm {
  display: inline-block; padding: 4px 10px; background: #27ae60; color: #fff;
  border: none; border-radius: 4px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.check-btn-sm:hover { background: #219a52; }

/* ========== Modal ========== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; z-index: 2000;
}
.modal {
  background: white; border-radius: 16px; padding: 24px;
  max-width: 440px; width: 90%; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }
.modal-close:hover { color: #333; }
.modal-body-inner { padding: 0; }

/* ========== 后台管理 ========== */
.admin-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  gap: 20px;
}
.admin-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 76px;
  height: fit-content;
}
.admin-sidebar-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}
.admin-nav-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: all 0.1s;
}
.admin-nav-item:hover { background: #f0f2f5; color: #333; }
.admin-sidebar-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}
.admin-sidebar-footer a { font-size: 12px; color: #888; text-decoration: none; }
.admin-sidebar-footer a:hover { color: #3498db; }
.admin-main { flex: 1; min-width: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-card {
  background: white; border-radius: 12px; padding: 20px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-number { font-size: 28px; font-weight: 700; color: #3498db; }
.stat-label { font-size: 12px; color: #888; margin-top: 4px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  background: #f8f9fb;
  padding: 10px 8px;
  border: 1px solid #eee;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 8px;
  border: 1px solid #eee;
}
.admin-table tr:hover { background: #f5f7fa; }

.gradient-title {
  font-size: 26px;
  background: linear-gradient(135deg, #3498db, #2ecc71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .row { grid-template-columns: 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
  }
  .admin-sidebar-title { width: 100%; }
  .admin-nav-item { flex: 1; min-width: 80px; text-align: center; }
  .plan-grid { grid-template-columns: 1fr; }
}
