/* =====================================================================
   pages.css — 各业务页面样式
   ===================================================================== */

/* ===================== 首页数据总览 ===================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 26px;
  margin-bottom: 24px;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 14px;
  color: #606266;
  min-width: 0;
}

.stat-item__label {
  white-space: nowrap;
}

.stat-item__value {
  color: #606266;
  font-variant-numeric: tabular-nums;
}

.stat-item.is-active .stat-item__label,
.stat-item.is-active .stat-item__value {
  color: var(--el-color-primary);
  font-weight: 600;
}

.chart-block {
  position: relative;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  margin: 6px 0 4px;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #606266;
}

.chart-legend__swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: none;
}

#stat-chart {
  width: 100%;
  height: 460px;
}

.chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--el-text-secondary);
}

/* ===================== 角色说明 ===================== */
.role-notes {
  margin-top: 18px;
  border-top: 1px solid var(--el-border-color-lighter);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: #606266;
  line-height: 1.7;
}

.role-notes b {
  color: #303133;
}

/* ===================== 日志 ===================== */
.log-level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

.log-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.log-dot--info { background: var(--el-color-primary); }
.log-dot--warn { background: var(--el-color-warning); }
.log-dot--error { background: var(--el-color-danger); }
.log-dot--success { background: var(--el-color-success); }

.log-detail {
  color: var(--el-text-secondary);
  font-size: 12.5px;
  margin-top: 2px;
}

/* ===================== 设置页 ===================== */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1180px) {
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.bg-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.bg-preset {
  position: relative;
  height: 62px;
  border-radius: 6px;
  border: 2px solid transparent;
  overflow: hidden;
  padding: 0;
  background: #f5f7fa;
  cursor: pointer;
}

.bg-preset.is-active {
  border-color: var(--el-color-primary);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.16);
}

.bg-preset__name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-preview {
  display: none;
  margin-top: 12px;
  border-radius: 6px;
  border: 1px solid var(--el-border-color-lighter);
  overflow: hidden;
  position: relative;
}

.bg-preview.is-visible {
  display: block;
}

.bg-preview img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.bg-preview__mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.2s;
}

.bg-preview:hover .bg-preview__mask {
  opacity: 1;
}

.bg-preview__mask .btn {
  border-color: #fff;
  color: #fff;
  background: transparent;
}

.bg-preview__mask .btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  border: 1px dashed var(--el-border-color);
  border-radius: 8px;
  background: #fafcff;
  color: var(--el-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.upload-drop:hover,
.upload-drop.is-over {
  border-color: var(--el-color-primary);
  background: var(--el-color-primary-light-9);
  color: var(--el-color-primary);
}

.upload-drop svg {
  width: 26px;
  height: 26px;
}

/* 登录页实时预览 */
.login-preview {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--el-border-color-lighter);
  height: 210px;
  position: relative;
  background-size: cover;
  background-position: center;
}

.login-preview__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  padding: 12px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.login-preview__panel h4 {
  font-size: 12px;
  color: #303133;
  margin-bottom: 8px;
}

.login-preview__input {
  height: 16px;
  border-radius: 3px;
  background: #f0f2f5;
  border: 1px solid #e4e7ed;
  margin-bottom: 6px;
}

.login-preview__btn {
  height: 16px;
  border-radius: 3px;
  background: var(--el-color-primary);
}

/* ===================== 前台配置 ===================== */
.code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 6px;
  padding: 14px 16px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

.code-block .c-key { color: #9cdcfe; }
.code-block .c-str { color: #ce9178; }
.code-block .c-num { color: #b5cea8; }
.code-block .c-com { color: #6a9955; }

/* ===================== 黑名单 ===================== */
.ip-mono {
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  color: #303133;
}

/* ===================== Telegram ===================== */
.tg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--el-border-color-extra-light);
}

.tg-row:last-child {
  border-bottom: none;
}

.tg-row__main {
  flex: 1;
  min-width: 0;
}

.tg-row__title {
  color: var(--el-text-primary);
  font-size: 14px;
}

.tg-row__sub {
  color: var(--el-text-secondary);
  font-size: 12px;
  margin-top: 2px;
}

/* ===================== 表单原生控件美化 ===================== */
.color-input {
  width: 42px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--el-border-color);
  border-radius: var(--el-radius);
  background: #fff;
  cursor: pointer;
  flex: none;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 120px;
  height: 20px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: #e4e7ed;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--el-color-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: #e4e7ed;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--el-color-primary);
}

input[type="date"] {
  color: var(--el-text-regular);
}

/* 目标页面的代码块换行处理 */
.code-block {
  max-height: 320px;
  overflow: auto;
}
