﻿html, body { overflow: hidden; }
.container { display: flex; height: 100vh; }

/* 左侧面板 */
.sidebar { width: 360px; background: #2c3e50; color: white; overflow-y: auto; border-right: 1px solid #34495e; }

.sidebar-header { padding: 20px; background: #34495e; border-bottom: 1px solid #4a5f7a; }

.sidebar-header h2 { font-size: 18px; margin-bottom: 10px; font-weight: bold; }

.status-bar { font-size: 12px; color: #bdc3c7; padding: 5px 0; }

/* ─── 会员状态条（顶栏右侧，与显卡选择同一行）：非会员显示额度，会员显示到期时间 ─── */
.vip-chip { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0;
    padding: 4px 6px 4px 10px; border-radius: 14px; background: #f6f8fb; border: 1px solid #e6ebf1;
    font-size: 12px; line-height: 1.4; white-space: nowrap; }
.vip-chip > i { flex-shrink: 0; color: #e0a800; font-size: 12px; }
.vip-chip .vip-chip-txt { color: #5d6d7e; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vip-chip.is-vip { background: #fffaf0; border-color: #f2d995; }
.vip-chip.is-vip > i { color: #d4a017; }
.vip-chip.is-vip .vip-chip-txt { color: #8a6100; }
.vip-chip .vip-chip-btn { flex-shrink: 0; padding: 3px 10px; font-size: 12px; line-height: 1.5; border-radius: 10px;
    cursor: pointer; white-space: nowrap; color: #5a4600; background: #f7d774; border: none; }
.vip-chip .vip-chip-btn:hover { background: #f1c40f; }
/* 「免费领取」：与「开通会员」同排，但用描边弱一档，主推仍是开通；仅非会员显示 */
.vip-chip .vip-chip-free { flex-shrink: 0; padding: 3px 10px; font-size: 12px; line-height: 1.5; border-radius: 10px;
    cursor: pointer; white-space: nowrap; color: #b8860b; background: #fff; border: 1px solid rgba(212, 160, 23, .55); }
.vip-chip .vip-chip-free:hover { background: #fff8e6; border-color: #d4a017; }
.vip-chip.is-vip .vip-chip-btn { background: transparent; color: #a67c00; border: 1px solid rgba(212, 160, 23, .45); }
.vip-chip.is-vip .vip-chip-btn:hover { background: #fff3d6; }
.vip-chip .vip-chip-link { flex-shrink: 0; padding: 3px 8px; font-size: 12px; line-height: 1.5; border-radius: 10px;
    cursor: pointer; white-space: nowrap; color: #7f8c8d; background: transparent; border: none; }
.vip-chip .vip-chip-link:hover { color: #2980b9; background: #eef4fa; }

/* ─── 会员说明弹框（宽度 820，字号比常规弹框提一档，避免行太长看着空） ─── */
.vip-dlg { font-size: 14px; color: #4a5866; line-height: 1.8; }
.vip-dlg-lead { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px;
    background: #fff8e6; border: 1px solid #f7e2a8; border-radius: 6px; }
.vip-dlg-lead > i { flex-shrink: 0; color: #e0a800; font-size: 20px; line-height: 1.4; }
.vip-dlg-lead b { display: block; color: #8a6100; font-size: 14px; }
.vip-dlg-lead span { display: block; margin-top: 3px; color: #9a7b2a; font-size: 13px; line-height: 1.7; }
.vip-dlg-letter p { margin: 0 0 9px; }
.vip-dlg-letter p:last-child { margin-bottom: 0; }
.vip-dlg-plans { display: flex; gap: 12px; margin: 14px 0; }
.vip-dlg-plan { flex: 1 1 0; min-width: 0; padding: 12px 16px; border: 1px solid #e6ebf1; border-radius: 6px; background: #fafcfe; }
.vip-dlg-plan.is-vip { background: linear-gradient(180deg, #fffaf0 0%, #fffdf7 100%); border-color: #f2d995; }
.vip-dlg-plan h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 14px; font-weight: bold; color: #2c3e50; }
.vip-dlg-plan.is-vip h4 { color: #a67c00; }
.vip-dlg-plan h4 i { font-size: 13px; }
.vip-dlg-plan ul { margin: 0; padding-left: 18px; }
.vip-dlg-plan li { list-style: disc; font-size: 13px; line-height: 1.8; color: #5d6d7e; }
.vip-dlg-plan.is-vip li { color: #8a6100; }
.vip-dlg-tip { margin-top: 12px; font-size: 13px; color: #95a5a6; }
.vip-dlg-tip a { color: #3498db; }

/* 会话底部条上的电源按钮：重启服务 / 卸载模型 / 加载模型 */
.footer-actions { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.footer-actions .fbtn {
    padding: 3px 9px; font-size: 12px; line-height: 1.4;
    color: #ecf0f1; background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18); border-radius: 4px;
    cursor: pointer; white-space: nowrap;
    transition: background .2s, border-color .2s, color .2s;
}
.footer-actions .fbtn:hover { background: rgba(52, 152, 219, .45); border-color: #3498db; }
.footer-actions .fbtn:active { background: rgba(52, 152, 219, .7); }
/* ComfyUI 专属快捷入口（极简发布 / 资产管理）：青绿色调，区别于重启/卸载等控制按钮 */
.footer-actions .fbtn-ext { color: #a3e9d4; border-color: rgba(46, 204, 113, .38); background: rgba(46, 204, 113, .12); }
.footer-actions .fbtn-ext:hover { background: rgba(46, 204, 113, .32); border-color: #2ecc71; color: #fff; }
.footer-actions .fbtn i { margin-right: 3px; font-size: 11px; }
.footer-actions .fbtn:disabled { opacity: .38; cursor: not-allowed; background: transparent; border-color: rgba(255, 255, 255, .1); }
.footer-actions .fbtn:disabled:hover { background: transparent; border-color: rgba(255, 255, 255, .1); }

#mainStatus { overflow: hidden; height: 20px; }

.sidebar-section { padding: 10px; border-bottom: 1px solid #34495e; }

.sidebar-section h3 { font-size: 14px; margin-bottom: 10px; color: #ecf0f1; }

.btn { padding: 8px 7px; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; margin: 2px; transition: all 0.3s; background-color: white; }

.btn-primary { background: #3498db; color: white; }

.btn-primary:hover { background: #2980b9; }

.btn-success { background: #27ae60; color: white; }

.btn-success:hover { background: #229954; }

.btn-danger { background: #e74c3c; color: white; }

.btn-danger:hover { background: #c0392b; }

.btn-warning { background: #f39c12; color: white; }

.btn-warning:hover { background: #e67e22; }

.btn-orange { background: #f39c12; color: white; }

.btn-orange:hover { background: #f39c12; }

.input-group { margin: 10px 0; }

.input-group label { display: block; font-size: 12px; margin-bottom: 5px; color: #bdc3c7; }

.input-group input, .input-group select { width: 100%; padding: 6px; border: 1px solid #4a5f7a; border-radius: 3px; background: #34495e; color: white; font-size: 12px; }

#condawrap .btn { display: none; }

.env-list { overflow-y: auto; }

/* 项目管理 - 项目列表：加高 40px（160 → 200） */
#projectList { max-height: 200px; }

/* Conda环境管理 - 环境列表：保持 160px 不变（需要压缩可改为 140px） */
#envList { max-height: 160px; }

.env-item { padding: 8px; margin: 2px 0; background: #34495e; border-radius: 3px; cursor: pointer; font-size: 12px; display: flex; justify-content: space-between; align-items: center; position: relative; }

.env-item:hover { background: #4a5f7a; }

.env-item.active { background: #3498db; }

.env-item .env-actions { display: none; position: absolute; right: 0; }

/* 目录/名称过长时不换行、尾部省略号，完整内容用 title 悬停查看 */
.env-item > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* hover 时右侧按钮浮出，给文字让出空间，避免按钮压住路径 */
.env-item:hover > div:first-child { padding-right: 62px; }

.env-item:hover .env-actions { display: block; }

.progress-bar { width: 100%; height: 4px; background: #34495e; border-radius: 2px; margin: 10px 0; overflow: hidden; }

.progress-fill { height: 100%; background: #3498db; width: 0%; transition: width 0.3s; }

/* 主内容区域 */
.main-content { flex: 1; display: flex; flex-direction: column; background: white; overflow:hidden; }

.main-header { padding: 5px 10px; background: white; border-bottom: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center; }

.main-header h1 { font-size: 20px; color: #2c3e50; }

.session-tabs { background: #ecf0f1; padding: 0; border-bottom: 1px solid #bdc3c7; display: flex; overflow-x: auto; }

.session-tab { padding: 10px 15px; background: #bdc3c7; border: none; cursor: pointer; font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; margin-right: 2px; }

.session-tab.active { background: white; color: #2c3e50; }

.session-tab:not(.active) { color: #7f8c8d; }

.session-tab .close-btn { margin-left: 8px; cursor: pointer; color: #e74c3c; font-weight: bold; }

.session-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.terminal-container { flex: 1; display: flex; flex-direction: column; background: #1e1e1e; color: #f0f0f0; font-family: 'Consolas', 'Monaco', monospace; overflow: hidden; }

.terminal-output { flex: 1; padding: 10px; overflow-y: auto; font-size: 13px; line-height: 1.4; }

.terminal-input { display: flex; padding: 10px; background: #2d2d2d; border-top: 1px solid #404040; }

.terminal-input input { flex: 1; background: transparent; border: none; color: #f0f0f0; font-family: inherit; font-size: 13px; outline: none; padding: 5px; }

.terminal-input .send-btn { padding: 5px 10px; background: #3498db; color: white; border: none; border-radius: 3px; cursor: pointer; margin-left: 10px; }

/* 项目会话底部操作条（打开UI） */
.session-footer { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 6px 10px; background: #2d2d2d; border-top: 1px solid #404040; }
.session-footer .ui-status { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #95a5a6; font-size: 12px; font-family: 'Consolas', 'Monaco', monospace; }
.session-footer .session-openui-btn { flex-shrink: 0; margin: 0; padding: 4px 12px; font-size: 12px; }


.output-line { margin: 2px 0; word-wrap: break-word; }

.output-normal { color: #f0f0f0; }

.output-error { color: #e74c3c; }

.output-input { color: #3498db; font-weight: bold; }

.output-info { color: #f39c12; }

/* 模态框 */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }

.modal-content { background-color: white; margin: 10% auto; padding: 20px; border-radius: 5px; width: 500px; max-width: 90%; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid #ddd; }

.modal-header h3 { margin: 0; color: #2c3e50; }

.close { font-size: 24px; font-weight: bold; cursor: pointer; color: #aaa; }

.close:hover { color: #000; }

.form-group { margin-bottom: 15px; }

.form-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #2c3e50; }

.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }

.form-group textarea { height: 80px; resize: vertical; }

/* 滚动条样式 */
::-webkit-scrollbar { width: 6px; }

::-webkit-scrollbar-track { background: #f1f1f1; }

::-webkit-scrollbar-thumb { background: #888; border-radius: 3px; }

::-webkit-scrollbar-thumb:hover { background: #555; }

.terminal-output::-webkit-scrollbar-track { background: #2d2d2d; }

.terminal-output::-webkit-scrollbar-thumb { background: #555; }

/* 动画效果 */
.fade-in { animation: fadeIn 0.3s ease-in; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in { animation: slideIn 0.3s ease-out; }

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 工具提示 */
.tooltip { position: relative; display: inline-block; }

.tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -60px; font-size: 11px; opacity: 0; transition: opacity 0.3s; }

.tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }
