/*
 * admin-fixed-light.css — 早富康后台管理完整样式（浅色清爽主题）
 *
 * 用法: 在 admin.css 之后引入
 * <link rel="stylesheet" href="/static/css/admin.css">
 * <link rel="stylesheet" href="/static/css/admin-fixed-light.css">
 *
 * 设计规范:
 * - 左侧菜单: 浅蓝色背景 #eaf3fa（文字深色）
 * - 内容区: 白色背景 #ffffff
 * - 顶部导航: 固定，浅蓝渐变
 * - 整体清爽浅色风格
 */

/* =================================================================
   0. 基础重置
   ================================================================= */
body {
  margin: 0;
  padding: 0;
  background: #f5f7fa !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #333 !important;
}

.layui-fluid { padding: 20px; }

/* =================================================================
   1. 页面标题
   ================================================================= */
.page-title {
  font-size: 22px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0 0 5px 0;
  padding: 0 20px;
}
.page-desc {
  font-size: 14px;
  color: #999;
  margin-bottom: 20px;
  padding: 0 20px;
}

/* =================================================================
   2. 卡片 — 白色背景，浅阴影
   ================================================================= */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 0 20px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #e8ecf1;
}
.card-title {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

/* =================================================================
   3. 统计卡片网格
   ================================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 0 20px 20px;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border: 1px solid #e8ecf1;
}
.stat-card .num {
  font-size: 32px;
  font-weight: bold;
  color: #2c6b9e;
  margin-bottom: 8px;
}
.stat-card .lbl {
  font-size: 14px;
  color: #999;
}

/* =================================================================
   4. 两列布局
   ================================================================= */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 0 20px 20px;
}
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
}

/* =================================================================
   5. 顶部导航 — 固定，浅蓝渐变
   ================================================================= */
.admin-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #d6e8f7 0%, #c5dff0 100%);
  color: #2c3e50;
  padding: 0 30px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #c0d8ea;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.logo {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
}
.logo small {
  font-size: 13px;
  font-weight: normal;
  opacity: 0.6;
  color: #5a7a9a;
}
.user-info {
  font-size: 14px;
  color: #4a6a8a;
}
.user-info a {
  color: #3a6a9a !important;
}
.user-info a:hover {
  color: #1a4a7a !important;
}

/* =================================================================
   6. 主体容器 — flex 左右并排
   ================================================================= */
.admin-body {
  display: flex;
  padding-top: 56px;
  min-height: 100vh;
  box-sizing: border-box;
}

/* =================================================================
   7. 左侧菜单 — 浅蓝色 #eaf3fa
   ================================================================= */
.admin-side {
  width: 220px;
  min-width: 220px;
  background: #eaf3fa !important;
  border-right: 1px solid #d5e2ed;
  padding: 10px 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}
.group-title {
  font-size: 11px;
  color: #7a9ab8;
  padding: 15px 20px 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  color: #3a5a7a;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #1a4a7a;
}
.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: #1a4a7a;
  font-weight: bold;
  border-left-color: #3b82f6;
}
.nav-item .icon {
  margin-right: 8px;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* 父菜单展开箭头 */
.nav-item.has-children::after {
  content: "▸";
  margin-left: auto;
  font-size: 10px;
  opacity: 0.4;
  transition: transform 0.2s;
}
.nav-item.has-children.expanded::after {
  transform: rotate(90deg);
}

/* 子菜单容器 */
.nav-children {
  display: none;
}
.nav-children.open {
  display: block;
}

/* 子菜单项 — 缩进显示 */
.nav-sub {
  padding-left: 48px !important;
  font-size: 13px;
  color: #4a7a9a !important;
}
.nav-sub:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #1a4a7a !important;
}
.nav-sub.active {
  background: rgba(59, 130, 246, 0.12);
  color: #1a4a7a !important;
  border-left-color: #3b82f6;
}

/* =================================================================
   8. 主内容区 — 白色背景
   ================================================================= */
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 20px;
  background: #ffffff !important;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
  box-sizing: border-box;
}

