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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 15px;
}

.status-bar {
    display: flex;
    gap: 30px;
    font-size: 14px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    font-weight: bold;
}

.status-indicator.connected {
    background: #4CAF50;
}

.status-indicator.disconnected {
    background: #f44336;
}

/* 标签导航 */
.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

/* 标签内容 */
.tab-content {
    padding: 30px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel h2 {
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.tab-panel h3 {
    color: #555;
    margin: 20px 0 15px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
    user-select: none;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.password-toggle:hover {
    opacity: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="month"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    font-family: 'Courier New', monospace;
    resize: vertical;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    margin-right: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

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

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

.btn-info {
    background: #2196F3;
    color: white;
}

.btn-secondary {
    background: #9e9e9e;
    color: white;
}

.button-group {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* 控制组 */
.control-group {
    margin-top: 25px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* 信息提示框 */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.info-box p {
    margin: 0;
    color: #1976d2;
    font-size: 14px;
    line-height: 1.6;
}

/* 监控面板 */
.control-panel {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 25px;
}

.subscribed-topics {
    margin-top: 20px;
}

#topicsList {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 13px;
}

.topic-tag button {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

/* 消息容器 */
.message-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
}

.message-header h3 {
    margin: 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-header h3::before {
    content: '💬';
    font-size: 18px;
}

.message-header .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.message-header .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.message-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

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

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

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

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

.message-item {
    padding: 0;
    margin-bottom: 12px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    transition: box-shadow 0.2s;
}

.message-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

/* 消息头部 */
.message-item .message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.message-item .topic {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.message-item .topic::before {
    content: '📡';
    font-size: 16px;
}

.message-item .message-number {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: white;
    font-weight: 600;
}

.message-item .time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.message-item .time::before {
    content: '🕐';
    font-size: 12px;
}

/* 消息内容区域 */
.message-item .message-body {
    padding: 16px;
}

.message-item .content-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.message-item .content {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: #2c3e50;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
}

.message-item .content::-webkit-scrollbar {
    width: 6px;
}

.message-item .content::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 3px;
}

.message-item .content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.message-item .content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 查询面板 */
.query-panel {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.query-results {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
}

.result-header h3 {
    margin: 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-header h3::before {
    content: '📋';
    font-size: 18px;
}

.result-header #resultCount {
    background: rgba(255, 255, 255, 0.25);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    color: white;
    font-weight: 600;
}

.result-list {
    max-height: 600px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

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

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

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

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

.result-item {
    padding: 0;
    margin-bottom: 12px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    transition: box-shadow 0.2s;
}

.result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* 结果项头部 */
.result-item .result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.result-item .id {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 0;
}

.result-item .topic {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: white;
    font-size: 14px;
    margin-bottom: 0;
}

.result-item .topic::before {
    content: '📡';
    font-size: 16px;
}

.result-item .time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-bottom: 0;
}

.result-item .time::before {
    content: '🕐';
    font-size: 12px;
}

/* 结果项内容区域 */
.result-item .result-body {
    padding: 16px;
}

.result-item .data-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.result-item .data {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    color: #2c3e50;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
}

.result-item .data::-webkit-scrollbar {
    width: 6px;
}

.result-item .data::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 3px;
}

.result-item .data::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.result-item .data::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-top: none;
}

.pagination #pageInfo {
    color: white;
    font-weight: 600;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 12px;
}

.pagination #totalPages {
    color: white;
    font-weight: 600;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 12px;
}

.pagination .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.pagination .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 存储配置 */
.config-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.topic-config-list {
    margin-top: 15px;
}

.topic-config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.topic-config-item .topic-name {
    font-weight: 500;
    color: #333;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #4CAF50;
}

.notification.error {
    background: #f44336;
}

.notification.info {
    background: #2196F3;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 50%;
    }
    
    .query-panel {
        grid-template-columns: 1fr;
    }
}
