/* WebSocket Test Page Specific Styles */

.ws-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.ws-container h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

.connection-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.config-group {
    margin-bottom: 1.5rem;
}

.config-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #34495e;
}

.config-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

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

/* 修复连接统计横向排版问题，移除无效的 column 字符 */
.connection-stats {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-top: 15px;
    justify-content: flex-start;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    text-align: center;
}

.stat-value {
    font-weight: bold;
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 2px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.input-group button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#connectBtn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

#connectBtn:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
}

#clearBtn {
    background: linear-gradient(135deg, #95a5a6, #bdc3c7);
    color: white;
}

#clearBtn:hover {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    transform: translateY(-2px);
}

#debugToggle {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

#debugToggle:hover {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    transform: translateY(-2px);
}

#sendBtn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

#sendBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9, #3498db);
    transform: translateY(-2px);
}

#sendBtn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
}

#messageInput:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#messageInput:disabled {
    background: #f8f9fa;
    color: #6c757d;
}

.status {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    text-align: center;
    font-size: 1.1rem;
}

.status.connected {
    background: linear-gradient(135deg, #d5f4e6, #a8e6cf);
    color: #27ae60;
    border: 2px solid #27ae60;
}

.status.disconnected {
    background: linear-gradient(135deg, #fadbd8, #f1948a);
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

.status.reconnecting {
    background: linear-gradient(135deg, #fdeaa7, #f9ca24);
    color: #f39c12;
    border: 2px solid #f39c12;
    animation: pulse 1s infinite;
}

.message-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.quick-message {
    padding: 8px 12px;
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
    border: 1px solid #95a5a6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.quick-message:hover:not(:disabled) {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quick-message:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-container {
    height: 400px;
    overflow-y: auto;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #f8f9fa;
}

.message {
    margin-bottom: 1rem;
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-out;
}

.message.sent {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.received {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-left: 3px solid #ffc107;
}

.message.system {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    margin: 0 auto;
    text-align: center;
    font-style: italic;
    max-width: 90%;
    border-left: 3px solid #17a2b8;
}

.message.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    margin: 0 auto;
    text-align: center;
    max-width: 90%;
    border-left: 3px solid #dc3545;
}

.message.streaming {
    border-left: 3px solid #007bff;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
}

/* 队列状态样式 */
.queue-status {
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.9em;
    border: 1px solid #ffeaa7;
}

/* 健康指示器样式 */
.health-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 8px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    z-index: 1000;
}

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    animation: pulse 2s infinite;
}

.health-dot.connected {
    background: #28a745;
}

.health-dot.connecting {
    background: #ffc107;
}

.debug-panel {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    display: none;
}

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

.debug-controls {
    display: flex;
    gap: 5px;
}

.debug-panel strong {
    color: #2c3e50;
}

.debug-panel button {
    padding: 4px 12px;
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.debug-panel button:hover {
    background: linear-gradient(135deg, #495057, #343a40);
}

.debug-content,
#debugInfo {
    max-height: 200px;
    overflow-y: auto;
    background: white;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    color: #333;
    border: 1px solid #dee2e6;
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar,
#debugInfo::-webkit-scrollbar,
.debug-content::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track,
#debugInfo::-webkit-scrollbar-track,
.debug-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb,
#debugInfo::-webkit-scrollbar-thumb,
.debug-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover,
#debugInfo::-webkit-scrollbar-thumb:hover,
.debug-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #3498db);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .ws-container {
        margin: 1rem;
        padding: 1rem;
    }

    .ws-container h1 {
        font-size: 2rem;
    }

    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .input-group button {
        width: 100%;
    }

    .message {
        max-width: 95%;
    }

    .chat-container {
        height: 300px;
    }

    .connection-stats {
        gap: 8px;
    }

    .stat-item {
        padding: 8px;
    }

    .stat-value {
        font-size: 1em;
    }

    .stat-label {
        font-size: 0.7em;
    }

    .message-controls {
        gap: 5px;
    }

    .quick-message {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .health-indicator {
        bottom: 10px;
        right: 10px;
        padding: 6px 10px;
    }
}

footer {
    background: #222;
    color: #fff;
    padding: 1.5rem 0 1rem 0;
    text-align: center;
    position: relative;
    z-index: 0;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
}

/* Focus indicators for accessibility */
button:focus,
input:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Additional utility classes */
.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.fw-bold {
    font-weight: bold;
}

.text-muted {
    color: #6c757d;
}
