/* ═════════════════════════════════════════════════════════════════ */
/* 后台管理系统 - 全局样式 */
/* ═════════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 标签样式 */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* 用户标签样式 */
.user-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  font-weight: 500;
}

:root {
  --primary: #0f172a;
  --secondary: #14b8a6;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --light: #e2e8f0;
  --dark: #020617;
  --gray: #94a3b8;
  --white: #ffffff;
  --border: #334155;
  --panel: #111827;
  --canvas: #f3f7fb;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.16);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--canvas);
  color: #0f172a;
  font-size: 14px;
  line-height: 1.6;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 登录页面 */
/* ═════════════════════════════════════════════════════════════════ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.18), transparent 28%),
    linear-gradient(135deg, #020617 0%, #0f172a 50%, #111827 100%);
}

.login-box {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.35);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.console-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo i {
  font-size: 40px;
  color: var(--secondary);
  margin-bottom: 10px;
}

.login-logo h1 {
  font-size: 24px;
  margin: 10px 0;
  color: #2c3e50;
}

.login-logo p {
  color: #64748b;
  font-size: 12px;
}

.login-note {
  text-align: center;
  color: #64748b;
  font-size: 13px;
  margin-bottom: 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-group {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 2px solid #ecf0f1;
  transition: border-color 0.3s;
}

.form-group i {
  color: #bdc3c7;
  margin-right: 10px;
  font-size: 16px;
}

.form-group input {
  flex: 1;
  border: none;
  padding: 12px 0;
  font-size: 14px;
  background: transparent;
  outline: none;
}

.form-group input::placeholder {
  color: #bdc3c7;
}

.form-group:focus-within {
  border-color: var(--secondary);
}

.form-group:focus-within i {
  color: var(--secondary);
}

.error-message {
  color: #e74c3c;
  font-size: 12px;
  text-align: center;
  min-height: 16px;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 按钮 */
/* ═════════════════════════════════════════════════════════════════ */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0f9f91 0%, #0284c7 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-success:hover {
  background: #229954;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 后台主界面 */
/* ═════════════════════════════════════════════════════════════════ */

.admin-page {
  display: flex;
  min-height: 100vh;
}

.admin-page.hidden {
  display: none;
}

/* 侧边栏 */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #020617 0%, #0f172a 45%, #111827 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: bold;
}

.sidebar-header i {
  font-size: 24px;
  color: var(--secondary);
}

.sidebar-branding {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.sidebar-branding small {
  font-size: 11px;
  color: rgba(226, 232, 240, 0.7);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
}

.nav-item {
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding-left: 22px;
}

.nav-item.active {
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
  border-left-color: #2dd4bf;
}

.sidebar-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
}

/* 主内容区 */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f8fbfd 0%, #eef4f8 100%);
}

/* 顶部栏 */
.topbar {
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.console-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.console-chip {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.console-title {
  color: #334155;
  font-weight: 700;
}

.topbar-link {
  color: #0f766e;
  text-decoration: none;
  font-weight: 600;
}

.topbar-link:hover {
  color: #115e59;
}

.admin-name {
  font-weight: 500;
  color: var(--primary);
}

.admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

/* 内容区 */
.content-wrapper {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 页面内容 */
/* ═════════════════════════════════════════════════════════════════ */

.page {
  display: none;
  animation: fadeIn 0.3s;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #dbe7ef;
}

.page-header h2 {
  font-size: 24px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #dbe7ef;
  border-radius: 12px;
  padding: 8px 15px;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.search-box i {
  color: #bdc3c7;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 14px;
  width: 200px;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 数据卡片 */
/* ═════════════════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 1px solid rgba(219, 231, 239, 0.9);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
}

.stat-icon.users {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.api {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.wechat {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-info h3 {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 5px;
}

.stat-info p {
  color: #95a5a6;
  font-size: 12px;
}

.update-time {
  color: #95a5a6;
  font-size: 12px;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 图表和表格 */
/* ═════════════════════════════════════════════════════════════════ */

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.chart-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(219, 231, 239, 0.9);
}

.chart-card h3 {
  font-size: 16px;
  margin-bottom: 20px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-placeholder {
  height: 300px;
  background: #f5f7fa;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bdc3c7;
}

.table-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  border: 1px solid rgba(219, 231, 239, 0.9);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: #f5f7fa;
  border-bottom: 2px solid #ecf0f1;
}

.data-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: var(--primary);
}

.data-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #ecf0f1;
}

.data-table tbody tr:hover {
  background: #f5f7fa;
}

.data-table .loading {
  text-align: center;
  color: #bdc3c7;
}

.data-table .empty-state {
  text-align: center;
  padding: 30px;
  color: #bdc3c7;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 最近操作日志 */
/* ═════════════════════════════════════════════════════════════════ */

.recent-logs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.log-item {
  padding: 12px;
  background: #f5f7fa;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.log-action {
  color: var(--primary);
  font-weight: 500;
}

.log-user {
  color: #95a5a6;
}

.log-time {
  color: #bdc3c7;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 分页 */
/* ═════════════════════════════════════════════════════════════════ */

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid #ecf0f1;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.pagination button:hover:not(.disabled),
.pagination button.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.pagination button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 模态框 */
/* ═════════════════════════════════════════════════════════════════ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 10px;
  padding: 30px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
  font-size: 18px;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #bdc3c7;
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid #ecf0f1;
}

/* ═════════════════════════════════════════════════════════════════ */
/* 表单 */
/* ═════════════════════════════════════════════════════════════════ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.form-item {
  display: flex;
  flex-direction: column;
}

.form-item label {
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--primary);
}

.form-item input,
.form-item textarea,
.form-item select {
  padding: 10px;
  border: 1px solid #ecf0f1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}

.form-item input:focus,
.form-item textarea:focus,
.form-item select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ═════════════════════════════════════════════════════════════════ */
/* 响应式 */
/* ═════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    width: 100%;
    z-index: 150;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .topbar {
    padding: 15px 20px;
  }

  .topbar-left {
    gap: 10px;
  }

  .console-title,
  .topbar-link {
    display: none;
  }

  .content-wrapper {
    padding: 20px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .page-actions {
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-charts {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 10px;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }
}

/* 支付统计小卡片 */
.stats-mini {
  display: flex;
  gap: 20px;
}

.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-mini .label {
  font-size: 12px;
  color: var(--gray);
}

.stat-mini .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
}

/* 订阅状态样式 */
.badge.secondary {
  background: #f5f5f5;
  color: #999;
  border: 1px solid #e0e0e0;
}

/* 表单样式增强 */
.form-item select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

.form-item select:focus {
  outline: none;
  border-color: #07c160;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.1);
}

.form-item textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
}

.form-item textarea:focus {
  outline: none;
  border-color: #07c160;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.1);
}

/* 按钮尺寸 */
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-sm i {
  margin-right: 2px;
}

/* 表格悬停效果 */
.data-table tbody tr:hover {
  background: #f8f9fa;
}
