/* frontend/assets/style.css */
:root {
  --primary: #1E6FFF;
  --primary-hover: #0E5AE0;
  --primary-light: #EBF3FF;
  --success: #07C160;
  --warning: #FA9D3B;
  --danger: #FA5151;
  --bg: #F4F6F9;
  --card-bg: #FFFFFF;
  --text-main: #1F2329;
  --text-sub: #4E5969;
  --text-muted: #8F959E;
  --border: #E5E6EB;
  --sidebar-w: 240px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: #181B22;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-icon {
  font-size: 28px;
}

.brand-title {
  font-size: 16px;
  font-weight: bold;
}

.brand-badge {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.nav-menu {
  list-style: none;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #A4ABB7;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--primary);
  color: #FFFFFF;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #6C7280;
  text-align: center;
}

/* Main Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  background: var(--card-bg);
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.page-title {
  font-size: 18px;
  font-weight: bold;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--success);
  background: #E8FFEA;
  padding: 6px 12px;
  border-radius: 20px;
}

.api-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.content-body {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-sub);
}

.stat-icon {
  font-size: 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-main);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Table Card */
.table-card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input, .select-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #FAFAFA;
}

.search-input:focus, .select-input:focus {
  border-color: var(--primary);
  background: #FFF;
}

.search-input {
  width: 260px;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #FFF;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: #FFF;
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.btn-outline:hover {
  background: #F7F8FA;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: #FAFAFA;
  color: var(--text-sub);
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover {
  background: #F8F9FB;
}

.tool-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-icon {
  font-size: 22px;
}

.tool-title {
  font-weight: 600;
  color: var(--text-main);
}

.tool-id {
  font-size: 11px;
  color: var(--text-muted);
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.badge-vip {
  background: #FFF7E8;
  color: #D48806;
  border: 1px solid #FFE4BA;
}

.badge-free {
  background: #F2F3F5;
  color: var(--text-sub);
}

.badge-hot {
  background: #FFECE8;
  color: var(--danger);
}

.badge-active {
  background: #E8FFEA;
  color: var(--success);
}

.badge-inactive {
  background: #F2F3F5;
  color: var(--text-muted);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #E5E6EB;
  transition: .2s;
  border-radius: 20px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--primary);
}

input:checked + .slider-round:before {
  transform: translateX(18px);
}

.weight-input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
}

/* Modal */
.modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: #FFF;
  border-radius: 12px;
  width: 480px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.modal-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ================= 工具名称与描述行内编辑样式 ================= */
.inline-name-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.inline-name-input:hover {
  background: #F2F3F5;
  border-color: #DCDFE6;
  cursor: text;
}

.inline-name-input:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30, 111, 255, 0.15);
}

.summary-cell-wrap {
  width: 100%;
}

.inline-summary-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-sub);
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
  box-sizing: border-box;
  font-family: inherit;
}

.inline-summary-input:hover {
  background: #F2F3F5;
  border-color: #DCDFE6;
  color: var(--text-main);
}

.inline-summary-input:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  color: var(--text-main);
  box-shadow: 0 0 0 2px rgba(30, 111, 255, 0.15);
}

.filter-stats-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-sub);
  background: #F2F3F5;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.vip-tag-icon {
  font-size: 13px;
  line-height: 1;
}

/* ================= 浮层轻量操作反馈 Toast ================= */
.admin-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 10px 18px;
  background: rgba(31, 35, 41, 0.9);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast.toast-success {
  background: #07C160;
}

.admin-toast.toast-warning {
  background: #FA9D3B;
}

/* ================= 顶栏退出登录按钮 ================= */
.admin-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-logout {
  background: #FFF0F0;
  color: #D32029;
  border: 1px solid #FFCCC7;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-logout:hover {
  background: #FF4D4F;
  color: #FFFFFF;
  border-color: #FF4D4F;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(255, 77, 79, 0.25);
}

/* ================= 全屏登录模态框 ================= */
html.require-login #adminLoginModal {
  display: flex !important;
}
html.require-login .main-wrapper,
html.require-login .sidebar {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.login-card {
  width: 420px;
  max-width: 90vw;
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
  padding: 36px 32px 32px;
  box-sizing: border-box;
}

.login-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-badge {
  font-size: 40px;
  width: 64px;
  height: 64px;
  line-height: 64px;
  background: #F0F5FF;
  border-radius: 16px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1F2329;
  margin: 0 0 6px;
}

.login-card-header p {
  font-size: 13px;
  color: #8F959E;
  margin: 0;
}

.login-alert-box {
  background: #FFF1F0;
  border: 1px solid #FFA39E;
  color: #CF1322;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-form-group {
  margin-bottom: 18px;
}

.login-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #333842;
  margin-bottom: 6px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 12px;
  font-size: 16px;
  pointer-events: none;
  opacity: 0.7;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px 11px 40px;
  border: 1.5px solid #E5E6EB;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: #F8F9FA;
}

.login-input:focus {
  border-color: #1E6FFF;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(30, 111, 255, 0.12);
}

.login-hint {
  font-size: 12px;
  color: #8F959E;
  background: #F4F6F9;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 22px;
  line-height: 1.4;
}

.login-hint code {
  color: #1E6FFF;
  font-weight: 600;
}

.btn-login-submit {
  width: 100%;
  padding: 12px;
  background: #1E6FFF;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login-submit:hover {
  background: #0E56D9;
  box-shadow: 0 4px 14px rgba(30, 111, 255, 0.35);
  transform: translateY(-1px);
}

.btn-login-submit:disabled {
  background: #94BFFF;
  cursor: not-allowed;
  transform: none;
}

/* ================= 运营大盘：8大场景分类进度条 ================= */
.category-dist-item {
  padding: 6px 0;
}

.cat-dist-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.cat-dist-name {
  color: #1F2329;
  font-weight: 500;
}

.cat-dist-meta {
  color: #646A73;
  font-size: 12px;
}

.cat-dist-meta strong {
  color: #1E6FFF;
}

.cat-progress-bg {
  width: 100%;
  height: 7px;
  background: #EEF0F3;
  border-radius: 4px;
  overflow: hidden;
}

.cat-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1E6FFF 0%, #36B37E 100%);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================= 运营大盘：Top 5 热门榜单 ================= */
.top-tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #F8F9FA;
  border-radius: 8px;
  transition: background 0.15s;
}

.top-tool-item:hover {
  background: #F0F4FA;
}

.top-tool-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: #E5E6EB;
  color: #646A73;
}

.rank-badge.rank-1 {
  background: #FF4D4F;
  color: #FFFFFF;
}

.rank-badge.rank-2 {
  background: #FA8C16;
  color: #FFFFFF;
}

.rank-badge.rank-3 {
  background: #FADB14;
  color: #593800;
}

.top-tool-icon {
  font-size: 20px;
}

.top-tool-info {
  display: flex;
  flex-direction: column;
}

.top-tool-name {
  font-size: 13px;
  font-weight: 600;
  color: #1F2329;
}

.top-tool-cat {
  font-size: 11px;
  color: #8F959E;
  margin-top: 1px;
}

.top-tool-calls {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.top-calls-num {
  font-size: 14px;
  font-weight: 700;
  color: #1E6FFF;
}

.top-calls-unit {
  font-size: 11px;
  color: #8F959E;
}