/* =================================================================
   9. 标签
   ================================================================= */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
}
.tag-green  { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.tag-orange { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.tag-red    { background: #fbe9e7; color: #c62828; border: 1px solid #ffccbc; }
.tag-gray   { background: #f5f5f5; color: #757575; border: 1px solid #e0e0e0; }
.tag-blue   { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.tag-cyan   { background: #e0f7fa; color: #00838f; border: 1px solid #b2ebf2; }

/* =================================================================
   10. 筛选栏
   ================================================================= */
.filter-bar {
  margin-bottom: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar label,
.field label {
  color: #555;
}
.filter-bar .layui-input {
  display: inline-block;
  width: auto;
}

/* =================================================================
   11. Tab 切换
   ================================================================= */
.tabs {
  display: flex;
  margin: 0 0 20px 0;
  border-bottom: 2px solid #e8ecf1;
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  color: #888;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab:hover { color: #3b82f6; }
.tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  font-weight: bold;
}

/* =================================================================
   12. 分页
   ================================================================= */
.pagination {
  text-align: right;
  margin-top: 10px;
}

/* =================================================================
   13. Layui 组件覆盖 — 浅色主题
   ================================================================= */

/* 卡片 */
.layui-card-body { padding: 15px; }
.layui-card {
  background: #fff !important;
  border: 1px solid #e8ecf1 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04) !important;
}
.layui-card-header {
  background: #fafbfc !important;
  color: #333 !important;
  border-bottom: 1px solid #e8ecf1 !important;
}

/* 表格 — 白底规范表格 */
.layui-table {
  color: #333;
  background: #fff;
}
.layui-table thead tr {
  background: #f5f7fa;
}
.layui-table th {
  color: #555;
  background: #f5f7fa;
  border-color: #e8ecf1;
  font-weight: 600;
}
.layui-table td,
.layui-table th {
  border-color: #e8ecf1;
}
.layui-table tr {
  background: #fff;
}
.layui-table tr:hover {
  background: #f0f6ff;
}
.layui-table tr:nth-child(even) {
  background: #fafbfc;
}
.layui-table[lay-skin="line"] {
  border: none;
}
.layui-table[lay-skin="line"] tr {
  border-bottom: 1px solid #e8ecf1;
}
.layui-table a {
  color: #3b82f6;
}
.layui-table a:hover {
  color: #2563eb;
}

/* 输入框 */
.layui-input,
.layui-select,
.layui-textarea {
  background: #fff;
  color: #333;
  border-color: #d8dce3;
  border-radius: 4px;
  transition: border-color 0.2s;
}
.layui-input:focus,
.layui-select:focus,
.layui-textarea:focus {
  border-color: #3b82f6 !important;
}
.layui-input::-webkit-input-placeholder {
  color: #bbb;
}
.filter-bar .layui-input,
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
  background: #fff;
  color: #333;
  border-color: #d8dce3;
}

/* 按钮 */
.layui-btn {
  background: #3b82f6;
}
.layui-btn:hover {
  background: #2563eb;
}
.layui-btn-primary {
  background: #fff;
  color: #555;
  border: 1px solid #d8dce3;
}
.layui-btn-primary:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #f0f6ff;
}
.layui-btn-normal {
  background: #5b9cf5;
}
.layui-btn-normal:hover {
  background: #4a8be4;
}
.layui-btn-danger {
  background: #e85555;
}
.layui-btn-danger:hover {
  background: #d44444;
}
.layui-btn-warm {
  background: #FF8C00;
  border-color: #FF8C00;
  color: #fff;
}
.layui-btn-warm:hover {
  background: #e67e00;
  border-color: #e67e00;
  color: #fff;
}
.layui-btn-warm.layui-btn-disabled,
.layui-btn-warm[disabled] {
  background: #ffb84d;
  border-color: #ffb84d;
  color: #fff6e6;
}

/* 分页 */
.layui-laypage a,
.layui-laypage span {
  background: #fff;
  color: #555;
  border-color: #e0e0e0;
}
.layui-laypage a:hover {
  background: #f0f6ff;
  color: #3b82f6;
}
.layui-laypage .layui-laypage-curr .layui-laypage-em {
  background-color: #3b82f6;
}

/* 弹窗 */
.layui-layer {
  background: #fff !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}
.layui-layer-title {
  background: #fafbfc !important;
  color: #333 !important;
  border-bottom: 1px solid #e8ecf1 !important;
}
.layui-layer-content {
  color: #333;
}

/* Select option */
select option {
  background: #fff;
  color: #333;
}

/* =================================================================
   14. form-group — 表单组
   ================================================================= */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 5px;
}
.form-group .layui-input,
.form-group .layui-select,
.form-group .layui-textarea {
  width: 100%;
}

/* =================================================================
   15. detail-grid — 详情网格
   ================================================================= */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.detail-grid .item {
  background: #f5f7fa;
  border-radius: 6px;
  padding: 14px;
}
.detail-grid .item .l {
  font-size: 12px;
  color: #999;
}
.detail-grid .item .v {
  font-size: 14px;
  color: #333;
  margin-top: 4px;
  font-weight: 500;
}
@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 600px) {
  .detail-grid {
    grid-template-columns: 1fr !important;
  }
}

/* =================================================================
   16. order-actions — 按钮组
   ================================================================= */
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.order-actions .layui-btn {
  flex-shrink: 0;
}

/* =================================================================
   17. code-block — 代码块
   ================================================================= */
.code-block {
  background: #f5f5f5;
  border-radius: 4px;
  padding: 12px 16px;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* =================================================================
   18. 空状态 / 加载态
   ================================================================= */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-state p {
  font-size: 14px;
  margin-top: 8px;
}
.loading-state {
  text-align: center;
  padding: 30px 20px;
  color: #999;
}
.loading-state .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e8ecf1;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: lf-spin 0.8s linear infinite;
}
@keyframes lf-spin {
  to { transform: rotate(360deg); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =================================================================
   19. 分割线 / 提示
   ================================================================= */
.divider {
  height: 1px;
  background: #e8ecf1;
  margin: 16px 0;
}
.card-hint {
  font-size: 12px;
  color: #999;
  padding: 6px 0;
}

/* =================================================================
   20. 按钮间距
   ================================================================= */
.layui-btn + .layui-btn {
  margin-left: 6px;
}
.layui-btn-xs + .layui-btn-xs {
  margin-left: 4px;
}

/* =================================================================
   21. 通用工具
   ================================================================= */
a { color: #3b82f6; }
a:hover { color: #2563eb; }
.text-right { text-align: right; }
.flex-1 { flex: 1; }

/* =================================================================
   22. 响应式
   ================================================================= */
@media (max-width: 1200px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .layui-col-space15 > [class*="layui-col-md"] {
    width: 100% !important;
  }
}
@media (max-width: 768px) {
  .admin-side {
    width: 56px;
    min-width: 56px;
  }
  .admin-side .nav-item {
    justify-content: center;
    padding: 12px 8px;
  }
  .admin-side .nav-item span:not(.icon) {
    display: none;
  }
  .admin-side .group-title {
    text-align: center;
    font-size: 9px;
  }
  .admin-side .nav-item.has-children::after {
    content: "" !important;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-bar {
    gap: 6px;
  }
  .filter-bar .layui-input {
    min-width: 0;
    width: auto;
    flex: 1 1 120px;
  }
  .admin-main {
    padding: 12px;
  }
  .page-title {
    padding: 0 12px;
  }
  .page-desc {
    padding: 0 12px;
  }
  .card {
    margin: 0 12px 12px;
  }
  .stat-grid {
    margin: 0 12px 12px;
  }
}

/* 小屏菜单展开（配合 JS） */
@media (max-width: 768px) {
  .admin-side.expanded {
    width: 220px;
    min-width: 220px;
    position: absolute;
    z-index: 999;
    height: calc(100vh - 56px);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  }
  .admin-side.expanded .nav-item span:not(.icon) {
    display: inline;
  }
  .admin-side.expanded .group-title {
    text-align: left;
  }
  .admin-side.expanded .nav-item.has-children::after {
    content: "▸" !important;
  }
}

/* =================================================================
   23. 表单内联按钮组
   ================================================================= */
.form-actions {
  margin-top: 16px;
}
.form-actions .layui-btn {
  margin-right: 8px;
}

/* =================================================================
   24. 筛选栏输入框宽度正确性
   ================================================================= */
.filter-bar .layui-input,
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
  border-color: #d8dce3;
}
