/* ============================================================
   就业通 · 广告 / 收藏 / 媒体库样式（2026-11-04）
   放在 design-system.css 之后加载；只使用主题变量，不写死颜色。
   ============================================================ */

/* ---------- 通用复选 ---------- */
.form-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.form-check input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }

/* ---------- 工具栏收藏 ---------- */
.toolbar-fav-link { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.toolbar-fav-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-foreground);
  font-size: 11px; line-height: 1; font-weight: 600;
}
.sidebar-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-foreground);
  font-size: 11px; line-height: 1; font-weight: 600;
}

/* ---------- 原文广告弹窗 ---------- */
.ad-gate-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0; border: 0; background: transparent; color: var(--foreground);
  overflow: visible;
}
.ad-gate-dialog::backdrop { background: rgba(10, 18, 22, .58); backdrop-filter: blur(2px); }
.ad-gate-shell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  overflow: hidden; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
}
.ad-gate-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px 10px;
}
.ad-gate-eyebrow { font-size: 12px; color: var(--muted-foreground); letter-spacing: .04em; }
.ad-gate-title { margin: 4px 0 0; font-size: 18px; line-height: 1.35; font-weight: 650; }
.ad-gate-close {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted-foreground); font-size: 22px; line-height: 1;
  cursor: pointer;
}
.ad-gate-close:hover { background: var(--secondary); color: var(--foreground); }
.ad-gate-body { padding: 0 20px 20px; overflow-y: auto; }
.ad-gate-loading {
  min-height: 150px; display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted-foreground); font-size: 13px;
}
.ad-gate-empty {
  min-height: 80px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border-300); border-radius: var(--radius-lg);
  color: var(--muted-foreground); font-size: 13px; margin-bottom: 14px;
}

/* 广告卡片 */
.ad-card {
  position: relative; display: block; overflow: hidden; text-decoration: none;
  color: inherit; border: 1px solid var(--border-200); border-radius: var(--radius-lg);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.ad-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.ad-card-label {
  position: absolute; top: 10px; right: 10px; left: auto; z-index: 2;
  padding: 3px 7px; border-radius: 5px; background: rgba(15, 23, 28, .72);
  color: #fff; font-size: 11px; line-height: 1.2; letter-spacing: .04em;
}
.ad-card-media { aspect-ratio: 16 / 9; background: var(--secondary); overflow: hidden; }
.ad-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-card-body { padding: 14px 16px 16px; }
.ad-card-title { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 650; }
.ad-card-subtitle { margin: 5px 0 0; font-size: 13px; color: var(--brand-800); font-weight: 500; }
.ad-card-desc { margin: 7px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted-foreground); }
.ad-card-cta {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 12px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-foreground);
  font-size: 13px; font-weight: 600;
}

/* 原文区 */
.ad-gate-source {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-100);
  display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center;
}
.ad-gate-source-meta { min-width: 0; }
.ad-gate-source-label { font-size: 11px; color: var(--muted-foreground); }
.ad-gate-source-domain {
  margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--text-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-gate-source-btn { grid-row: span 1; white-space: nowrap; }

@media (max-width: 600px) {
  .ad-gate-dialog {
    width: 100vw; max-width: 100vw; max-height: 100dvh; margin: 0;
    position: fixed; inset: auto 0 0 0; transform: none;
  }
  .ad-gate-shell { border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .ad-gate-header { padding: 16px 16px 8px; }
  .ad-gate-body { padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
  .ad-gate-source { grid-template-columns: 1fr; }
  .ad-gate-source-btn { width: 100%; justify-content: center; }
}

/* ---------- 本地收藏页 ---------- */
.fav-view-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--border-200); border-radius: var(--radius-lg);
  background: var(--surface);
}
.fav-view-bar-text { font-size: 13px; color: var(--muted-foreground); }
.fav-view-actions { display: flex; align-items: center; gap: 8px; }
.fav-empty { padding: 48px 16px; text-align: center; color: var(--muted-foreground); }
.fav-empty strong { display: block; margin-bottom: 6px; color: var(--foreground); font-size: 16px; }

/* ---------- 后台登录 ---------- */
.admin-login-wrap {
  max-width: 420px; margin: 48px auto; padding: 28px;
  border: 1px solid var(--border-200); border-radius: var(--radius-xl);
  background: var(--surface); box-shadow: var(--shadow-md);
}
.admin-login-wrap h1, .admin-login-wrap h2 { margin: 0 0 6px; font-size: 20px; }
.admin-login-wrap p { margin: 0 0 18px; color: var(--muted-foreground); font-size: 13px; line-height: 1.6; }
.admin-login-field { display: grid; gap: 8px; margin-bottom: 16px; }
.admin-login-field label { font-size: 13px; font-weight: 600; }
.admin-login-msg { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--danger); }
.admin-login-msg.is-ok { color: var(--success-700); }
.admin-header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 广告管理 ---------- */
.ad-admin-layout { display: grid; gap: 16px; }
.ad-admin-split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .8fr); gap: 16px; }
@media (max-width: 980px) { .ad-admin-split { grid-template-columns: 1fr; } }

