* {
    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;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 20px;
    margin: 0 20px;
}

.nav-link {
    text-decoration: none;
    color: #2c3e50;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 600;
    background: rgba(52, 152, 219, 0.1);
}

.nav-link:hover {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    transform: translateY(-2px);
}

.nav-link.active {
    background: #3498db;
    color: white;
}

.navbar {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h2 {
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 700;
    margin: 0;
}

.navbar .nav-links {
    display: flex;
    gap: 20px;
}

.navbar .nav-links a {
    text-decoration: none;
    color: #2c3e50;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 600;
    background: rgba(52, 152, 219, 0.1);
}

.navbar .nav-links a:hover {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    transform: translateY(-2px);
}

.navbar .nav-links a.active {
    background: #3498db;
    color: white;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #95a5a6;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #27ae60;
}

.status-dot.offline {
    background: #e74c3c;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.card.full-width {
    grid-column: 1 / -1;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: #3498db;
    background: #e3f2fd;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9em;
}

.config-grid {
    display: grid;
    gap: 15px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.config-item label {
    font-weight: 600;
    color: #2c3e50;
}

.config-item span {
    font-family: 'Courier New', monospace;
    background: #ecf0f1;
    padding: 4px 8px;
    border-radius: 4px;
    color: #27ae60;
}

.log-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.message-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.message-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: white;
    margin-bottom: 2px;
}

.message-item:last-child {
    border-bottom: none;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.message-user {
    font-weight: bold;
    color: #2c3e50;
}

.message-time {
    color: #7f8c8d;
    font-size: 0.85em;
}

.message-content {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #2196f3;
}

.message-reply {
    background: #f1f8e9;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
}

.message-meta {
    display: flex;
    gap: 15px;
    font-size: 0.8em;
    color: #666;
    margin-top: 8px;
}

.message-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9em;
}

.no-messages {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
}

.no-messages-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.no-messages-tip {
    font-size: 0.85em;
    margin-top: 10px;
    color: #95a5a6;
}

/* N8N控件样式 */
.n8n-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

#n8nStatus {
    font-size: 0.9em;
    font-weight: 500;
    color: #495057;
    min-width: 120px;
}

#testN8NBtn {
    font-size: 0.85em;
    padding: 6px 12px;
}

.n8n-status-enabled {
    color: #28a745 !important;
}

.n8n-status-disabled {
    color: #6c757d !important;
}

.n8n-status-error {
    color: #dc3545 !important;
}





.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

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

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

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

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

.btn-secondary:hover {
    background: #545b62;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 1em;
}

.help-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 20px;
}

.help-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.help-content {
    color: #555;
    line-height: 1.6;
}

.help-content ol, .help-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-content li {
    margin-bottom: 5px;
}

.help-content code {
    background: #f1f2f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #e74c3c;
}

.help-content strong {
    color: #2c3e50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .log-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .log-time, .log-type {
        min-width: auto;
    }
    
    .card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .config-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* 滚动条样式 */
.log-container::-webkit-scrollbar {
    width: 8px;
}

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

.log-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 消息发送表单样式 */
.send-message-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* API调用状态显示 */
.api-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    border-left: 4px solid #3498db;
}

.api-status.success {
    border-left-color: #27ae60;
    background: #e8f5e8;
}

.api-status.error {
    border-left-color: #e74c3c;
    background: #fdeded;
}

.api-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.api-status-title {
    font-weight: 600;
    color: #2c3e50;
}

.api-status-time {
    color: #7f8c8d;
    font-size: 0.9em;
}

.api-status-content {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    max-height: 200px;
    overflow-y: auto;
}

.api-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.api-stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.api-stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.api-stat-label {
    color: #7f8c8d;
    font-size: 0.9em;
}

/* 消息类型标签 */
.message-type-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-type-text {
    background: #e3f2fd;
    color: #1976d2;
}

.message-type-image {
    background: #f3e5f5;
    color: #7b1fa2;
}

.message-type-voice {
    background: #e8f5e8;
    color: #388e3c;
}

.message-type-video {
    background: #fff3e0;
    color: #f57c00;
}

.message-type-file {
    background: #e0e0e0;
    color: #616161;
}

.message-type-news {
    background: #ffebee;
    color: #d32f2f;
}

.message-type-mpnews {
    background: #f1f8e9;
    color: #689f38;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式调整 */
@media (max-width: 480px) {
    .send-message-form {
        padding: 15px;
    }
    
    .api-stats {
        grid-template-columns: 1fr;
    }
    
    .api-stat-item {
        padding: 12px;
    }
}