* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* 顶部标题栏 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header {
    position: relative;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.header .user-info {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

/* 主体区域 */
.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 100px);
}

/* 侧边栏 */
.sidebar {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
}

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

.sidebar-header h2 {
    font-size: 18px;
    color: #333;
}

.header-buttons {
    display: flex;
    gap: 8px;
}

.user-filter {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.search-box {
    margin-bottom: 15px;
}

.robot-select-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.robot-select-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

.selected-count {
    margin-left: auto;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.robot-list {
    max-height: 600px;
    height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* 自定义滚动条样式 */
.robot-list::-webkit-scrollbar {
    width: 8px;
}

.robot-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.robot-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.robot-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.robot-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    flex-wrap: nowrap;
    min-width: 0; /* 允许flex子元素收缩 */
}

.robot-item:hover {
    background: #e9ecef;
}

.robot-item.selected {
    background: #e3f2fd;
    border: 1px solid #2196f3;
}

.robot-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0; /* 防止checkbox被压缩 */
}

.robot-name {
    flex: 1;
    font-size: 14px;
    min-width: 0; /* 允许文本截断 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.robot-owner {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #ff9800;
    color: white;
    margin-left: 5px;
    opacity: 0.8;
    flex-shrink: 0; /* 防止被压缩 */
    white-space: nowrap;
}

.robot-type {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #667eea;
    color: white;
    flex-shrink: 0; /* 防止被压缩 */
    white-space: nowrap;
}

.robot-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    font-size: 14px;
}

.btn-icon:hover {
    color: #333;
}

/* 内容区 */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message-section,
.log-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message-section h2,
.log-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.message-editor {
    position: relative;
}

#messageText {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

#messageText:focus {
    outline: none;
    border-color: #667eea;
}

.file-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-item {
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-item .remove {
    cursor: pointer;
    color: #f44336;
}

.upload-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}


.form-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.log-container {
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.log-item {
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.log-item.success {
    color: #4caf50;
}

.log-item.error {
    color: #f44336;
}

.log-item.warning {
    color: #ff9800;
}

.log-item.info {
    color: #2196f3;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-section {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-section .btn {
    flex: 1;
    min-width: 150px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.modal-body .form-input {
    width: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: 10px;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .robot-list {
        max-height: 400px;
        height: 400px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    .action-section .btn {
        width: 100%;
    }
    
    
    .form-input {
        width: 100%;
    }
    
    .robot-select-actions {
        flex-wrap: wrap;
    }
    
    .selected-count {
        margin-left: 0;
        width: 100%;
        margin-top: 5px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    /* 优化机器人列表项在中等屏幕的显示 */
    .robot-item {
        gap: 6px;
        padding: 10px;
    }
    
    .robot-name {
        font-size: 13px;
        max-width: calc(100% - 140px);
    }
    
    .robot-owner {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .robot-type {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .robot-actions {
        gap: 3px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .sidebar,
    .message-section,
    .log-section {
        padding: 15px;
    }
    
    .robot-item {
        flex-wrap: wrap;
        align-items: center;
        gap: 3px;
        padding: 6px;
    }
    
    .robot-checkbox {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        order: 1;
    }
    
    .robot-name {
        font-size: 12px;
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        order: 2;
    }
    
    .robot-owner {
        font-size: 8px;
        padding: 1px 2px;
        flex-shrink: 0;
        white-space: nowrap;
        order: 3;
    }
    
    .robot-type {
        font-size: 9px;
        padding: 1px 4px;
        flex-shrink: 0;
        white-space: nowrap;
        order: 4;
    }
    
    .robot-actions {
        flex-shrink: 0;
        gap: 2px;
        margin-left: auto;
        order: 5;
        /* 如果第一行放不下，让actions换到第二行 */
        flex-basis: 100%;
        justify-content: flex-end;
        margin-top: 2px;
    }
    
    .btn-icon {
        padding: 1px;
        font-size: 12px;
    }
    
    .robot-list {
        max-height: 300px;
        height: 300px;
    }
}
