/* ==========================================================================
 * 远程广告发布系统 - 后台通用样式（平台总后台 + 门店子后台共用）
 * ========================================================================== */

/* ---------------------------- 主题色 ---------------------------- */
:root {
  --el-color-primary: #2a5298;
  --el-color-primary-light-3: #5b7cba;
  --el-color-primary-light-5: #879fcd;
  --el-color-primary-light-7: #b4c1e0;
  --el-color-primary-light-8: #cdd6ea;
  --el-color-primary-light-9: #e6eaf4;
  --el-color-primary-dark-2: #1e3c72;
  --adp-bg: #f2f4f8;
  --adp-aside: #1e2a44;
  --adp-aside-hover: #253356;
}

/* ---------------------------- 基础 ---------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--adp-bg);
  color: #303133;
  font-size: 14px;
}
a { color: var(--el-color-primary); text-decoration: none; }
a:hover { color: var(--el-color-primary-dark-2); }

/* 通用间距 */
.mt12 { margin-top: 12px !important; }
.mt16 { margin-top: 16px !important; }
.mb16 { margin-bottom: 16px !important; }
.mr8 { margin-right: 8px !important; }
.ml8 { margin-left: 8px !important; }
.text-muted { color: #909399; }
.text-danger { color: #f56c6c; }
.text-success { color: #67c23a; }
.text-warning { color: #e6a23c; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }

/* ==========================================================================
 *  登录页
 * ========================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 55%, #3f6bb5 100%);
  padding: 24px;
}
.login-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  padding: 38px 36px 26px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 60px; height: 60px; line-height: 60px; margin: 0 auto 14px;
  border-radius: 16px; background: linear-gradient(135deg, #2a5298, #4d7bd0);
  color: #fff; font-size: 22px; font-weight: 700; letter-spacing: 1px;
}
.login-brand h1 { font-size: 20px; margin: 0 0 6px; color: #1e2a44; font-weight: 600; }
.login-sub { margin: 0; font-size: 13px; color: #909399; }
.login-btn { width: 100%; margin-top: 6px; letter-spacing: 4px; }
.login-foot {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid #f0f2f5;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: #909399;
}
.login-tip { margin: 8px 0 0; font-size: 13px; color: #e6a23c; text-align: center; }
/* 登录页底部「申请开通门店」入口 */
.login-register {
  margin-top: 14px; text-align: center;
  font-size: 13px; color: #909399;
}
.login-register a { color: var(--adp-primary); text-decoration: none; font-weight: 500; }
.login-register a:hover { text-decoration: underline; }

/* ==========================================================================
 *  后台整体布局
 * ========================================================================== */
.admin-layout { height: 100vh; }

.admin-aside {
  background: var(--adp-aside);
  overflow-x: hidden;
}
.aside-logo {
  height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; color: #fff; font-size: 15px; font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  white-space: nowrap; overflow: hidden;
}
.aside-logo .dot {
  width: 26px; height: 26px; line-height: 26px; text-align: center;
  border-radius: 8px; background: linear-gradient(135deg, #4d7bd0, #2a5298);
  font-size: 12px; flex: 0 0 auto;
}
.admin-aside .el-menu {
  border-right: none;
  background: transparent;
}
.admin-aside .el-menu-item {
  color: #c3ccdd;
  height: 48px;
  line-height: 48px;
  display: flex;
  align-items: center;
}
.admin-aside .el-menu-item > span { flex: 1; }
/* 侧边栏「待绑定设备」红点 */
.admin-aside .menu-badge { margin-left: 6px; flex: 0 0 auto; }
.admin-aside .menu-badge .el-badge__content {
  border: none;
  transform: none;
  position: static;
  background: #f04438;
}
.admin-aside .el-menu-item:hover { background: var(--adp-aside-hover); color: #fff; }
.admin-aside .el-menu-item.is-active {
  background: linear-gradient(90deg, rgba(77, 123, 208, .9), rgba(42, 82, 152, .35));
  color: #fff; font-weight: 600;
}

.admin-header {
  height: 60px; background: #fff; border-bottom: 1px solid #ebeef5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.header-title { font-size: 16px; font-weight: 600; color: #1e2a44; }
.header-user { display: flex; align-items: center; gap: 12px; }
.header-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #e6eaf4;
  color: var(--el-color-primary); display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.admin-main { background: var(--adp-bg); padding: 18px; overflow-y: auto; }

/* 门店后台顶部到期提醒 */
.store-banner {
  background: #fff7e6; border: 1px solid #ffe0a3; color: #ad6800;
  padding: 8px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px;
}
.store-banner.danger { background: #fef0f0; border-color: #fbc4c4; color: #c45656; }

/* ==========================================================================
 *  页面通用
 * ========================================================================== */
.page-title {
  font-size: 17px; font-weight: 600; color: #1e2a44; margin-bottom: 14px;
}
.page-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.page-toolbar .spacer { flex: 1; }
.el-card { border-radius: 10px; }

/* 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.stat-card {
  background: #fff; border-radius: 10px; padding: 16px 18px;
  border-left: 4px solid var(--el-color-primary);
  box-shadow: 0 2px 10px rgba(30, 42, 68, .05);
}
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: #1e2a44; line-height: 1.2; }
.stat-card .stat-label { margin-top: 6px; font-size: 13px; color: #909399; }
.stat-card.tone-blue { border-left-color: #2a5298; }
.stat-card.tone-green { border-left-color: #12b76a; }
.stat-card.tone-orange { border-left-color: #f79009; }
.stat-card.tone-red { border-left-color: #f04438; }
.stat-card.tone-purple { border-left-color: #7a5af8; }
.stat-card.tone-cyan { border-left-color: #06aed4; }

/* 纯 CSS 柱状图 */
.bar-chart {
  display: flex; align-items: flex-end; gap: 10px;
  height: 240px; padding: 10px 4px 0;
}
.bar-item {
  flex: 1; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
}
.bar-item .bar-count { font-size: 12px; color: #606266; margin-bottom: 4px; }
.bar-item .bar {
  width: 58%; min-height: 4px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #5b7cba, #2a5298);
  transition: height .3s;
}
.bar-item .bar-date { margin-top: 8px; font-size: 12px; color: #909399; }

/* 机器码高亮 */
.machine-code {
  font-family: Consolas, Menlo, monospace;
  background: #f0f5ff; color: #1e3c72;
  border: 1px solid #d6e0f5; border-radius: 4px;
  padding: 1px 6px; font-size: 13px; letter-spacing: .5px;
}

/* 素材网格 */
.material-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.material-card {
  position: relative; background: #fff; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; box-shadow: 0 2px 10px rgba(30, 42, 68, .06);
  transition: .2s;
}
.material-card.selected { border-color: var(--el-color-primary); }
.material-thumb {
  height: 140px; background: #f5f7fa; display: flex; align-items: center;
  justify-content: center; overflow: hidden;
}
.material-thumb img, .material-thumb video { width: 100%; height: 100%; object-fit: cover; }
.material-thumb .ph { color: #c0c4cc; font-size: 34px; }
.material-meta { padding: 10px 12px; }
.material-meta .name {
  font-size: 13px; color: #303133; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.material-meta .sub { margin-top: 4px; font-size: 12px; color: #909399; }
.material-check { position: absolute; top: 8px; left: 8px; z-index: 2; }
.material-actions { position: absolute; top: 8px; right: 8px; z-index: 2; }

/* 播放项排序列表 */
.item-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid #ebeef5; border-radius: 8px; margin-bottom: 8px; background: #fafbfc;
}
.item-row .idx {
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: #e6eaf4; color: #2a5298; font-size: 12px; flex: 0 0 auto;
}
.item-row .grow { flex: 1; min-width: 0; }
.item-row .title { font-size: 13px; color: #303133; }

/* 广告/素材缩略预览 */
.thumb-xs {
  width: 56px; height: 42px; border-radius: 6px; object-fit: cover;
  background: #f5f7fa; display: block;
}
.thumb-xs-ph {
  width: 56px; height: 42px; border-radius: 6px; background: #f0f2f5;
  display: flex; align-items: center; justify-content: center; color: #c0c4cc;
}
.chosen-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chosen-thumbs img, .chosen-thumbs video {
  width: 74px; height: 56px; border-radius: 6px; object-fit: cover; background: #f5f7fa;
}

/* 描述列表紧凑 */
.el-descriptions__label { width: 110px; }

/* ---------------------------- 顶栏左侧 / 汉堡按钮 ---------------------------- */
.header-left { display: flex; align-items: center; min-width: 0; }
.menu-toggle {
  display: none;
  font-size: 20px;
  cursor: pointer;
  color: #1e2a44;
  margin-right: 10px;
  flex: 0 0 auto;
}
/* 侧边栏遮罩（窄屏时显示） */
.aside-mask {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1999;
}

/* ---------------------------- 实时预览 / 远程控制 ---------------------------- */
.remote-head { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.remote-preview {
  background: #000; border-radius: 8px; min-height: 220px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.remote-preview img { max-width: 100%; max-height: 420px; display: block; }
.remote-preview-ph { color: #909399; font-size: 13px; padding: 70px 16px; text-align: center; }
.remote-preview-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.remote-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.remote-volume { display: flex; align-items: center; margin-top: 12px; }

/* ==========================================================================
 *  手机端自适应（手机投放面板）
 * ========================================================================== */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }

  /* 侧边菜单：默认隐藏在左侧，点击汉堡后滑出 */
  .menu-toggle { display: inline-flex; }
  .admin-aside {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, .2);
  }
  .admin-aside.aside-open { transform: translateX(0); }

  /* 主内容区：占满宽度、减小内边距 */
  .admin-header { padding: 0 12px; }
  .admin-main { padding: 12px; overflow-x: auto; }
  .header-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-user > .text-muted { display: none; }

  /* 表格横向滚动，避免撑破页面 */
  .el-table { width: 100%; }
  .el-table__body-wrapper { overflow-x: auto; }

  /* 弹窗宽度自适应 */
  .el-dialog { width: 92% !important; margin-top: 6vh !important; }
  .el-message-box { width: 88% !important; }

  /* 表单项标签顶部对齐 */
  .el-form-item { display: block; }
  .el-form-item__label {
    width: auto !important;
    display: block;
    text-align: left;
    float: none;
    padding: 0 0 4px;
    line-height: 1.5;
  }

  /* 统计卡片单列更紧凑 */
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .material-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
