/* chat.css - AI聊天助手样式文件 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #d9dee3;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* 左侧项目列表 */
.sidebar {
    width: 350px;
    background: linear-gradient(180deg, #2f3f50 0%, #293847 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 16px rgba(0,0,0,0.16);
}

.sidebar-header {
    padding: 20px;
    background: #34495e;
    border-bottom: 1px solid #445566;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #ecf0f1;
}

.create-project {
    display: flex;
    gap: 8px;
}

.create-project input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: #34495e;
    color: white;
    font-size: 14px;
}

.create-project input::placeholder {
    color: #95a5a6;
}

.create-project input:focus {
    outline: none;
    background: #3d566e;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 12px 22px;
    font-size: 14px;
    min-width: 72px;
    border-radius: 14px;
}

.btn-danger:hover {
    background: #c0392b;
}

.project-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.project-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #34495e;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-item:hover {
    background: #3d566e;
}

.project-item.active {
    background: #3498db;
}

.project-item .project-name {
    font-size: 14px;
    font-weight: 500;
}

.project-item .project-status {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 4px;
}

.project-item.active .project-status {
    color: #ecf0f1;
}

.status-running {
    color: #2ecc71 !important;
}

/* 项目操作菜单 */
.btn-action-menu {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    color: #95a5a6;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-menu:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

.project-item.active .btn-action-menu {
    color: #ecf0f1;
}

.project-item.active .btn-action-menu:hover {
    background: rgba(255, 255, 255, 0.15);
}

.action-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.menu-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item-danger {
    color: #e74c3c;
}

.menu-item-danger:hover {
    background: #fee;
}

.menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* 右侧聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ededed;
}

.chat-header {
    padding: 14px 20px 12px;
    background: rgba(255,255,255,0.78);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

.chat-header h3 {
    color: #2c3e50;
    font-size: 17px;
    font-weight: 600;
}

.chat-header .status {
    font-size: 12px;
    color: #7d8b99;
    margin-top: 4px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 22px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.36), transparent 45%),
        linear-gradient(180deg, #ebebeb 0%, #e9edf1 100%);
}

.message {
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user,
.message-assistant {
    display: flex;
}

.message-user {
    justify-content: flex-end;
}

.message-assistant {
    justify-content: flex-start;
}

.message-shell {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 82%;
}

.message-bubble {
    position: relative;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.message-user .message-bubble {
    background: #95ec69;
    color: #1f2d3a;
    border-top-right-radius: 6px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.message-user .message-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    bottom: 10px;
    width: 12px;
    height: 12px;
    background: #95ec69;
    transform: rotate(45deg);
    border-radius: 2px;
}

.message-assistant .message-bubble {
    background: rgba(255,255,255,0.96);
    color: #1f2d3a !important;
    border: 1px solid rgba(0,0,0,0.05);
    border-top-left-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.message-assistant .message-bubble::after {
    content: '';
    position: absolute;
    left: -6px;
    bottom: 10px;
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.96);
    border-left: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transform: rotate(45deg);
    border-radius: 2px;
}

.message-content {
    line-height: 1.6;
    font-size: 15px;
    white-space: normal;
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.message-avatar-user {
    background: linear-gradient(180deg, #6ad35f 0%, #35b96f 100%);
    color: white;
}

.message-avatar-assistant {
    background: linear-gradient(180deg, #ffffff 0%, #eef3f7 100%);
    color: #4f6b7d;
    border: 1px solid rgba(0,0,0,0.06);
}

.message-system {
    display: flex;
    justify-content: center;
}

.message-system-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
}

.message-system .message-content {
    background: rgba(0,0,0,0.18);
    color: #fff;
    padding: 4px 12px;
    border-radius: 999px;
    max-width: 80%;
    word-wrap: break-word;
    text-align: center;
    font-style: normal;
    font-size: 12px;
}

.message-time-divider {
    display: flex;
    justify-content: center;
    margin: 8px 0 12px;
}

.message-time-divider span {
    background: rgba(0,0,0,0.2);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.5px;
}

.message-content pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.message-content code {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 2px 2px;
    background: transparent;
    box-shadow: none;
}

.typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #7f8c8d;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.input-area {
    padding: 14px 16px 18px;
    background: rgba(255,255,255,0.9);
    border-top: 1px solid rgba(0,0,0,0.06);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #d7dde5;
    border-radius: 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 60px;
    max-height: 150px;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: #34c759;
    box-shadow: 0 0 0 3px rgba(148, 236, 105, 0.18);
}

.btn-send {
    padding: 12px 22px;
    background: linear-gradient(180deg, #38c172 0%, #2da85d 100%);
    color: white;
    align-self: flex-end;
    border-radius: 14px;
    min-width: 72px;
}

.btn-send:hover {
    background: linear-gradient(180deg, #3ccc78 0%, #2c9f58 100%);
}

.btn-send:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #7f8c8d;
    text-align: center;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #5f6f7d;
}

.empty-state p {
    font-size: 14px;
}

/* 滚动条样式 - 更明显的滚动条 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.04);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.28);
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.55);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.42);
}

.hidden {
    display: none !important;
}

/* Skill 管理模态对话框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 90vw;  /* 改为视口宽度 */
    min-width: 600px;  /* 最小宽度 */
    min-height: 400px;  /* 最小高度 */
    width: 90%;
    max-height: 90vh;  /* 改为视口高度 */
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    position: relative;  /* 为拖拽手柄定位 */
}

/* 拖拽调整大小的手柄 */
.modal-dialog::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #bdc3c7 50%);
    border-radius: 0 0 12px 0;
}

/* 右边框拖拽区域 */
.modal-resize-right {
    position: absolute;
    right: -5px;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
    z-index: 10;
}

/* 底边框拖拽区域 */
.modal-resize-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5px;
    height: 10px;
    cursor: ns-resize;
    z-index: 10;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #2c3e50;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    max-height: 50vh;
}

/* 自定义滚动条样式 */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.skill-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.skill-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
}

