/* ========== 后台管理样式 ========== */
.admin-body { margin: 0; background: #f5f5f7; }

.admin-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.admin-sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.admin-brand {
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-nav { flex: 1; padding: 12px 0; }
.admin-nav-item {
    display: block;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}
.admin-nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.admin-nav-item.active { color: #fff; background: rgba(197,168,128,0.2); border-left: 3px solid #C5A880; }
.admin-sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.1); }
.admin-back-link { display: block; color: rgba(255,255,255,0.5); text-decoration: none; font-size: 13px; padding: 6px 0; }
.admin-back-link:hover { color: #fff; }

/* 主内容区 */
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-header {
    background: #fff;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e7;
}
.admin-header h1 { font-size: 20px; margin: 0; color: #1d1d1f; }
.admin-user-info { font-size: 13px; color: #6e6e73; }
.admin-content { flex: 1; padding: 24px 32px; overflow-y: auto; }

/* 模块切换 */
.admin-module { display: none; }
.admin-module.active { display: block; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-value { font-size: 32px; font-weight: 700; color: #0071E3; }
.stat-label { font-size: 13px; color: #6e6e73; margin-top: 4px; }
.stat-sublabel { font-size: 11px; color: #a1a1aa; margin-top: 4px; }
.stat-sublabel span { color: #C5A880; font-weight: 600; }

/* 面板 */
.admin-panel {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.admin-panel h3 { margin: 0 0 16px 0; font-size: 16px; color: #1d1d1f; }

/* 工具栏 */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.admin-toolbar select, .admin-toolbar input[type="text"] {
    padding: 6px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-size: 13px;
}

/* 表格 */
.admin-table-wrap {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
    background: #f5f5f7;
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    color: #6e6e73;
    border-bottom: 1px solid #e5e5e7;
}
.admin-table td { padding: 10px 16px; border-bottom: 1px solid #f0f0f2; color: #1d1d1f; }
.admin-table tr:hover td { background: #fafafa; }
.admin-table .action-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    margin-right: 4px;
}
.admin-table .action-btn:hover { background: #f0f0f2; }
.admin-table .action-btn.danger { color: #e54c5e; border-color: #e54c5e; }
.admin-table .action-btn.danger:hover { background: #fef0f1; }

/* 角色标签 */
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.role-badge.admin { background: #fff7ed; color: #c2410c; }
.role-badge.consultant { background: #eff8ff; color: #0071e3; }

/* 提示词管理 */
.prompt-layout { display: flex; gap: 16px; height: calc(100vh - 180px); }
.prompt-sidebar { width: 240px; background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow-y: auto; }
.prompt-file-list { list-style: none; margin: 0; padding: 0; }
.prompt-file-list li { padding: 8px 12px; cursor: pointer; border-radius: 6px; font-size: 13px; color: #1d1d1f; }
.prompt-file-list li:hover { background: #f5f5f7; }
.prompt-file-list li.active { background: #eff8ff; color: #0071e3; font-weight: 500; }
.prompt-file-list .file-meta { font-size: 11px; color: #a1a1aa; margin-top: 2px; }
.prompt-editor { flex: 1; background: #fff; border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow: hidden; }
.prompt-textarea {
    flex: 1;
    border: none;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: none;
    outline: none;
    border-top: 1px solid #e5e5e7;
}

/* 弹窗 */
.admin-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    width: 400px;
    max-width: 90vw;
}
.admin-modal-box h3 { margin: 0 0 20px 0; font-size: 18px; color: #1d1d1f; }
.admin-form-group { margin-bottom: 16px; }
.admin-form-group label { display: block; font-size: 13px; color: #6e6e73; margin-bottom: 6px; }
.admin-form-group input, .admin-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.admin-modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* 导出区 */
.memory-export-area {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.hidden { display: none !important; }

/* 移动端菜单按钮与遮罩（桌面端隐藏） */
.admin-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #1d1d1f;
    cursor: pointer;
    padding: 6px;
    margin-right: 10px;
    border-radius: 6px;
}
.admin-menu-toggle:hover { background: #f5f5f7; }
.admin-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9998;
}
.admin-sidebar-overlay:not(.hidden) { display: block; }

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    .admin-layout { position: relative; }
    .admin-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 260px;
        max-width: 80vw;
    }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-main { width: 100vw; overflow-x: hidden; }
    .admin-header {
        padding: 12px 16px;
        justify-content: flex-start;
    }
    .admin-header h1 { font-size: 16px; flex: 1; }
    .admin-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .admin-content { padding: 16px; }

    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 26px; }

    .admin-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .admin-toolbar select,
    .admin-toolbar input[type="text"] {
        flex: 1;
        min-width: 120px;
    }

    .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-table { min-width: 600px; }

    .prompt-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 160px);
    }
    .prompt-sidebar {
        width: 100%;
        max-height: 200px;
    }
    .prompt-editor { min-height: 300px; }

    .admin-modal-box {
        width: 92vw;
        max-width: 400px;
        padding: 20px 24px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .admin-form-group input, .admin-form-group select { font-size: 16px; }
}

@media (max-width: 400px) {
    .admin-header h1 { font-size: 15px; }
    .admin-content { padding: 12px; }
    .admin-brand { font-size: 16px; padding: 16px 20px; }
    .admin-nav-item { padding: 10px 20px; font-size: 13px; }
}
