/* 管理后台样式 - 紧凑优化版 */
.admin-container {
    display: flex;
    padding-top: 60px;
    min-height: 100vh;
    background: #0a0e1a;
}

.admin-sidebar {
    width: 200px;
    background: #0d1224;
    border-right: 1px solid rgba(74, 158, 255, 0.15);
    padding: 15px 0;
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
}

.sidebar-menu { display: flex; flex-direction: column; }

.menu-item {
    padding: 12px 20px;
    color: #8899aa;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.menu-item:hover { background: rgba(74, 158, 255, 0.08); color: #fff; }
.menu-item.active { background: rgba(74, 158, 255, 0.12); color: #4a9eff; border-left-color: #4a9eff; }
.menu-item span { font-size: 16px; }

.admin-content {
    flex: 1;
    margin-left: 200px;
    padding: 20px 25px;
}

.admin-section { display: none; }
.admin-section.active { display: block; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.section-header h2 { color: #e0e8f0; font-size: 18px; font-weight: 600; }
.section-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.table-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}
.table-filter label {
    color: #7aa8d4;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.filter-cascader-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}
.filter-category-display {
    min-width: 200px;
    max-width: 360px;
    padding: 7px 12px;
    background: #0d1224;
    border: 1px solid rgba(74, 158, 255, 0.25);
    border-radius: 5px;
    color: #8899aa;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-category-display.has-value {
    color: #e0e8f0;
}
.filter-category-display:hover {
    border-color: #4a9eff;
}
.filter-category-clear {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: rgba(74, 158, 255, 0.12);
    color: #7aa8d4;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.filter-category-clear:hover {
    background: rgba(255, 102, 102, 0.2);
    color: #ff8888;
}
.filter-cascader-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1200;
    background: #0d1224;
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    max-width: min(720px, 90vw);
}
.filter-category-columns {
    display: flex;
    gap: 8px;
}
.filter-category-column {
    min-width: 150px;
    max-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(74, 158, 255, 0.15);
    border-radius: 4px;
    background: #141b2d;
}
.filter-category-option {
    padding: 8px 12px;
    cursor: pointer;
    color: #c0d0e0;
    font-size: 13px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.08);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.filter-category-option:hover {
    background: rgba(74, 158, 255, 0.15);
}
.filter-category-option.is-selected {
    background: rgba(74, 158, 255, 0.25);
    color: #4a9eff;
}
.filter-cascader-hint {
    margin-top: 8px;
    color: #6b7d8e;
    font-size: 11px;
}

/* 表格 */
.planets-table-wrapper, .users-table-wrapper, .keywords-table-wrapper, .celebrities-table-wrapper {
    background: #0d1224;
    border: 1px solid rgba(74, 158, 255, 0.12);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead { background: rgba(74, 158, 255, 0.08); }
.admin-table th {
    padding: 10px 14px;
    text-align: left;
    color: #7aa8d4;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.admin-table th.sortable:hover {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.12);
}
.admin-table th.sortable .sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.35;
    font-size: 10px;
    vertical-align: middle;
}
.admin-table th.sortable .sort-icon::before {
    content: '↕';
}
.admin-table th.sortable.asc .sort-icon,
.admin-table th.sortable.desc .sort-icon {
    opacity: 1;
    color: #4a9eff;
}
.admin-table th.sortable.asc .sort-icon::before {
    content: '↑';
}
.admin-table th.sortable.desc .sort-icon::before {
    content: '↓';
}
.admin-table td {
    padding: 10px 14px;
    color: #c0cdd8;
    font-size: 13px;
    border-top: 1px solid rgba(74, 158, 255, 0.06);
}
.admin-table tbody tr:hover { background: rgba(74, 158, 255, 0.04); }

.action-btn {
    padding: 4px 10px;
    margin: 0 2px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    text-decoration: none;
    display: inline-block;
}
.action-btn.edit { background: #1a3a5c; color: #4a9eff; }
.action-btn.delete { background: #3c1a1a; color: #ff6666; }
.action-btn:hover { opacity: 0.85; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}
.stat-card {
    background: #0d1224;
    border: 1px solid rgba(74, 158, 255, 0.12);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}
.stat-card:hover { border-color: rgba(74, 158, 255, 0.3); }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: bold; color: #4a9eff; margin-bottom: 4px; }
.stat-label { color: #6b7d8e; font-size: 12px; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 15px; }
.page-btn {
    padding: 6px 12px;
    background: rgba(74, 158, 255, 0.08);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 4px;
    color: #c0cdd8;
    cursor: pointer;
    font-size: 12px;
}
.page-btn:hover { border-color: #4a9eff; }
.page-btn.active { background: #4a9eff; color: #fff; border-color: #4a9eff; }

/* 徽章 */
.role-badge, .status-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.role-badge.admin { background: rgba(255, 102, 102, 0.15); color: #ff6666; }
.role-badge.learner { background: rgba(74, 158, 255, 0.15); color: #4a9eff; }
.status-badge.active { background: rgba(68, 255, 136, 0.15); color: #44ff88; }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.modal.active { display: flex !important; }

.modal-content {
    background: #0d1224;
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 10px;
    padding: 25px;
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-content h3 { color: #e0e8f0; font-size: 16px; margin-bottom: 20px; }

/* 表单 */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    color: #7aa8d4;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    background: #141b2d;
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 5px;
    color: #e0e8f0;
    font-size: 13px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a9eff;
}
.form-group input[type="color"] { height: 34px; padding: 2px; cursor: pointer; }
.form-group textarea { resize: vertical; min-height: 60px; }

.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; padding: 10px; font-size: 13px; }

/* 富文本编辑器 */
.editor-wrapper {
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
}
.ql-toolbar.ql-snow {
    background: #141b2d !important;
    border: none !important;
    border-bottom: 1px solid rgba(74, 158, 255, 0.15) !important;
    padding: 6px !important;
}
.ql-toolbar .ql-stroke { stroke: #8899aa !important; }
.ql-toolbar .ql-fill { fill: #8899aa !important; }
.ql-toolbar .ql-picker-label { color: #8899aa !important; }
.ql-toolbar button:hover .ql-stroke { stroke: #4a9eff !important; }
.ql-toolbar button:hover .ql-fill { fill: #4a9eff !important; }
.ql-toolbar button.ql-active .ql-stroke { stroke: #4a9eff !important; }
.ql-toolbar button.ql-active .ql-fill { fill: #4a9eff !important; }

.ql-container.ql-snow {
    border: none !important;
    background: #fff !important;
    font-size: 14px !important;
}
.ql-editor { min-height: 200px; color: #333; }
.ql-editor.ql-blank::before { color: #999 !important; }

/* 用户统计 */
.user-stats {
    background: #0d1224;
    border: 1px solid rgba(74, 158, 255, 0.12);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}
.user-stats h3 { color: #e0e8f0; font-size: 14px; margin-bottom: 15px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stats-row .stat-item {
    background: #141b2d;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}
.stats-row .stat-label { display: block; color: #6b7d8e; font-size: 12px; margin-bottom: 6px; }
.stats-row .stat-value { display: block; color: #4a9eff; font-size: 22px; font-weight: bold; }

@media (max-width: 768px) {
    .admin-sidebar { width: 160px; }
    .admin-content { margin-left: 160px; padding: 15px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 分类管理样式 ========== */
.categories-tree-wrapper {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
}

.category-tree {
    font-size: 14px;
}

.category-wrapper {
    margin-bottom: 2px;
}

.category-item {
    --tree-indent: 0px;
    padding: 12px 15px;
    padding-left: calc(15px + var(--tree-indent));
    margin-bottom: 2px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.category-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.category-item.is-root {
    background: linear-gradient(135deg, #162a46 0%, #1d3b61 100%);
    color: #eaf4ff;
    font-weight: 600;
    border-left: 3px solid #38bdf8;
}

.category-item.is-child {
    background: linear-gradient(135deg, #1e293b 0%, #26364b 100%);
    color: #dbeafe;
    border-left: 2px solid #0ea5e9;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-toggle {
    cursor: pointer;
    font-size: 12px;
    width: 20px;
    text-align: center;
    user-select: none;
    transition: transform 0.3s;
}

.category-toggle:hover {
    transform: scale(1.2);
}

.category-toggle-placeholder {
    width: 20px;
    display: inline-block;
}

.category-icon {
    font-size: 18px;
}

.category-name {
    font-size: 14px;
}

.category-code {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(74, 158, 255, 0.15);
    color: #7aa8d4;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.category-children {
    margin: 2px 0 0;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 5px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-action.btn-edit {
    background: #17a2b8;
    color: #fff;
}

.btn-action.btn-edit:hover {
    background: #138496;
}

.btn-action.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-action.btn-danger:hover {
    background: #c82333;
}