.skill-item:hover {
    background: #e9ecef;
}

.skill-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    flex-shrink: 0;
    pointer-events: auto;
}

.skill-info {
    flex: 1;
    min-width: 0;
}

.skill-name {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
    word-break: break-word;
}

.skill-size {
    font-size: 12px;
    color: #7f8c8d;
}

.skill-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.skill-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.btn-modal {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-modal-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-modal-secondary:hover {
    background: #d5dbdb;
}

.btn-modal-danger {
    background: #e74c3c;
    color: white;
}

.btn-modal-danger:hover {
    background: #c0392b;
}

.btn-modal-danger:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-select-all {
    font-size: 13px;
    color: #3498db;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-select-all:hover {
    background: #ebf5fb;
}

.selected-count {
    font-size: 13px;
    color: #7f8c8d;
}

/* Settings 模态对话框样式 */
.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 24px;
    background: #f8f9fa;
}

.settings-tab {
    padding: 12px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #7f8c8d;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.settings-tab:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.settings-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: white;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    display: block;
}

.setting-description {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 4px;
    font-weight: normal;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-item,
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-item:hover,
.checkbox-item:hover {
    background: #e9ecef;
}

.radio-item input[type="radio"],
.checkbox-item input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
}

.radio-content,
.checkbox-content {
    flex: 1;
}

