/* AIRoleKit / AI角色套件 — css/style.css */
:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --active-bg: rgba(59, 130, 246, 0.2);
    --folder-color: #fbbf24;
    --file-color: #94a3b8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px 20px 20px;
    gap: 10px;
}

/* =============================
   顶部工具栏
   ============================= */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    flex-shrink: 0;
    position: relative;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
}

.step-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    padding: 3px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* =============================
   步骤导航按钮 ①~④
   ============================= */
.step-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.step-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    border-color: var(--border-color);
}
.step-num {
    font-size: 0.9rem;
    font-weight: 600;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-select {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 26px 5px 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394a3b8' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.15s;
}
.toolbar-select:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.2);
}
.toolbar-select:focus {
    border-color: var(--accent-color);
    color: var(--text-primary);
}
.toolbar-select option {
    background: #1e293b;
    color: var(--text-primary);
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.project-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-dropdown {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 30px 6px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 180px;
}

.project-dropdown:focus {
    border-color: var(--accent-color);
}

.project-dropdown option {
    background: #1e293b;
    color: var(--text-primary);
}

.brand {
    white-space: nowrap;
    flex-shrink: 0;
}

.storage-badge {
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(16,185,129,0.12);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.2);
}

/* =============================
   欢迎页
   ============================= */
.welcome-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    min-height: 0;
}

.welcome-content {
    text-align: center;
    max-width: 920px;
    padding: 60px 20px 20px;
}

.welcome-brand {
    margin-bottom: 40px;
}

.welcome-logo {
    font-size: clamp(1.6rem, 4.5vw, 2.8rem);
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    white-space: nowrap;
    line-height: 1.2;
    padding-top: 0.15em;
}

.welcome-sub {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 8px;
}

/* 三个入口卡片 */
.welcome-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 36px;
}

.welcome-card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1 / 1;
}
.welcome-card .card-desc,
.welcome-card .card-steps {
    flex: 0 0 auto;
}
.welcome-card:hover {
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.card-icon {
    font-size: 2.2rem;
    margin-bottom: 14px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    white-space: nowrap;
}

.card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
    white-space: nowrap;
    width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
}

.card-steps {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 12px;
    opacity: 0.75;
}

/* 欢迎页项目列表 */
.welcome-projects {
    text-align: left;
    margin-top: 8px;
}

.welcome-projects-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.welcome-projects-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.welcome-project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.welcome-project-item:hover {
    background: rgba(59,130,246,0.06);
    border-color: rgba(59,130,246,0.2);
}

.welcome-project-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.welcome-project-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

/* =============================
   主编辑区（三栏）
   ============================= */
.main-area {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
}

/* =============================
   分隔条（可拖拽调宽）
   ============================= */
.divider {
    width: 7px;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background 0.15s;
    margin: 0 1px;
    border-radius: 0;
    background: rgba(255,255,255,0.02);
}
.divider::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 20%;
    bottom: 20%;
    width: 1px;
    background: rgba(255,255,255,0.08);
    border-radius: 1px;
    transition: all 0.15s;
}
.divider:hover::after,
.divider.active::after {
    background: rgba(59, 130, 246, 0.5);
    left: 3px;
    top: 8%;
    bottom: 8%;
    width: 2px;
}
.divider:hover,
.divider.active {
    background: rgba(59, 130, 246, 0.08);
}

.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin: 0 2px;
}

.panel-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.col-left {
    flex: 0 0 400px;
    min-width: 220px;
    max-width: 550px;
}
.col-middle { flex: 1; min-width: 200px; }
.col-right { flex: 1; min-width: 200px; }

/* 拖拽调宽时全局禁止选中文本 */
body.resizing {
    user-select: none;
    -webkit-user-select: none;
    cursor: col-resize;
}

.tree-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.tree-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-children {
    list-style: none;
    padding-left: 22px;
    margin: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    margin-left: 10px;
}

.tree-node-row {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tree-node-row:hover { background: rgba(255, 255, 255, 0.05); }
.tree-node-row.active {
    background: var(--active-bg);
    border-color: var(--accent-color);
}

.icon-toggle {
    display: inline-block;
    width: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.icon-type {
    display: inline-block;
    width: 16px;
    text-align: center;
}

.include-checkbox {
    margin: 0 6px 0 0;
    cursor: pointer;
    accent-color: var(--accent-color);
    width: 14px;
    height: 14px;
}

.excluded-node .node-title {
    text-decoration: line-through;
    opacity: 0.4;
}

.tree-node-row.dragging { opacity: 0.5; }
.drag-over-top { border-top: 2px solid var(--accent-color) !important; }
.drag-over-bottom { border-bottom: 2px solid var(--accent-color) !important; }
.folder-icon { color: var(--folder-color); }
.file-icon { color: var(--file-color); }

textarea {
    width: 100%;
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.preview-area {
    width: 100%;
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    color: #cbd5e1;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-all;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* =============================
   按钮系统
   ============================= */
.btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.95); }

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--accent-color);
    min-width: 100px;
}

.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #f87171; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.btn-export {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    position: relative;
    overflow: hidden;
}
.btn-export:hover {
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
}

/* =============================
   模态框
   ============================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* 配置面板需盖在引导弹窗之上 */
#configModal.modal-overlay {
    z-index: 1100;
}

.modal {
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.modal-wide {
    width: 680px;
}

.modal-body {
    max-height: 55vh;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.modal-close:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* 步骤指示器 */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
}

.step-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
    flex-shrink: 0;
}

.step-dot.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 12px rgba(59,130,246,0.4);
}

.step-dot.done {
    background: #10b981;
    color: white;
}

.step-line {
    width: 60px;
    height: 2px;
    background: rgba(255,255,255,0.08);
    margin: 0 8px;
    flex-shrink: 0;
}

/* 向导步骤 */
.wizard-step-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.wizard-step-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.wizard-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wizard-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-option:hover {
    border-color: rgba(59,130,246,0.3);
    background: rgba(59,130,246,0.05);
}

.wizard-option.selected {
    border-color: var(--accent-color);
    background: rgba(59,130,246,0.1);
}

.wizard-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent-color);
    flex-shrink: 0;
}

.wizard-option-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.wizard-option-sub {
    display: block;
    font-size: 0.8rem;
}

.cfg-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
    line-height: 1.5;
}
    color: var(--text-secondary);
}

.wizard-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    margin-top: 6px;
}

.wizard-input:focus {
    border-color: var(--accent-color);
}

.wizard-field label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 模态框底部 */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* =============================
   品牌标签（选择平台用）
   ============================= */
.brand-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.brand-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.brand-tab:hover {
    background: rgba(59,130,246,0.06);
    border-color: rgba(59,130,246,0.3);
}
.brand-tab.active {
    background: rgba(59,130,246,0.12);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(59,130,246,0.15);
}

.brand-tab-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.brand-tab-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 平台选项列表（品牌下级） */
.platform-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* =============================
   角色卡片（选择角色用）
   ============================= */
.role-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 12px 20px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.role-card:hover {
    background: rgba(59,130,246,0.06);
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-2px);
}
.role-card.active {
    background: rgba(59,130,246,0.12);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(59,130,246,0.15);
}

.role-card-icon {
    font-size: 2.4rem;
    line-height: 1;
}

.role-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.role-card-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.role-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    opacity: 0.75;
    margin-top: 2px;
}

.role-card-placeholder {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* =============================
   空状态提示
   ============================= */
.empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.8;
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }

/* =============================
   下拉菜单
   ============================= */
.dropdown-item:hover {
    background: rgba(59,130,246,0.1);
    color: var(--text-primary);
}
