/* =============================================
 * char-modal-shared.css
 * 统一人物编辑弹窗样式 - 解说剧/对话剧/资产库共用
 * 从 narration-wizard.css 提取
 * ============================================= */

/* --- 弹窗主体：左右分栏 --- */
.wc-modal-body { display: flex; flex: 1; min-height: 0; overflow-y: auto; }
.wc-left { flex: 0 0 450px; padding: 20px; border-right: 1px solid #333; overflow-y: auto; }
.wc-right { flex: 1; padding: 20px; overflow-y: auto; }

/* --- 预览图 --- */
.wc-preview-img-top {
    width: 100%; aspect-ratio: 3/4;
    border-radius: 6px; overflow: hidden;
    background: rgba(0,0,0,0.78); margin-bottom: 10px; display: flex;
    align-items: flex-start; justify-content: center;
    position: relative;
}
.wc-preview-img-top img { width: 100%; height: 100%; object-fit: cover; object-position: top; cursor: context-menu; }

/* --- 右键菜单 --- */
.wc-ctx-menu {
    display: none; position: fixed; z-index: 10000;
    background: rgba(10,10,10,0.65); border: 1px solid #444; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55); min-width: 160px;
    padding: 4px 0; overflow: hidden;
}
.wc-ctx-menu.show { display: block; }
.wc-ctx-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 16px;
    color: #ccc; font-size: 13px; cursor: pointer; transition: background 0.15s;
    white-space: nowrap; border: none; background: none; width: 100%; text-align: left;
}
.wc-ctx-item:hover { background: rgba(255,133,162,0.15); color: #FF85A2; }
.wc-ctx-item .ctx-icon { font-size: 15px; flex-shrink: 0; }

/* --- 想象图+三视图并排容器 --- */
.wc-gen-dual { display: flex; gap: 20px; }
.wc-gen-dual > div { flex: 1; min-width: 0; }

/* --- 三视图流程 --- */
.wc-ref-flow { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.wc-ref-flow-img { width: 80px; border-radius: 6px; overflow: hidden; background: transparent; flex-shrink: 0; cursor: pointer; }
.wc-ref-flow-img img { width: 100%; height: auto; display: block; }
.wc-ref-arrow { color: #FF85A2; font-size: 24px; flex-shrink: 0; font-weight: bold; }
.wc-ref-flow-result { flex: 1; border-radius: 6px; overflow: hidden; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; min-height: 60px; }
.wc-ref-flow-result img { width: 100%; height: auto; display: block; cursor: pointer; border-radius: 6px; }

/* --- 版本分组卡片 --- */
.wc-ver-group { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 6px; background: rgba(0,0,0,0.75);
    border: 2px solid transparent; cursor: pointer; transition: all 0.2s; }
.wc-ver-group:hover { border-color: rgba(255,133,162,0.5); transform: scale(1.03); }
.wc-ver-group.active { border-color: #FF85A2; background: rgba(255,133,162,0.1); }
.wc-ver-group-img { aspect-ratio: var(--wc-preview-ratio, 9/16); border-radius: 4px; overflow: hidden; background: rgba(0,0,0,0.3); }
.wc-ver-group-img img { width: 100%; height: 100%; object-fit: contain; }
.wc-ver-group-ref { border-radius: 4px; overflow: hidden; background: transparent; display: flex; align-items: center; justify-content: center; }
.wc-ver-group-ref img { width: 100%; height: auto; display: block; }
.wc-ver-group-ref-empty { color: #555; font-size: 9px; }
.wc-ver-group-label { text-align: center; font-size: 10px; color: #888; padding: 2px 0; }
.wc-ver-group.active .wc-ver-group-label { color: #FF85A2; font-weight: 600; }

/* --- 人物导航栏 --- */
.wc-char-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.wc-char-nav-name { font-size: 15px; font-weight: 600; color: #fff; }
.wc-char-nav-indicator { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #888; }
.wc-char-nav-btn {
    width: 24px; height: 24px; border-radius: 4px; background: #333; border: 1px solid #444;
    color: #ccc; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.wc-char-nav-btn:hover { background: #444; color: #fff; }

/* --- 表单元素 --- */
.wc-form-row { display: flex; gap: 10px; margin-bottom: 12px; }
.wc-form-row > div { flex: 1; }
.wc-form-label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.wc-form-select {
    width: 100%; padding: 7px 10px; background: rgba(0,0,0,0.70); border: 1px solid #333;
    border-radius: 6px; color: #ddd; font-size: 12px; outline: none; box-sizing: border-box;
}
.wc-form-select:focus { border-color: #FF85A2; }
.wc-form-input {
    width: 100%; padding: 7px 10px; background: rgba(0,0,0,0.70); border: 1px solid #333;
    border-radius: 6px; color: #fff; font-size: 13px; outline: none; box-sizing: border-box;
}
.wc-form-input:focus { border-color: #FF85A2; }
.wc-form-group { margin-bottom: 14px; }

/* --- 配音声线 --- */
.wc-voice-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    background: rgba(0,0,0,0.70); border: 1px solid #333; border-radius: 6px; margin-bottom: 12px;
}
.wc-voice-row span { flex: 1; font-size: 12px; color: #ddd; }
.wc-voice-edit-btn {
    background: none; border: none; color: #FF85A2; font-size: 14px; cursor: pointer; padding: 2px;
}
.wc-voice-switch {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    background: rgba(0,0,0,0.70); border: 1px solid #333; border-radius: 6px;
    color: #ddd; font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.wc-voice-switch:hover {
    border-color: rgba(255, 133, 162, 0.5);
    background: rgba(255, 133, 162, 0.05);
}
.wc-voice-arrow { color: #666; font-size: 10px; transition: color 0.2s; }
.wc-voice-switch:hover .wc-voice-arrow { color: #FF85A2; }

/* --- 标签页 --- */
.wc-tabs { display: flex; border-bottom: 1px solid #333; margin-bottom: 16px; }
.wc-tab {
    padding: 10px 14px; background: none; border: none;
    border-bottom: 2px solid transparent; color: #888; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.wc-tab.active { color: #fff; border-bottom-color: #FF85A2; font-weight: 600; }
.wc-tab:hover { color: #ccc; }

/* --- 样式行 --- */
.wc-style-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: rgba(0,0,0,0.70); border: 1px solid #333; border-radius: 6px; font-size: 12px; color: #ddd;
}

/* --- 模式切换按钮组 --- */
.wc-gen-mode-toggle {
    display: flex; background: rgba(0,0,0,0.70); border: 1px solid #333; border-radius: 6px; overflow: hidden;
}
.wc-gen-mode-btn {
    flex: 1; padding: 8px 12px; background: none; border: none; color: #888;
    font-size: 12px; cursor: pointer; transition: all 0.2s; text-align: center;
}
.wc-gen-mode-btn.active {
    background: linear-gradient(135deg, #FF85A2, #D4A574); color: #0a0a0a; font-weight: 600;
}
.wc-gen-mode-btn:not(.active):hover { background: #222; color: #ccc; }

/* --- 参考图上传区域 --- */
.wc-ref-upload-area-v2 { margin-top: 10px; padding: 8px 0; }
.wc-ref-cards-row { display: flex; align-items: flex-end; gap: 10px; }
.wc-ref-cards-stack {
    position: relative; display: flex; align-items: flex-end;
    min-height: 90px; flex: 1; min-width: 0;
}
.wc-ref-card {
    width: 68px; height: auto; border-radius: 6px; overflow: hidden;
    background: transparent; border: 1.5px solid #333; position: relative;
    flex-shrink: 0; cursor: pointer; transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.wc-ref-cards-stack.stacked .wc-ref-card { position: absolute; bottom: 0; }
.wc-ref-cards-stack.stacked.expanded { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.wc-ref-cards-stack.stacked.expanded .wc-ref-card { position: relative; transform: none !important; }
.wc-ref-cards-stack:not(.stacked) .wc-ref-card { margin-right: -12px; }
.wc-ref-cards-stack:not(.stacked) .wc-ref-card:last-child { margin-right: 0; }
.wc-ref-card img { width: 100%; height: auto; display: block; }
.wc-ref-card-label {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #FF85A2; font-size: 9px; text-align: center;
    padding: 10px 0 3px; font-weight: 600;
}
.wc-ref-card-del {
    position: absolute; top: 3px; right: 3px; width: 16px; height: 16px;
    background: rgba(0,0,0,0.70); border: 1px solid #555; border-radius: 50%;
    color: #f44; font-size: 11px; line-height: 14px; text-align: center;
    cursor: pointer; opacity: 0; transition: opacity 0.2s; z-index: 3;
}
.wc-ref-card:hover .wc-ref-card-del { opacity: 1; }
.wc-ref-card-del:hover { background: rgba(244,67,54,0.4); color: #fff; }
.wc-ref-card:hover {
    transform: translateY(-8px) !important; z-index: 20 !important;
    border-color: #FF85A2; box-shadow: 0 6px 16px rgba(255,133,162,0.3);
}
.wc-ref-stack-count {
    position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px;
    background: #FF85A2; color: #0a0a0a; font-size: 10px; font-weight: 700;
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    z-index: 50; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    padding: 0 5px;
}
.wc-ref-add-card {
    width: 68px; aspect-ratio: 9/16; border: 1.5px dashed #444; border-radius: 6px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #666; cursor: pointer; transition: all 0.25s cubic-bezier(0.4,0,0.2,1); flex-shrink: 0;
    background: rgba(255,255,255,0.02);
}
.wc-ref-add-card:hover { border-color: #FF85A2; color: #FF85A2; background: rgba(255,133,162,0.06); }
.wc-ref-cards-stack.stacked:not(.expanded) .wc-ref-card-del { display: none; }
.wc-ref-cards-stack.stacked:not(.expanded) .wc-ref-add-card { display: none; }
.wc-ref-cards-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 68px; aspect-ratio: 9/16; border: 1.5px dashed #444; border-radius: 6px;
    color: #555; font-size: 10px; cursor: pointer; transition: all 0.2s;
}
.wc-ref-cards-empty:hover { border-color: #FF85A2; color: #FF85A2; }

/* --- 提示词输入 --- */
.wc-prompt-area {
    width: 100%; min-height: 100px; background: rgba(0,0,0,0.70); border: 1px solid #333;
    border-radius: 6px; color: #ddd; font-size: 12px; padding: 8px; resize: vertical;
    line-height: 1.5; outline: none; box-sizing: border-box;
}
.wc-prompt-area:focus { border-color: #FF85A2; }
.wc-prompt-counter { text-align: right; font-size: 11px; color: #666; margin-top: 4px; }

/* --- 历史网格 --- */
.wc-history-grid { display: grid; grid-template-columns: repeat(auto-fill, 100px); gap: 10px; margin-top: 8px; }
.wc-history-thumb {
    aspect-ratio: 3/4; border-radius: 4px; overflow: hidden; cursor: pointer;
    border: 2px solid transparent; transition: all 0.2s;
}
.wc-history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wc-history-thumb:hover, .wc-history-thumb.active { border-color: #FF85A2; }

/* --- 描述显示 --- */
.wc-desc-display {
    padding: 10px; background: rgba(0,0,0,0.70); border: 1px solid #333; border-radius: 6px;
    font-size: 12px; color: #ccc; line-height: 1.5; max-height: 120px; overflow-y: auto;
}

/* --- 弹窗底部 --- */
.wc-modal-footer {
    display: flex; gap: 8px; padding: 16px 20px; border-top: 1px solid #333; flex-shrink: 0;
}

/* --- 按钮 --- */
.wc-confirm-btn {
    width: 100%; padding: 12px; background: linear-gradient(135deg, #ff7f50, #ff6347);
    border: none; border-radius: 6px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 16px;
}
.wc-confirm-btn:hover { opacity: 0.9; }
.wc-gen-btn {
    width: 100%; padding: 10px; background: linear-gradient(135deg, #FF85A2, #D4A574);
    border: none; border-radius: 6px; color: #0a0a0a; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 12px;
    transition: all 0.15s ease;
}
.wc-gen-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.wc-gen-btn:active { transform: scale(0.96); opacity: 0.85; }

/* --- 弹窗容器通用（覆盖inline display） --- */
.wc-modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 5000;
}
.wc-modal-container {
    display: none; position: fixed; top: 50%; left: 50%;
    transform: translate(-50%,-50%); width: 1700px; max-width: 96vw; height: 92vh;
    background: #1a1a1a; border: 1px solid #333; border-radius: 12px;
    z-index: 5001; overflow: visible; flex-direction: column;
}
.wc-modal-container[style*="flex"], .wc-modal-container[style*="block"] {
    display: flex !important; flex-direction: column;
}

/* --- 弹窗头部 --- */
.wc-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-bottom: 1px solid #333;
}
.wc-modal-header h3 { color: #FF85A2; font-size: 16px; margin: 0; }
.wc-modal-close {
    background: none; border: none; color: #888; font-size: 22px; cursor: pointer; padding: 0 4px;
}
.wc-modal-close:hover { color: #fff; }

/* --- 底部按钮通用 --- */
.wc-btn-delete {
    padding: 8px 16px; font-size: 12px; background: transparent;
    border: 1px solid #f44336; border-radius: 6px; color: #f44336; cursor: pointer;
}
.wc-btn-delete:hover { background: rgba(244,67,54,0.1); }
.wc-footer-right { display: flex; gap: 10px; }
.wc-btn-cancel {
    padding: 8px 20px; font-size: 12px; background: #333;
    border: 1px solid #444; border-radius: 6px; color: #ccc; cursor: pointer;
}
.wc-btn-cancel:hover { background: #444; color: #fff; }
.wc-btn-save {
    padding: 8px 20px; font-size: 12px; font-weight: 600;
    background: linear-gradient(135deg, #FF85A2, #D4A574);
    border: none; border-radius: 6px; color: #0a0a0a; cursor: pointer;
}
.wc-btn-save:hover { opacity: 0.9; }
.wc-btn-save-global {
    padding: 8px 20px; font-size: 12px; font-weight: 600;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none; border-radius: 6px; color: #fff; cursor: pointer;
}
.wc-btn-save-global:hover { opacity: 0.85; }

/* --- 模型选择器 --- */
.wc-model-selector { position: relative; }
.wc-model-display {
    padding: 8px 10px; background: #111; border: 1px solid #333;
    border-radius: 6px; color: #ddd; font-size: 12px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
}
.wc-model-display:hover { border-color: #555; }
.wc-model-dropdown {
    display: none; position: fixed; margin-top: 2px;
    background: rgba(10,10,10,0.95); border: 1px solid #444;
    border-radius: 6px; z-index: 15000; overflow-y: auto;
    max-height: 320px; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.wc-model-option {
    padding: 10px 12px; color: #ccc; font-size: 12px; cursor: pointer;
    transition: background 0.15s; display: flex; align-items: center; min-height: 44px;
}
.wc-model-option:hover { background: rgba(255,133,162,0.15); color: #FF85A2; }
.wc-model-option.selected { background: rgba(255,133,162,0.1); color: #FF85A2; }
.wc-model-icon { width: 30px; height: 30px; border-radius: 5px; margin-right: 8px; object-fit: cover; flex-shrink: 0; }
.wc-model-label { flex: 1; }
.wc-model-price { font-size: 10px; color: #FF85A2; margin-left: 6px; white-space: nowrap; flex-shrink: 0; }

/* --- 生成按钮动画 --- */
.gen-btn-animated { position: relative; overflow: visible; transition: all 0.3s ease; }
.gen-btn-animated.loading { pointer-events: none; background: linear-gradient(135deg, #8B7355, #6B5344) !important; }
.gen-btn-animated .btn-content {
    display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; z-index: 2;
}
.gen-btn-animated .btn-progress-bar {
    position: absolute; left: 0; bottom: 0; height: 3px;
    background: linear-gradient(90deg, #FF85A2, #FF85A2, #FF85A2);
    background-size: 200% 100%; animation: progressShine 1.5s ease-in-out infinite;
    border-radius: 0 0 6px 6px; transition: width 0.3s ease;
}
.gen-btn-animated .btn-percentage {
    font-size: 11px; font-weight: bold; color: #FF85A2; min-width: 36px; text-align: right;
}
@keyframes progressShine { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- API/ComfyUI 模式切换 --- */
.model-mode-toggle {
    display: flex; background: rgba(0,0,0,0.70); border: 1px solid #333;
    border-radius: 6px; overflow: hidden; flex-shrink: 0;
}
.model-mode-toggle .mode-btn {
    padding: 8px 12px; background: none; border: none; color: #888;
    font-size: 11px; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.model-mode-toggle .mode-btn.active {
    background: rgba(255,133,162,0.2); color: #FF85A2; font-weight: 600;
}
.model-mode-toggle .mode-btn:not(.active):hover { background: #222; color: #ccc; }