.radio-title,
.checkbox-title {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.radio-desc,
.checkbox-desc {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 2px;
}

.template-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.template-card {
    padding: 14px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.template-card.selected {
    background: #ebf5fb;
    border-color: #3498db;
}

.template-name {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.template-desc {
    font-size: 12px;
    color: #7f8c8d;
}

.permission-rules {
    margin-top: 16px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.permission-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 50px;
    text-align: center;
}

.permission-badge.allow {
    background: #d4edda;
    color: #155724;
}

.permission-badge.deny {
    background: #f8d7da;
    color: #721c24;
}

.permission-command {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #2c3e50;
}

.permission-delete {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.permission-delete:hover {
    background: #fee;
}

.json-preview {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.json-preview pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #2c3e50;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.setting-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d7dde5;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.setting-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.setting-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d7dde5;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.setting-slider {
    width: 100%;
    margin: 8px 0;
}

.env-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.env-row input {
    flex: 1;
}

.env-delete {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.env-delete:hover {
    background: #c0392b;
}

.btn-add-env {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    transition: all 0.2s;
}

.btn-add-env:hover {
    background: #2980b9;
}

/* 权限提示框样式 */
.permission-prompt {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.permission-prompt.active {
    display: block;
}

.permission-prompt-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 15px;
    font-weight: 600;
}

.permission-prompt-message {
    padding: 16px 18px;
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.permission-prompt-buttons {
    padding: 14px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.permission-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 140px;
}

.permission-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-allow-all {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.btn-allow-all:hover {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.btn-allow-once {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-allow-once:hover {
    background: linear-gradient(135deg, #2980b9 0%, #2471a3 100%);
}

.btn-deny {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-deny:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.btn-cancel {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

.btn-cancel:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7a89 100%);
}

.permission-btn .shortcut {
    font-size: 11px;
    opacity: 0.8;
    background: rgba(255,255,255,0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.permission-prompt-actions {
    padding: 10px 18px 14px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
}

.btn-settings {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 13px;
}

.btn-settings:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4192 100%);
}

/* 模型列表样式 */
.model-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.model-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.model-item.selected {
    background: #ebf5fb;
    border-color: #3498db;
}

.model-item input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.model-info {
    flex: 1;
}

.model-name {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.model-desc {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 2px;
}

.model-delete {
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
}

.model-delete:hover {
    background: #e74c3c;
    color: white;
}

/* 添加模型表单样式 */
.add-model-form {
    margin-top: 8px;
}

.btn-add-model {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.btn-add-model:hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-add-model:active {
    transform: translateY(0);
}

/* 快捷 URL 按钮样式 */
.btn-quick-url {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-quick-url:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.btn-quick-url:active {
    transform: translateY(0);
}

/* ========== Hook 配置样式 ========== */

.hook-events {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hook-event-group {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.hook-event-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
}

.hook-event-header:hover {
    background: #e9ecef;
}

.hook-icon {
    font-size: 20px;
}

.hook-event-name {
    font-weight: 600;
    font-size: 14px;
}

.hook-event-desc {
    flex: 1;
    font-size: 12px;
    color: #7f8c8d;
}

.hook-count {
    font-size: 12px;
    color: #3498db;
    background: #ebf5fb;
    padding: 2px 8px;
    border-radius: 12px;
}

.hook-toggle-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.hook-event-content {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
}

.hook-group {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
}

.hook-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hook-handlers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hook-handler {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
}

.hook-handler.disabled {
    opacity: 0.5;
}

.hook-handler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.hook-handler-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hook-field label {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.hook-field .checkbox-desc {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 2px;
}

.btn-add-hook,
.btn-add-hook-group,
.btn-add-handler {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    transition: all 0.2s;
}

.btn-add-hook:hover,
.btn-add-hook-group:hover,
.btn-add-handler:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-add-hook:active,
.btn-add-hook-group:active,
.btn-add-handler:active {
    transform: translateY(0);
}

.hook-delete-group,
.hook-delete-handler {
    padding: 4px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.hook-delete-group:hover,
.hook-delete-handler:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.hook-delete-group:active,
.hook-delete-handler:active {
    transform: translateY(0);
}

/* 命令输入模式切换标签 */
.command-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.command-mode-tab {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.command-mode-tab:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.command-mode-tab.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.command-manage-btn {
    padding: 6px 12px;
    background: #27ae60;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: auto;
    transition: all 0.2s;
}

.command-manage-btn:hover {
    background: #229954;
    transform: translateY(-1px);
}

.command-manage-btn:active {
    transform: translateY(0);
}

.command-input-area {
    margin-top: 8px;
}

.command-help {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 4px;
    font-style: italic;
}

/* 文件上传输入 */
.setting-file {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

.setting-file::-webkit-file-upload-button {
    padding: 6px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
}

.setting-file::-webkit-file-upload-button:hover {
    background: #2980b9;
}

/* 脚本管理器样式 */
.script-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.upload-script-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.btn-upload-script {
    padding: 6px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-upload-script:hover {
    background: #2980b9;
}

.btn-create-script {
    padding: 6px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-create-script:hover {
    background: #229954;
}

.script-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.empty-script-list {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-size: 14px;
}

.script-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
}

.script-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.script-info {
    flex: 1;
}

.script-name {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.script-actions {
    display: flex;
    gap: 8px;
}

.btn-script-edit {
    padding: 4px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-script-edit:hover {
    background: #2980b9;
}

.btn-script-download {
    padding: 4px 12px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-script-download:hover {
    background: #229954;
}

.btn-script-delete {
    padding: 4px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-script-delete:hover {
    background: #c0392b;
}

/* ========== Hook 脚本侧边栏管理 ========== */

/* 脚本管理标签页容器 */
.scripts-tab-container {
    padding: 0;
}

/* 左右布局容器(保留用于兼容) */
.hooks-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    min-height: 500px;
}

.hooks-config-panel {
    overflow-y: auto;
    max-height: 70vh;
    padding-right: 10px;
}

/* 脚本侧边栏 */
.script-sidebar {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

/* Skill 管理侧边栏 */
.skills-tab-container {
    width: 100%;
}

.skill-sidebar {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 75vh;  /* 增加高度 */
}

/* Skill 管理标签页中全宽显示 */
.skill-sidebar-full {
    max-width: 100%;
    max-height: 70vh;  /* 增加高度 */
}

.skill-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px 8px 0 0;
}

.skill-sidebar-header h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #2c3e50;
}

.skill-sidebar-actions {
    display: flex;
    gap: 8px;
}

.btn-skill-sidebar {
    padding: 6px 12px;
    background: white;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    flex: 1;
}

.btn-skill-sidebar:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-skill-sidebar-primary {
    background: #9b59b6;
    border-color: #9b59b6;
    color: white;
}

.btn-skill-sidebar-primary:hover {
    background: #8e44ad;
}

/* Skill 列表 */
.skill-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    position: relative;
}

/* 拖拽上传提示层 */
.skill-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(155, 89, 182, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
    pointer-events: none;
}

.skill-sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

/* Skill 项 */
.skill-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.skill-item-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.skill-item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007bff;
    margin: 0;
}

.skill-item-checkbox input[type="checkbox"]:hover {
    transform: scale(1.1);
}

.skill-sidebar-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateX(2px);
}

.skill-item-icon {
    font-size: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 6px;
}

.skill-item-info {
    flex: 1;
    min-width: 0;
}

.skill-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-item-meta {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 2px;
}

.skill-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.skill-sidebar-item:hover .skill-item-actions {
    opacity: 1;
}

/* Skill 内容区域（文件树 + 编辑器） */
.skill-content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    border-top: 1px solid #e0e0e0;
    min-height: 500px;  /* 设置最小高度 */
}

/* 文件树面板 */
.skill-file-tree-panel {
    flex: 0 0 350px;  /* 固定宽度 350px */
    overflow-y: auto;
    padding: 12px;
    background: #fafafa;
    min-width: 300px;
    max-width: 400px;
    border-right: 1px solid #e0e0e0;
}

.skill-file-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.skill-file-tree-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.btn-skill-tree-action {
    padding: 4px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #95a5a6;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-skill-tree-action:hover {
    background: #fee;
    color: #e74c3c;
}

/* 文件树 */
.skill-file-tree {
    font-size: 13px;
}

.skill-tree-node {
    margin: 2px 0;
}

.skill-tree-node-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-width: 0;  /* 允许缩小 */
}

.skill-tree-node-content:hover {
    background: #e9ecef;
}

.skill-tree-file {
    cursor: pointer;
}

.skill-tree-toggle {
    width: 16px;
    font-size: 10px;
    color: #95a5a6;
    transition: transform 0.2s;
}

.skill-tree-icon {
    font-size: 16px;
}

.skill-tree-name {
    flex: 1;
    min-width: 0;  /* 允许在 flex 容器中缩小 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #2c3e50;
    word-break: break-all;  /* 允许长文件名换行 */
}

.skill-tree-size {
    font-size: 11px;
    color: #95a5a6;
    margin-left: 8px;
}

.skill-tree-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.skill-tree-node-content:hover .skill-tree-actions {
    opacity: 1;
}

.btn-tree-icon {
    padding: 2px 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    border-radius: 3px;
    transition: all 0.2s;
}

.btn-tree-icon:hover {
    background: #dee2e6;
}

.btn-tree-icon-danger:hover {
    background: #fee;
}

.skill-tree-children {
    margin-left: 0;
}

/* 编辑器面板 */
.skill-editor-panel {
    flex: 3;  /* 增加编辑器的比例，从 2 改为 3 */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.skill-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
}

.skill-code-editor {
    flex: 1;
    width: 100%;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;  /* 稍微增大字体 */
    line-height: 1.6;
    border: none;
    outline: none;
    resize: none;
    background: #fafafa;
    color: #2c3e50;
}

.skill-code-editor:focus {
    background: white;
}

/* 脚本管理标签页中全宽显示 */
.script-sidebar-full {
    max-width: 100%;
    max-height: 65vh;
}

.script-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px 8px 0 0;
}

.script-sidebar-header h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #2c3e50;
}

.script-sidebar-actions {
    display: flex;
    gap: 8px;
}

.btn-script-sidebar {
    padding: 6px 12px;
    background: white;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    flex: 1;
}

.btn-script-sidebar:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-script-sidebar-primary {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-script-sidebar-primary:hover {
    background: #2980b9;
}

/* 脚本列表 */
.script-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    position: relative;
}

/* 拖拽上传提示层 */
.script-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(52, 152, 219, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
    pointer-events: none;
}

.drop-overlay-content {
    text-align: center;
    color: white;
}

.drop-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 1s infinite;
}

.drop-text {
    font-size: 18px;
    font-weight: 600;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.script-sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-hint {
    font-size: 12px;
    margin-top: 8px;
    color: #bdc3c7;
}

/* 脚本项 */
.script-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.script-sidebar-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateX(2px);
}

.script-item-icon {
    font-size: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 6px;
}

.script-item-info {
    flex: 1;
    min-width: 0;
}

.script-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.script-item-meta {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 2px;
}

.script-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.script-sidebar-item:hover .script-item-actions {
    opacity: 1;
}

.btn-icon {
    padding: 4px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #dee2e6;
}

.btn-icon-danger:hover {
    background: #fee;
}

/* 内联编辑器 */
.script-inline-editor {
    border-top: 1px solid #e0e0e0;
    background: white;
    border-radius: 0 0 8px 8px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.editor-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.btn-editor {
    padding: 6px 12px;
    background: white;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-editor:hover {
    background: #e9ecef;
}

.btn-editor-close:hover {
    background: #fee;
    color: #e74c3c;
}

.script-code-editor {
    width: 100%;
    min-height: 250px;
    max-height: 400px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    border: none;
    resize: vertical;
    background: #fafafa;
    color: #2c3e50;
    tab-size: 4;
}

.script-code-editor:focus {
    outline: none;
    background: white;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
    color: #95a5a6;
}

.editor-info-hint {
    font-style: italic;
}

/* 模板选择对话框 */
.template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.template-card-large {
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card-large:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.template-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.template-icon {
    font-size: 28px;
}

.template-card-title {
    flex: 1;
}

.template-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.template-card-file {
    font-size: 11px;
    color: #95a5a6;
    font-family: monospace;
}

.template-card-desc {
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.4;
}

.template-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}

.template-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
}

.template-divider span {
    position: relative;
    background: white;
    padding: 0 16px;
    color: #95a5a6;
    font-size: 13px;
}

.btn-blank-script {
    width: 100%;
    padding: 12px;
    background: white;
    border: 2px dashed #dee2e6;
    color: #95a5a6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-blank-script:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f0f8ff;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .hooks-layout {
        grid-template-columns: 1fr;
    }
    
    .script-sidebar {
        max-height: 400px;
    }
}

/* 项目指令标签页样式 */
.instructions-help {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.instructions-help p {
    font-size: 13px;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.6;
}

.instructions-help p:last-child {
    margin-bottom: 0;
}

.instructions-help ul {
    margin: 8px 0;
    padding-left: 20px;
}

.instructions-help li {
    font-size: 13px;
    color: #34495e;
    margin-bottom: 4px;
    line-height: 1.5;
}

.instructions-textarea {
    width: 100%;
    min-height: 400px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    background: #fafafa;
    color: #2c3e50;
    transition: border-color 0.2s;
}

.instructions-textarea:focus {
    outline: none;
    border-color: #3498db;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.instructions-textarea::placeholder {
    color: #95a5a6;
    font-style: italic;
}

.instructions-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #ecf0f1;
}

.instructions-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
}

.instructions-actions .btn-secondary {
    background: #95a5a6;
    color: white;
}

.instructions-actions .btn-secondary:hover {
    background: #7f8c8d;
}

.instructions-actions .btn-primary {
    background: #3498db;
    color: white;
}

.instructions-actions .btn-primary:hover {
    background: #2980b9;
}

/* ========== Agent Marketplace ========== */
.main-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.main-view.hidden {
    display: none !important;
}

#viewChats .chat-area {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.sidebar-nav {
    display: flex;
    gap: 8px;
    padding: 12px 12px 8px;
    background: #2c3e50;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #bdc3c7;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ecf0f1;
}

.sidebar-nav-btn.active {
    background: #3498db;
    color: #fff;
}

.sidebar-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-panel.hidden {
    display: none !important;
}

.sidebar-market {
    padding: 12px 10px;
    overflow-y: auto;
}

.market-sidebar-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #95a5a6;
    margin-bottom: 8px;
    padding-left: 4px;
}

.market-cat-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #ecf0f1;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.market-cat-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.market-cat-item.active {
    background: #34495e;
    color: #fff;
}

.market-category-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.marketplace-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #e9edf1;
    padding: 20px 24px;
    overflow: hidden;
}

.marketplace-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.marketplace-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.marketplace-subtitle {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

.market-search {
    min-width: 240px;
    flex: 1;
    max-width: 480px;
    padding: 10px 14px;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
}

.market-search:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.marketplace-status {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    background: #f8fafc;
    color: #5b6b79;
    border: 1px solid #dbe4ea;
}

.marketplace-status.is-error {
    background: #fff3f1;
    color: #b24537;
    border-color: #f2c6bf;
}

.marketplace-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    align-content: start;
    padding-bottom: 16px;
}

.marketplace-empty {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
    font-size: 14px;
}

.market-card {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.market-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(145deg, #eef2f6, #dfe6ec);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.market-card-body {
    flex: 1;
    min-width: 0;
}

.market-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.market-card-desc {
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.market-card-meta {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 6px;
}

.market-card-action {
    flex-shrink: 0;
    align-self: center;
}

.btn-market {
    padding: 8px 18px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
}

.btn-market-get {
    background: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #cfd8dc;
}

.btn-market-get:hover {
    background: #dfe6e9;
}

.btn-market-try {
    background: #3498db;
    color: #fff;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.35);
}

.btn-market-try:hover {
    background: #2980b9;
}

.btn-market-loading,
.btn-market:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.market-card-highlight {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.25);
}

.market-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.market-card-title-row .market-card-title {
    margin-bottom: 0;
}

.market-source-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.market-source-builtin {
    background: #ecf0f1;
    color: #5d6d7e;
}

.market-source-local {
    background: #e8f6f3;
    color: #1e8449;
}

.market-card-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.btn-market-delete {
    background: #fff;
    color: #c0392b;
    border: 1px solid #e6b0ab;
    box-shadow: none;
}

.btn-market-delete:hover:not(:disabled) {
    background: #fdedec;
}

/* 发布模板对话框 */
.publish-template-hint {

/* ========== 模板详情面板 ========== */
.template-detail-dialog .modal-body {
    padding: 16px 24px;
}

.tpl-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.tpl-detail-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(145deg, #eef2f6, #dfe6ec);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.tpl-detail-info {
    flex: 1;
    min-width: 0;
}

.tpl-detail-name {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.tpl-detail-desc {
    font-size: 13px;
    color: #5d6d7e;
    line-height: 1.5;
}

.tpl-detail-section {
    margin-bottom: 16px;
}

.tpl-detail-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.tpl-detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tpl-detail-meta-item {
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.tpl-detail-meta-label {
    font-size: 11px;
    color: #95a5a6;
    margin-bottom: 2px;
}

.tpl-detail-meta-value {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.tpl-detail-permission-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.tpl-detail-perm-bypass {
    background: #d5f5e3;
    color: #1e8449;
}

.tpl-detail-perm-accept-edits {
    background: #d6eaf8;
    color: #2471a3;
}

.tpl-detail-perm-default {
    background: #fdebd0;
    color: #b9770e;
}

.tpl-detail-instructions {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #2c3e50;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.tpl-detail-skills-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tpl-detail-skill-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #2c3e50;
}

.tpl-detail-skill-icon {
    color: #3498db;
}

.tpl-detail-empty {
    color: #95a5a6;
    font-size: 13px;
    font-style: italic;
}
    font-size: 13px;
    color: #5d6d7e;
    line-height: 1.5;
    margin: 0 0 12px;
}

.publish-template-meta {
    font-size: 12px;
    color: #7f8c8d;
    margin: 0 0 16px;
}

.publish-template-meta span {
    font-weight: 600;
    color: #2c3e50;
}

.publish-form-row {
    margin-bottom: 14px;
}

.publish-form-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5d6d7e;
    margin-bottom: 6px;
}

.publish-form-row .req {
    color: #c0392b;
}

.publish-form-inline {
    display: flex;
    gap: 12px;
}

.publish-form-col {
    flex: 1;
    min-width: 0;
}

.setting-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 72px;
}

.setting-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.publish-template-error {
    margin: 8px 0 0;
    font-size: 13px;
    color: #c0392b;
}

/* 发布内容预览 */
.publish-template-preview {
    margin-bottom: 14px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
}

.publish-template-preview-title {
    font-size: 12px;
    font-weight: 700;
    color: #5d6d7e;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.publish-template-preview-content {
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.5;
}

.publish-template-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.publish-template-preview-icon {
    color: #3498db;
}
