/**
 * AI设计 - 角色设计子页样式（仅本子页使用，命名空间 ai-design-*）
 * 布局：左/右卡片列 + 中间视图与操作栏；字体 Microsoft YaHei
 */

/* ========== 角色设计页根：占满内容区、无滚动条、一屏适配 ========== */
#ai-design-content-role.ai-design-content-page.active {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 16px;
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.ai-design-role-layout {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    gap: 16px;
    flex: 1;
}

/* ========== 左侧 / 右侧卡片列（可收缩以适配一屏） ========== */
.ai-design-role-left,
.ai-design-role-right {
    flex-shrink: 0;
    width: 200px;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.ai-design-role-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* 左侧底部占位（与右侧操作区视觉平衡） */
.ai-design-role-left-placeholder {
    width: 100%;
    max-width: 200px;
    min-height: 40px;
    flex-shrink: 0;
}

/* 右侧：视觉风格下方为提示词、保存到项目资产、模型选择、生成角色 */
.ai-design-role-right-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 200px;
    margin-top: auto;
}

.ai-design-role-right-actions .ai-design-role-prompt-btn,
.ai-design-role-right-actions .ai-design-role-save-asset-btn {
    width: 100%;
}

.ai-design-role-right-actions .ai-design-role-model-wrap {
    flex: none;
    width: 100%;
}

.ai-design-role-right-actions .ai-design-role-model-select {
    width: 100%;
}

.ai-design-role-right-actions .ai-design-role-generate-btn {
    width: 100%;
}

/* 右侧按钮：提示词、保存到项目资产 */
.ai-design-role-prompt-btn,
.ai-design-role-save-asset-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    color: var(--text-primary, #e0e0e0);
    background-color: var(--bg-tertiary, #1a1a1a);
    border: 1px solid var(--border-primary, #333333);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ai-design-role-prompt-btn:hover,
.ai-design-role-save-asset-btn:hover {
    border-color: var(--border-secondary, #404040);
    background-color: var(--bg-hover, #333333);
}

.ai-design-role-card {
    width: 100%;
    max-width: 200px;
    flex: 1 1 0;
    min-height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-primary, #333333);
    background-color: var(--bg-tertiary, #1a1a1a);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.ai-design-role-card:hover {
    border-color: var(--border-secondary, #404040);
    background-color: var(--bg-hover, #333333);
}

.ai-design-role-card-img {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary, #242424);
    position: relative;
}

.ai-design-role-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 图标加载失败时的占位（class 加在 .ai-design-role-card-img 上） */
.ai-design-role-card-img.ai-design-role-card-img-placeholder {
    background-color: var(--bg-tertiary, #2a2a2a);
}

.ai-design-role-card-img.ai-design-role-card-img-placeholder img {
    opacity: 0;
}

.ai-design-role-card-img.ai-design-role-card-img-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='1.5'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E") center no-repeat;
    opacity: 0.5;
}

.ai-design-role-card-title {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: normal;
    color: var(--text-primary, #e0e0e0);
    text-align: center;
    border-top: 1px solid var(--border-primary, #333333);
    flex-shrink: 0;
}

/* ========== 中间列：视图 + 属性行（收缩适配一屏） ========== */
.ai-design-role-center {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

/* 主视图区域（16:9 比例） */
.ai-design-role-view-wrap {
    flex: 1;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-primary, #333333);
    background-color: var(--bg-secondary, #242424);
}

.ai-design-role-view {
    width: 100%;
    height: 100%;
    position: relative;
    aspect-ratio: 16 / 9;
    max-height: 100%;
}

.ai-design-role-view-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ai-design-role-view-img-placeholder {
    object-fit: cover;
    background-color: var(--bg-tertiary, #2a2a2a);
    opacity: 0.8;
}

/* 视图下方一行：底框包围，与主视图宽度对齐；左侧姓名，右侧性别/年龄/身高/角色灵魂 */
.ai-design-role-attr-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid var(--border-primary, #333333);
    border-radius: 8px;
    background-color: var(--bg-secondary, #242424);
}

.ai-design-role-name-wrap {
    flex: 0 1 auto;
    min-width: 120px;
    max-width: 200px;
}

.ai-design-role-attr-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}

/* 性别/年龄/身高：深色主题，与右侧提示词/保存按钮一致 */
.ai-design-role-attr-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    color: var(--text-primary, #e0e0e0);
    background-color: var(--bg-tertiary, #1a1a1a);
    border: 1px solid var(--border-primary, #333333);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ai-design-role-attr-btn:hover {
    border-color: var(--border-secondary, #404040);
    background-color: var(--bg-hover, #333333);
}

.ai-design-role-name-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    color: var(--text-primary, #e0e0e0);
    background-color: var(--bg-tertiary, #1a1a1a);
    border: 1px solid var(--border-primary, #333333);
    border-radius: 6px;
    box-sizing: border-box;
}

.ai-design-role-name-input::placeholder {
    color: var(--text-muted, #666666);
}

.ai-design-role-name-input:focus {
    outline: none;
    border-color: var(--text-accent, #4a9eff);
}

/* 角色灵魂：深色主题，与右侧提示词/保存按钮一致 */
.ai-design-role-soul-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    color: var(--text-primary, #e0e0e0);
    background-color: var(--bg-tertiary, #1a1a1a);
    border: 1px solid var(--border-primary, #333333);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ai-design-role-soul-btn:hover {
    border-color: var(--border-secondary, #404040);
    background-color: var(--bg-hover, #333333);
}

/* 模型下拉（用于右侧列） */
.ai-design-role-model-wrap {
    min-width: 0;
}

.ai-design-role-model-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    color: var(--text-primary, #e0e0e0);
    background-color: var(--bg-tertiary, #1a1a1a);
    border: 1px solid var(--border-primary, #333333);
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
}

.ai-design-role-model-select:focus {
    outline: none;
    border-color: var(--text-accent, #4a9eff);
}

.ai-design-role-generate-btn {
    padding: 14px 24px;
    font-size: 15px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.ai-design-role-generate-btn:hover {
    opacity: 0.9;
}
