/* --- 节点系统样式 (css/modules/node_system.css) --- */

/* 节点大厅 Screen 适配 */
#node-system-screen {
    background-color: var(--bg-color, #f5f7f9);
}

/* 节点大厅 Tabs */
.node-tabs-container {
    padding: 10px 15px;
    background: var(--bg-color, #f5f7f9);
    position: sticky;
    top: calc(56px + env(safe-area-inset-top));
    z-index: 10;
}

.node-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 4px;
    gap: 4px;
}

.node-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.node-tab.active {
    background: var(--panel-bg, #fff);
    color: var(--primary-color, #6C8CD5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 节点大厅主内容区 */
.node-main-content {
    padding: 0 15px 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.node-tab-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: node-fade-in-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes node-fade-in-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 节点列表卡片 */
.node-card {
    background: var(--panel-bg, #fff);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.02);
}

.node-card:active {
    transform: scale(0.98);
}

.node-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.node-card-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.node-card-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary-color-light, #eef2ff);
    color: var(--primary-color, #6C8CD5);
    border-radius: 10px;
}

.node-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color, #333);
    margin: 0;
    line-height: 1.3;
}

.node-card-type {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(0,0,0,0.04);
    color: #666;
    font-weight: 500;
}

.node-card-type.offline {
    background: rgba(46, 125, 50, 0.1);
    color: #2e7d32;
}

.node-card-type.spinoff {
    background: rgba(230, 81, 0, 0.1);
    color: #e65100;
}

.node-card-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
    align-items: center;
}

.node-card-summary {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    background: rgba(0,0,0,0.02);
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color, #6C8CD5);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.node-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px dashed rgba(0,0,0,0.06);
}

/* 自定义模板卡片特殊样式 */
.node-card.template-card {
    background: linear-gradient(145deg, var(--panel-bg, #fff) 0%, #fafbfc 100%);
    border: 1px solid rgba(108, 140, 213, 0.1);
}

.node-card.template-card .node-card-icon {
    background: rgba(108, 140, 213, 0.08);
}

.node-tpl-tags {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.node-tpl-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,0.04);
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.node-tpl-tag.active {
    background: rgba(108, 140, 213, 0.1);
    color: var(--primary-color, #6C8CD5);
}

/* 多选模式样式 */
.node-card-checkbox {
    display: none;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: #fff;
    z-index: 2;
    pointer-events: none;
}

.node-card-checkbox::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 12px;
    height: 12px;
    background: var(--primary-color, #6C8CD5);
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.node-system-multi-select .node-card {
    padding-left: 48px;
    cursor: pointer;
}

.node-system-multi-select .node-card-checkbox {
    display: block;
}

.node-system-multi-select .node-card.selected .node-card-checkbox {
    border-color: var(--primary-color, #6C8CD5);
}

.node-system-multi-select .node-card.selected .node-card-checkbox::after {
    transform: translate(-50%, -50%) scale(1);
}

.node-system-multi-select .node-card-actions {
    display: none;
}

/* 多选操作栏 */
.node-multi-select-bar {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top));
    left: 0;
    right: 0;
    background: var(--panel-bg, #fff);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 11;
    border-bottom: 1px solid #eee;
    animation: slide-down 0.3s ease;
}

.node-multi-select-actions {
    display: flex;
    gap: 8px;
}

/* 空状态 */
.node-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
    text-align: center;
}

.node-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.node-empty-text {
    font-size: 15px;
    margin-bottom: 8px;
    color: #666;
}

.node-empty-hint {
    font-size: 13px;
    color: #aaa;
    line-height: 1.5;
}

/* 聊天界面中的节点分割线 */
.node-divider-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    position: relative;
    width: 100%;
}

.node-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
}

.node-divider-content {
    padding: 2px 8px;
    background: transparent;
    font-size: 11px;
    color: #aaa;
    margin: 0 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.node-divider-content.active {
    color: #888;
}

.node-divider-icon {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.node-divider-icon.pulse {
    animation: node-pulse 3s infinite;
}

@keyframes node-pulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.8; }
    100% { opacity: 0.4; }
}

/* 独立摘要组件 (不依附于气泡) */
.node-summary-container {
    margin-top: 4px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 85%;
    /* 靠右对齐如果是发送者，靠左如果是接收者。这里默认靠左，在 JS 中根据 role 调整 */
}

.message-wrapper.sent .node-summary-container {
    align-items: flex-end;
    align-self: flex-end;
}

.message-wrapper.received .node-summary-container {
    align-items: flex-start;
    align-self: flex-start;
    margin-left: 46px; /* 避开头像宽度 */
}

.message-wrapper.no-avatar-layout .node-summary-container {
    margin-left: 0;
}

.node-summary-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    background: transparent;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.node-summary-toggle:hover {
    color: #666;
}

.node-summary-star {
    display: inline-block;
    color: inherit;
    font-size: 13px;
}

.node-summary-star.spin {
    animation: star-spin 6s linear infinite;
}

@keyframes star-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.node-summary-content {
    margin-top: 6px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    animation: summary-fade-in 0.3s ease;
    word-break: break-word;
}

@keyframes summary-fade-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 结束节点悬浮按钮 */
.end-node-float-btn {
    position: absolute;
    top: calc(60px + env(safe-area-inset-top));
    right: 15px;
    background: var(--primary-color, #6C8CD5);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(108, 140, 213, 0.4);
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: float-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes float-in {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- 多选下拉框样式 (文风世界书选择) --- */
.theater-multiselect-container,
#node-config-style-wb-container,
#node-tpl-style-wb-container {
    position: relative;
    width: 100%;
}

.theater-multiselect-display,
#node-config-style-wb-display,
#node-tpl-style-wb-display {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    min-height: 40px;
}

.theater-multiselect-display::after,
#node-config-style-wb-display::after,
#node-tpl-style-wb-display::after {
    content: '▼';
    font-size: 10px;
    color: #999;
    margin-left: 8px;
}

.theater-multiselect-placeholder {
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.theater-multiselect-dropdown,
#node-config-style-wb-dropdown,
#node-tpl-style-wb-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.theater-multiselect-dropdown.show,
#node-config-style-wb-dropdown.show,
#node-tpl-style-wb-dropdown.show {
    display: block;
}

.theater-multiselect-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: #333;
}

.theater-multiselect-option:hover {
    background: #f5f7f9;
}

.theater-multiselect-option input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}
