/* ============================================
   后台管理系统 - 全局样式
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  background: #f0f2f5;
  color: #333;
  display: flex;
  min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 220px;
  background: #001529;
  color: #fff;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.menu {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}

.menu a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.menu a.active {
  color: #fff;
  background: #1677ff;
}

.menu .icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ===== 主区域 ===== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 顶栏 */
.topbar {
  height: 60px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumb {
  font-size: 14px;
  color: #666;
}

.breadcrumb b {
  color: #333;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.topbar-right .bell {
  cursor: pointer;
  transition: transform 0.2s;
}

.topbar-right .bell:hover {
  transform: scale(1.15);
}

.topbar-right .username {
  color: #555;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1677ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

/* 内容区 */
.content {
  padding: 24px;
  flex: 1;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}

/* ===== 统计卡片 ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.card .c-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}

.c-blue {
  background: linear-gradient(135deg, #409eff, #1677ff);
}

.c-green {
  background: linear-gradient(135deg, #52c41a, #389e0d);
}

.c-orange {
  background: linear-gradient(135deg, #ffa940, #fa8c16);
}

.c-purple {
  background: linear-gradient(135deg, #9254de, #722ed1);
}

.card .c-info {
  min-width: 0;
}

.card .c-label {
  font-size: 13px;
  color: #888;
}

.card .c-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
  line-height: 1.2;
}

.card .c-trend {
  font-size: 12px;
  margin-top: 4px;
}

.up {
  color: #f5222d;
}

.down {
  color: #52c41a;
}

/* ===== 面板 ===== */
.panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.panel-header .more {
  font-size: 13px;
  color: #1677ff;
  cursor: pointer;
}

.panel-body {
  padding: 20px;
  overflow-x: auto;
}

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:hover {
  opacity: 0.85;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #1677ff;
  color: #fff;
}

.btn-default {
  background: #fff;
  color: #333;
  border: 1px solid #d9d9d9;
}

.search-box {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.search-box input {
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  width: 200px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: #1677ff;
}

/* ===== 表格 ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

th {
  background: #fafafa;
  color: #555;
  font-weight: 600;
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: #f5f8ff;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-success {
  background: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.tag-warning {
  background: #fff7e6;
  color: #fa8c16;
  border: 1px solid #ffd591;
}

.tag-danger {
  background: #fff1f0;
  color: #f5222d;
  border: 1px solid #ffa39e;
}

.op-link {
  color: #1677ff;
  cursor: pointer;
  margin-right: 12px;
  font-size: 13px;
}

.op-link:hover {
  text-decoration: underline;
}

.op-link.danger {
  color: #f5222d;
}

.empty-tip {
  display: none;
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 30px 0;
}

.empty-tip.show {
  display: block;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 16px;
  font-size: 14px;
  user-select: none;
}

.pagination span {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}

.pagination span:hover {
  border-color: #1677ff;
  color: #1677ff;
}

.pagination span.active {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

/* ===== 进度条 ===== */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.progress-row:last-child {
  margin-bottom: 0;
}

.progress-row .p-name {
  width: 70px;
  font-size: 14px;
  color: #555;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-row .p-val {
  width: 46px;
  text-align: right;
  font-size: 13px;
  color: #888;
  flex-shrink: 0;
}

/* ===== 提示浮层 ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translate(-50%, -20px);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .sidebar {
    width: 64px;
  }

  .logo {
    font-size: 0;
  }

  .logo::after {
    content: "⚙";
    font-size: 22px;
  }

  .menu a {
    justify-content: center;
    padding: 14px 0;
  }

  .menu a .text {
    display: none;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }

  .search-box {
    margin-left: 0;
    width: 100%;
  }

  .search-box input {
    flex: 1;
    width: auto;
    min-width: 0;
  }
}
