/* 角色设置面板样式 */
.role-settings-panel {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    height: 100%;
    z-index: 1050;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* PC端媒体查询 */
@media (max-width: 768px) {
    .role-settings-panel {
        width: 90%;
    }
}

/* 角色设置按钮悬停样式 */
#roleSettingsBtn:hover {
    cursor: pointer;
}

.role-settings-panel.show {
    right: 0;
}

.role-settings-inner {
    height: 100%;
    background-color: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.role-settings-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa, #f1f3f5);
}

.role-settings-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
    background: linear-gradient(135deg, #ff7b00, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.role-settings-close {
    font-size: 20px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.role-settings-close:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

.role-settings-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.role-settings-footer {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: linear-gradient(135deg, #f8f9fa, #f1f3f5);
}

/* 角色列表样式 */
.role-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.role-list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.role-item {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.role-item:hover {
    border-color: #ff9500;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.role-item.selected {
    border-color: #ff7b00;
    background-color: rgba(255, 123, 0, 0.05);
}

.role-item.selected::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: #ff7b00;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.role-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
    border: 2px solid #eee;
}

.role-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    text-align: center;
}

.role-desc {
    font-size: 12px;
    color: #666;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 角色标签样式 */
.role-tag {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff7b00, #ff9500);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 遮罩层 */
.role-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.role-settings-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 适配黑暗模式 */
.io-black-mode .role-settings-inner {
    background-color: #2a2a2a;
    color: #e1e1e1;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.io-black-mode .role-settings-header {
    border-bottom-color: #444;
    background: linear-gradient(135deg, #222, #2a2a2a);
}

.io-black-mode .role-item {
    border-color: #444;
    background-color: #333;
}

.io-black-mode .role-item:hover {
    border-color: #ff9500;
    background-color: #3a3a3a;
}

.io-black-mode .role-item.selected {
    border-color: #ff7b00;
    background-color: rgba(255, 123, 0, 0.15);
}

.io-black-mode .role-desc {
    color: #aaa;
}

.io-black-mode .form-control {
    background-color: #333;
    border-color: #444;
    color: #e1e1e1;
}

.io-black-mode .form-control:focus {
    background-color: #3a3a3a;
    border-color: #ff9500;
}

.io-black-mode .form-text {
    color: #aaa;
}

/* 提示词文本区域样式优化 */
.role-prompt-textarea {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
}

.role-prompt-textarea:focus {
    box-shadow: 0 0 5px rgba(255, 123, 0, 0.3);
}

.textarea-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.expand-textarea {
    font-size: 12px;
    padding: 3px 8px;
}

/* 扩展编辑器模式 */
.expanded-textarea-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
}

.expanded-textarea-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.expanded-textarea-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.expanded-textarea-header h3 {
    margin: 0;
    font-size: 18px;
    background: linear-gradient(135deg, #ff7b00, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.expanded-textarea-close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
}

.expanded-textarea-close:hover {
    color: #333;
    transform: rotate(90deg);
}

.expanded-textarea-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.expanded-textarea-body textarea {
    flex: 1;
    font-family: 'Consolas', monospace;
    font-size: 16px;
    line-height: 1.6;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
}

.expanded-textarea-footer {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

/* 自定义角色模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1060;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 500px;
    max-width: 90%;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa, #f1f3f5);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    background: linear-gradient(135deg, #ff7b00, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
}

.close-modal:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: linear-gradient(135deg, #f8f9fa, #f1f3f5);
}

/* 黑暗模式适配 */
.io-black-mode .modal-content {
    background-color: #2a2a2a;
    color: #e1e1e1;
}

.io-black-mode .modal-header,
.io-black-mode .modal-footer {
    border-color: #444;
    background: linear-gradient(135deg, #222, #2a2a2a);
}

.io-black-mode .close-modal:hover {
    color: #e1e1e1;
}

.io-black-mode .form-control {
    background-color: #333;
    border-color: #444;
    color: #e1e1e1;
}

/* 黑暗模式适配 */
.io-black-mode .expanded-textarea-container {
    background-color: #2a2a2a;
    color: #e1e1e1;
}

.io-black-mode .expanded-textarea-body textarea {
    background-color: #333;
    border-color: #444;
    color: #e1e1e1;
}

.io-black-mode .expanded-textarea-close:hover {
    color: #e1e1e1;
}

.io-black-mode .btn-secondary {
    background-color: #444;
    border-color: #555;
    color: #e1e1e1;
}

.io-black-mode .btn-secondary:hover {
    background-color: #555;
}

.role-custom-tag {
    font-size: 10px;
    background-color: #ff7b00;
    color: white;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

/* 角色设置按钮样式 */
#roleSettingsBtn {
    display: flex;
    align-items: center;
    margin-right: 15px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.current-role-container {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-size: 13px;
}

.io-black-mode .role-settings-footer {
    border-top: 1px solid #514949;
    background: linear-gradient(135deg, #1c1c1c, #2b2b2b);
}