.ad-admin-list { display: grid; gap: 10px; }
.ad-admin-item {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--border-200); border-radius: var(--radius-lg);
  background: var(--surface);
}
.ad-admin-thumb {
  width: 76px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--secondary);
  border: 1px solid var(--border-100);
}
.ad-admin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-admin-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.ad-admin-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted-foreground); }
.ad-admin-actions { display: flex; align-items: center; gap: 6px; }
.ad-admin-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.ad-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--text-400); }
.ad-dot.on { background: var(--success-500); }
.ad-dot.off { background: var(--text-400); }

.ad-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ad-form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .ad-form-grid { grid-template-columns: 1fr; } .ad-form-grid .span-2 { grid-column: auto; } }
.ad-form-field { display: grid; gap: 6px; }
.ad-form-field > label { font-size: 12px; font-weight: 600; color: var(--text-700); }
.ad-form-hint { font-size: 11px; color: var(--muted-foreground); }
.ad-image-picker { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.ad-image-preview {
  width: 180px; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden;
  background: var(--secondary); border: 1px solid var(--border-200);
  display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); font-size: 12px;
}
.ad-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-image-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ad-preview-card {
  border: 1px solid var(--border-200); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface);
}
.ad-preview-card .ad-card-media { aspect-ratio: 16 / 9; }
.ad-preview-card .ad-card-body { padding: 12px 14px 14px; }

/* 广告位设置 */
.placement-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border-100);
}
.placement-row:last-child { border-bottom: 0; }
.placement-info { min-width: 0; }
.placement-name { font-size: 14px; font-weight: 600; }
.placement-desc { margin-top: 2px; font-size: 12px; color: var(--muted-foreground); }
.placement-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 媒体库 ---------- */
.media-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; border: 1px solid var(--border-200); border-radius: var(--radius-lg);
  background: var(--surface); margin-bottom: 14px;
}
.media-toolbar .form-input { min-width: 180px; }
/* 2026-11-07：搜索框原来 width:100% 会独占一整行，工具栏被撑成 3 行。
   改成可伸缩但最多 460px，1440 下能和上传/文件夹/排序/统计并成一行。 */
.media-toolbar #mediaSearch { flex: 1 1 240px; width: auto; max-width: 460px; }
.media-toolbar-spacer { flex: 1; }
.media-stats { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px;
}
.media-card {
  position: relative; border: 1px solid var(--border-200); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface); cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.media-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.media-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--brand-50); }
.media-thumb { aspect-ratio: 4 / 3; background: var(--secondary); overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-info { padding: 9px 10px 10px; }
.media-name {
  font-size: 12px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-meta { margin-top: 3px; display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted-foreground); }
.media-usage { color: var(--primary); }
.media-usage.none { color: var(--text-400); }
.media-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid rgba(255,255,255,.9);
  background: rgba(15,23,28,.35); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; opacity: 0; transition: opacity .12s ease;
}
.media-card:hover .media-check, .media-card.selected .media-check { opacity: 1; }
.media-card.selected .media-check { background: var(--primary); border-color: var(--primary); }
.media-empty {
  padding: 48px 16px; text-align: center; color: var(--muted-foreground);
  border: 1px dashed var(--border-300); border-radius: var(--radius-lg);
}

.media-detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 18px; }
@media (max-width: 820px) { .media-detail-grid { grid-template-columns: 1fr; } }
.media-detail-preview {
  border: 1px solid var(--border-200); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--secondary); display: flex; align-items: center; justify-content: center;
  min-height: 220px;
}
.media-detail-preview img { max-width: 100%; max-height: 420px; display: block; object-fit: contain; }

/* 媒体选择器 */
.media-picker-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; background: transparent; }
.media-picker-dialog::backdrop { background: rgba(10,18,22,.55); }
.media-picker-shell {
  background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.media-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border-100); }
.media-picker-head h3 { margin: 0; font-size: 16px; }
.media-picker-body { padding: 14px 18px; overflow-y: auto; }
.media-picker-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border-100); }

/* 广告统计 */
.ad-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ad-stat-card { padding: 14px; border: 1px solid var(--border-200); border-radius: var(--radius-lg); background: var(--surface); }
.ad-stat-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.ad-stat-label { margin-top: 4px; font-size: 12px; color: var(--muted-foreground); }
.ad-stat-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ad-stat-table th, .ad-stat-table td { padding: 8px 6px; border-bottom: 1px solid var(--border-100); text-align: left; }
.ad-stat-table th { color: var(--muted-foreground); font-weight: 600; }

/* 深色模式下的图片遮罩微调 */
[data-theme="dark"] .ad-gate-close:hover { background: var(--border-100); }
[data-theme="dark"] .ad-card-label { background: rgba(0,0,0,.68); }
