/* ============================================================
   HKMDRC 后台管理 Demo · 扩展样式
   树形表格 · 分类侧栏 · WYSIWYG 编辑器 · 抽屉 · 系统设置
   ============================================================ */

/* ===== 1. 树形表格 ===== */
.admin-tree-toggle { transition: transform 0.2s ease; flex-shrink: 0; }
.admin-tree-toggle--collapsed { transform: rotate(-90deg); }
.admin-table__row--child { background: rgba(138, 14, 232, 0.015); }
.admin-table__row--child:hover { background: rgba(138, 14, 232, 0.04); }
/* 防止导航表格标题列内容竖排换行 */
.admin-table__title strong,
.admin-table__title span { display: inline-flex !important; align-items: center; gap: 6px; white-space: nowrap; }
.admin-table__indent { display: inline-flex !important; align-items: center; white-space: nowrap; }
.admin-table__tree { display: inline-flex; align-items: center; width: 20px; color: var(--admin-border-2, #d1d5db); }
.admin-table__tree::before { content: '└─'; font-size: 14px; color: var(--admin-text-3, #9ca3af); }

/* ===== 2. 分类侧栏 ===== */
.admin-cat-sidebar { width: 240px; flex-shrink: 0; }
.admin-cat-sidebar__inner { background: var(--admin-card, #fff); border: 1px solid var(--admin-border-light, #f0f0f0); border-radius: var(--admin-radius, 10px); overflow: hidden; }
.admin-cat-sidebar__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--admin-border-light, #f0f0f0); }
.admin-cat-sidebar__title { font-size: 14px; font-weight: 700; color: var(--admin-ink, #1a1a2e); display: flex; align-items: center; gap: 8px; }
.admin-cat-sidebar__add { width: 28px; height: 28px; border-radius: 8px; border: 1px dashed var(--admin-border-2, #e5e7eb); background: transparent; color: var(--admin-primary, #8a0ee8); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.admin-cat-sidebar__add:hover { background: var(--admin-primary-soft, rgba(138,14,232,0.08)); border-color: var(--admin-primary, #8a0ee8); }
.admin-cat-list { padding: 6px; max-height: 600px; overflow-y: auto; }
.admin-cat-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; cursor: pointer; transition: all 0.15s; position: relative; }
.admin-cat-item:hover { background: var(--admin-bg-soft, #f9fafb); }
.admin-cat-item--active { background: var(--admin-primary-soft, rgba(138,14,232,0.08)); color: var(--admin-primary, #8a0ee8); font-weight: 600; }
.admin-cat-item__icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--admin-text-3, #9ca3af); }
.admin-cat-item--active .admin-cat-item__icon { color: var(--admin-primary, #8a0ee8); }
.admin-cat-item__name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-cat-item__count { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--admin-bg-soft, #f3f4f6); color: var(--admin-text-3, #6b7280); }
.admin-cat-item--active .admin-cat-item__count { background: rgba(138,14,232,0.15); color: var(--admin-primary, #8a0ee8); }
.admin-cat-item__actions { display: none; gap: 2px; }
.admin-cat-item:hover .admin-cat-item__actions { display: flex; }
.admin-cat-item__act { width: 22px; height: 22px; border: none; background: transparent; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--admin-text-3, #9ca3af); }
.admin-cat-item__act:hover { background: rgba(0,0,0,0.06); color: var(--admin-ink, #1a1a2e); }
.admin-cat-item__act--del:hover { color: var(--admin-danger, #ef4444); }
.admin-cat-item__act svg { width: 13px; height: 13px; }

/* 带分类侧栏的主内容区布局 */
.admin-with-sidebar { display: flex; gap: 16px; align-items: flex-start; }
.admin-with-sidebar__main { flex: 1; min-width: 0; }

/* ===== 3. 抽屉 Drawer ===== */
.admin-drawer { position: fixed; inset: 0; z-index: 1200; }
.admin-drawer__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.35); opacity: 0; transition: opacity 0.25s; }
.admin-drawer--show .admin-drawer__overlay { opacity: 1; }
.admin-drawer__panel { position: absolute; right: 0; top: 0; bottom: 0; width: 420px; max-width: 90vw; background: var(--admin-card, #fff); box-shadow: -8px 0 30px rgba(0,0,0,0.12); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.admin-drawer--show .admin-drawer__panel { transform: translateX(0); }
.admin-drawer__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--admin-border-light, #f0f0f0); }
.admin-drawer__title { font-size: 16px; font-weight: 700; color: var(--admin-ink, #1a1a2e); margin: 0; }
.admin-drawer__close { width: 32px; height: 32px; border: none; background: transparent; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--admin-text-3, #6b7280); }
.admin-drawer__close:hover { background: var(--admin-bg-soft, #f3f4f6); color: var(--admin-ink, #1a1a2e); }
.admin-drawer__close svg { width: 18px; height: 18px; }
.admin-drawer__body { flex: 1; overflow-y: auto; padding: 24px; }
.admin-drawer__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--admin-border-light, #f0f0f0); }

/* ===== 4. WYSIWYG 富文本编辑器 ===== */
.admin-wysiwyg { border: 1px solid var(--admin-border-2, #e5e7eb); border-radius: var(--admin-radius, 10px); overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; background: var(--admin-card, #fff); }
.admin-wysiwyg:focus-within { border-color: var(--admin-primary, #8a0ee8); box-shadow: 0 0 0 4px var(--admin-primary-soft, rgba(138,14,232,0.08)); }
.admin-wysiwyg__toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--admin-border-light, #f0f0f0); background: var(--admin-bg-soft, #fafafa); }
.admin-wysiwyg__btn { width: 30px; height: 30px; border: none; background: transparent; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--admin-text-2, #4b5563); transition: all 0.15s; font-size: 13px; font-weight: 600; }
.admin-wysiwyg__btn:hover { background: rgba(138,14,232,0.08); color: var(--admin-primary, #8a0ee8); }
.admin-wysiwyg__btn:active { background: rgba(138,14,232,0.15); }
.admin-wysiwyg__btn svg { width: 16px; height: 16px; }
.admin-wysiwyg__btn--text { width: auto; padding: 0 10px; font-size: 12px; }
.admin-wysiwyg__divider { width: 1px; height: 20px; background: var(--admin-border-light, #e5e7eb); margin: 0 4px; }
.admin-wysiwyg__content { min-height: 200px; max-height: 500px; overflow-y: auto; padding: 16px 20px; font-size: 14px; line-height: 1.7; color: var(--admin-text, #374151); outline: none; }
.admin-wysiwyg__content:empty::before { content: attr(data-placeholder); color: var(--admin-text-3, #9ca3af); }
.admin-wysiwyg__content h1 { font-size: 1.8em; font-weight: 700; margin: 0.6em 0 0.3em; }
.admin-wysiwyg__content h2 { font-size: 1.5em; font-weight: 700; margin: 0.6em 0 0.3em; }
.admin-wysiwyg__content h3 { font-size: 1.25em; font-weight: 600; margin: 0.5em 0 0.3em; }
.admin-wysiwyg__content p { margin: 0.5em 0; }
.admin-wysiwyg__content ul, .admin-wysiwyg__content ol { padding-left: 1.5em; margin: 0.5em 0; }
.admin-wysiwyg__content blockquote { border-left: 3px solid var(--admin-primary, #8a0ee8); padding-left: 14px; margin: 0.8em 0; color: var(--admin-text-2, #6b7280); font-style: italic; }
.admin-wysiwyg__content a { color: var(--admin-primary, #8a0ee8); text-decoration: underline; }
.admin-wysiwyg__content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.admin-wysiwyg__content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.admin-wysiwyg__content td, .admin-wysiwyg__content th { border: 1px solid var(--admin-border-2, #e5e7eb); padding: 6px 10px; }
.admin-wysiwyg__footer { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px; border-top: 1px solid var(--admin-border-light, #f0f0f0); background: var(--admin-bg-soft, #fafafa); font-size: 12px; color: var(--admin-text-3, #9ca3af); }

/* ===== 5. 下拉/筛选器一致性修复 ===== */
/* admin-filter 也加上箭头，与 admin-select 统一 */
select.admin-filter { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

/* ===== 6. 翻译管理布局优化 ===== */
/* 紧凑的行内编辑模式：三语并排，减少视觉噪音 */
.admin-tr-group { border: 1px solid var(--admin-border-light, #f0f0f0); border-radius: var(--admin-radius, 10px); margin-bottom: 10px; overflow: hidden; transition: border-color 0.2s; }
.admin-tr-group:hover { border-color: var(--admin-primary-light, #b06bff); }
.admin-tr-group__head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--admin-bg-soft, #fafafa); border-bottom: 1px solid var(--admin-border-light, #f0f0f0); flex-wrap: wrap; }
.admin-tr-field { padding: 0; }
.admin-tr-langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--admin-border-light, #f0f0f0); }
.admin-tr-lang { padding: 10px 14px; background: var(--admin-card, #fff); }
.admin-tr-lang__label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--admin-text-3, #6b7280); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.admin-tr-lang__ta { width: 100%; min-height: 52px; resize: vertical; padding: 6px 10px; font-size: 13px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--admin-text, #374151); transition: all 0.15s; font-family: inherit; line-height: 1.5; }
.admin-tr-lang__ta:focus { outline: none; border-color: var(--admin-primary, #8a0ee8); background: var(--admin-card, #fff); box-shadow: 0 0 0 3px var(--admin-primary-soft, rgba(138,14,232,0.08)); }
.admin-tr-lang__ta::placeholder { color: var(--admin-text-3, #c0c0c0); font-style: italic; }
@media (max-width: 1100px) { .admin-tr-langs { grid-template-columns: 1fr; } .admin-tr-lang { border-bottom: 1px solid var(--admin-border-light, #f0f0f0); } }

/* ===== 7. 系统设置特定样式 ===== */
.admin-settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 768px) { .admin-settings-grid { grid-template-columns: 1fr; } }
.admin-setting-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border: 1px solid var(--admin-border-light, #f0f0f0); border-radius: var(--admin-radius, 10px); transition: all 0.2s; }
.admin-setting-item:hover { border-color: var(--admin-primary-light, #b06bff); box-shadow: 0 2px 12px rgba(138,14,232,0.06); }
.admin-setting-item__icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.admin-setting-item__icon svg { width: 20px; height: 20px; }
.admin-setting-item__icon--purple { background: rgba(138,14,232,0.1); color: #8a0ee8; }
.admin-setting-item__icon--blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.admin-setting-item__icon--green { background: rgba(16,185,129,0.1); color: #10b981; }
.admin-setting-item__icon--orange { background: rgba(249,115,22,0.1); color: #f97316; }
.admin-setting-item__icon--red { background: rgba(239,68,68,0.1); color: #ef4444; }
.admin-setting-item__body { flex: 1; min-width: 0; }
.admin-setting-item__title { font-size: 14px; font-weight: 600; color: var(--admin-ink, #1a1a2e); margin-bottom: 4px; }
.admin-setting-item__desc { font-size: 12px; color: var(--admin-text-3, #6b7280); line-height: 1.5; }
.admin-setting-item__action { margin-top: 8px; }

/* ===== 8. 模块工作台增强 ===== */
.admin-ws-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border: 1px solid var(--admin-border-light, #f0f0f0); border-radius: var(--admin-radius, 10px); margin-bottom: 10px; transition: all 0.2s; }
.admin-ws-section:hover { border-color: var(--admin-primary-light, #b06bff); box-shadow: 0 2px 10px rgba(138,14,232,0.05); }
.admin-ws-section__info { display: flex; align-items: center; gap: 14px; }
.admin-ws-section__icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.admin-ws-section__icon svg { width: 22px; height: 22px; }
.admin-ws-section__title { font-size: 15px; font-weight: 600; color: var(--admin-ink, #1a1a2e); }
.admin-ws-section__sub { font-size: 12px; color: var(--admin-text-3, #6b7280); margin-top: 2px; }
.admin-ws-section__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===== 9. 通用辅助 ===== */
.admin-cursor-pointer { cursor: pointer; }
.admin-text-break { word-break: break-all; }
.admin-nowrap { white-space: nowrap; }
.admin-table td.admin-table__title { white-space: nowrap; }
/* ===== 10. 缩略图修饰类（文字头像 / 文件标识，统一尺寸与形状） ===== */
.admin-thumb__img--avatar { width: 40px; height: 40px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; }
.admin-thumb__img--file { width: 36px; height: 36px; border-radius: 8px; border: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; flex-shrink: 0; }

/* ===== 11. 单选分段控件（radio-tabs：用于二选一/多选一场景） ===== */
.admin-radio-tabs { display: inline-flex; gap: 4px; padding: 3px; background: var(--admin-fill, #f3f3f6); border-radius: var(--admin-radius-sm, 8px); }
.admin-radio-tabs__item { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; font-size: 13px; font-weight: 500; color: var(--admin-text-3, #6b7280); border-radius: calc(var(--admin-radius-sm, 8px) - 3px); cursor: pointer; transition: all 0.18s; user-select: none; white-space: nowrap; }
.admin-radio-tabs__item input { position: absolute; opacity: 0; pointer-events: none; }
.admin-radio-tabs__item:hover { color: var(--admin-ink, #1a1a2e); }
.admin-radio-tabs__item--active { background: var(--admin-card, #fff); color: var(--admin-primary, #8a0ee8); box-shadow: 0 1px 3px rgba(0,0,0,0.08); font-weight: 600; }

/* ===== 12. 带后缀按钮的输入框容器 ===== */
.admin-form__control--with-suffix { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 13px; }
.admin-form__control--with-suffix > input { flex: 1; min-width: 0; }
.admin-form__control--with-suffix > .admin-btn { flex-shrink: 0; }

/* ===== 13. 密码强度指示器 ===== */
.admin-pwd-strength { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.admin-pwd-strength__bar { flex: 1; height: 5px; border-radius: 3px; background: var(--admin-fill, #e9e9ef); overflow: hidden; }
.admin-pwd-strength__bar > span { display: block; height: 100%; width: 0; border-radius: 3px; transition: width 0.3s ease, background 0.3s ease; }
.admin-pwd-strength__fill--0 { width: 20% !important; background: #ef4444; }
.admin-pwd-strength__fill--1 { width: 40% !important; background: #f97316; }
.admin-pwd-strength__fill--2 { width: 60% !important; background: #eab308; }
.admin-pwd-strength__fill--3 { width: 80% !important; background: #22c55e; }
.admin-pwd-strength__fill--4 { width: 100% !important; background: #10b981; }
.admin-pwd-strength__label { font-size: 12px; font-weight: 600; color: var(--admin-text-3, #6b7280); min-width: 36px; text-align: right; }


/* ===== 14. 批量操作栏 ===== */
.admin-batch-bar { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; margin-bottom: 14px; background: var(--admin-primary-soft, rgba(138,14,232,0.06)); border: 1px solid var(--admin-primary-light, #b06bff); border-radius: var(--admin-radius-sm, 8px); animation: admnSlideDown 0.2s ease; }
.admin-batch-bar--show { display: flex; }
@keyframes admnSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.admin-batch-bar__count { font-size: 13px; font-weight: 600; color: var(--admin-primary-deep, #6b21a8); white-space: nowrap; }
.admin-batch-bar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== 15. 文件卡片增强：悬浮操作 ===== */
.admin-file-card__actions { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.admin-file-card:hover .admin-file-card__actions { opacity: 1; }
.admin-file-card__action-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: rgba(255,255,255,0.9); color: var(--admin-text-2, #4b5563); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; backdrop-filter: blur(4px); }
.admin-file-card__action-btn:hover { background: #fff; color: var(--admin-primary, #8a0ee8); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.admin-file-card__action-btn--danger:hover { color: #ef4444; }
.admin-file-card__action-btn svg { width: 15px; height: 15px; }
.admin-file-card__badge { position: absolute; bottom: 8px; right: 8px; z-index: 1; font-size: 10px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.5); padding: 2px 7px; border-radius: 4px; backdrop-filter: blur(4px); }
.admin-file-card--selected { border-color: var(--admin-primary, #8a0ee8); box-shadow: 0 0 0 2px var(--admin-primary-soft, rgba(138,14,232,0.15)); }

/* ===== 16. 文件详情弹窗：双栏布局 ===== */
.admin-file-detail { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.admin-file-detail__preview { border-radius: var(--admin-radius, 10px); overflow: hidden; background: var(--admin-bg-soft, #f5f5f7); border: 1px solid var(--admin-border-light, #f0f0f0); }
.admin-file-detail__preview img { width: 100%; height: 220px; object-fit: cover; display: block; }
.admin-file-detail__preview-placeholder { height: 220px; display: flex; align-items: center; justify-content: center; }
.admin-file-detail__info-list { display: grid; gap: 0; }
.admin-file-detail__info-row { display: flex; gap: 12px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--admin-border-light, #f0f0f0); }
.admin-file-detail__info-row:last-child { border-bottom: none; }
.admin-file-detail__info-label { width: 80px; flex-shrink: 0; color: var(--admin-text-3, #6b7280); }
.admin-file-detail__info-value { flex: 1; color: var(--admin-ink, #1a1a2e); word-break: break-all; }
.admin-file-detail__refs { margin-top: 16px; }
.admin-file-detail__refs-title { font-size: 13px; font-weight: 600; color: var(--admin-ink, #1a1a2e); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.admin-file-detail__ref-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--admin-bg-soft, #f5f5f7); border-radius: var(--admin-radius-sm, 8px); margin-bottom: 8px; font-size: 13px; }
.admin-file-detail__ref-type { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; flex-shrink: 0; }
.admin-file-detail__ref-type--article { background: rgba(59,130,246,0.1); color: #3b82f6; }
.admin-file-detail__ref-type--banner { background: rgba(249,115,22,0.1); color: #f97316; }
.admin-file-detail__ref-type--resource { background: rgba(16,185,129,0.1); color: #10b981; }
.admin-file-detail__ref-type--page { background: rgba(139,92,246,0.1); color: #8b5cf6; }

/* ===== 17. 分组侧栏增强 ===== */
.admin-group-sidebar { padding: 6px; }
.admin-group-item { display: flex; align-items: center; gap: 9px; padding: 9px 12px; cursor: pointer; border-radius: var(--admin-radius-sm, 8px); font-size: 13px; color: var(--admin-text, #374151); transition: all 0.15s; margin-bottom: 2px; }
.admin-group-item:hover { background: var(--admin-bg-soft, #f5f5f7); }
.admin-group-item--active { background: var(--admin-primary-soft, rgba(138,14,232,0.08)); color: var(--admin-primary-deep, #6b21a8); font-weight: 600; }
.admin-group-item__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.admin-group-item__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-group-item__count { font-size: 11px; color: var(--admin-text-3, #6b7280); background: var(--admin-bg-soft, #f0f0f0); padding: 1px 8px; border-radius: 10px; }
.admin-group-item--active .admin-group-item__count { background: var(--admin-primary, #8a0ee8); color: #fff; }

/* ===== 18. 拖拽排序行 ===== */
.admin-drag-row { transition: background 0.15s, box-shadow 0.15s, opacity 0.15s; }
.admin-drag-handle { width: 16px; height: 16px; color: var(--admin-text-3, #9ca3af); cursor: grab; flex-shrink: 0; transition: color 0.15s; }
.admin-drag-handle:hover { color: var(--admin-primary, #8a0ee8); }
.admin-drag-handle:active { cursor: grabbing; }
.admin-drag-row--dragging { opacity: 0.4; background: var(--admin-primary-soft, rgba(138,14,232,0.06)) !important; }
.admin-drag-row--over { box-shadow: inset 0 2px 0 0 var(--admin-primary, #8a0ee8); background: var(--admin-primary-soft, rgba(138,14,232,0.04)) !important; }

/* ===== 19. 文件类型图标 ===== */
.admin-file-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0; }
