/* ========================================
   WebSocket 测试工具样式
   ======================================== */

html, body { height: 100%; overflow: hidden; margin: 0; }
body { display: flex; align-items: center; justify-content: center; padding-top: 70px; }

.main-content {
    width: 100%; max-width: 900px; height: calc(100vh - 120px);
    display: flex; align-items: center; padding: 0 20px; padding-bottom: 50px; z-index: 10;
}
.container { width: 100%; height: 100%; }
.tool-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-xl);
    overflow: hidden; display: flex; flex-direction: column; width: 100%; height: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.panel-header {
    padding: 8px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted);
    background: rgba(255,255,255,0.02); border-bottom: 1px solid rgba(255,255,255,0.05); flex-shrink: 0;
}

/* 连接栏 */
.ws-connection-bar { padding: 16px; background: rgba(0,0,0,0.2); border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.ws-input-group { margin-bottom: 12px; }
.ws-input-group label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.ws-input {
    width: 100%; padding: 10px 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); color: var(--text-primary); font-size: 14px; outline: none;
    font-family: var(--font-mono);
}
.ws-input:focus { border-color: var(--primary-color); }
.ws-btn-group { display: flex; gap: 8px; }
.ws-btn {
    padding: 8px 20px; border-radius: var(--radius-md); border: none; cursor: pointer;
    font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; transition: 0.2s;
}
.ws-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ws-btn-connect { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.ws-btn-connect:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(34,197,94,0.4); }
.ws-btn-disconnect { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.ws-btn-disconnect:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(239,68,68,0.4); }
.ws-btn-send { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; white-space: nowrap; }

/* 状态栏 */
.ws-status-bar { padding: 8px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.ws-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.ws-status-dot.connected { background: #22c55e; animation: ws-pulse 2s infinite; }
.ws-status-dot.connecting { background: #f59e0b; animation: ws-pulse 1s infinite; }
.ws-status-dot.error { background: #ef4444; }
@keyframes ws-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.ws-status-text { font-size: 13px; color: var(--text-secondary); }

/* 消息面板 */
.ws-message-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.ws-messages { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.ws-msg { padding: 8px 12px; margin-bottom: 6px; border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font-mono); word-break: break-all; }
.ws-msg.sent { background: rgba(59,130,246,0.1); border-left: 3px solid #3b82f6; }
.ws-msg.received { background: rgba(34,197,94,0.1); border-left: 3px solid #22c55e; }
.ws-msg.system { background: rgba(255,255,255,0.03); color: var(--text-muted); border-left: 3px solid var(--text-muted); }
.ws-msg-time { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.ws-msg-dir { font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.ws-msg.sent .ws-msg-dir { color: #3b82f6; }
.ws-msg.received .ws-msg-dir { color: #22c55e; }
.ws-send-bar { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border-color); flex-shrink: 0; }
.ws-send-input {
    flex: 1; padding: 10px 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); color: var(--text-primary); font-size: 14px; outline: none;
}
.ws-send-input:focus { border-color: var(--primary-color); }
.ws-send-input:disabled { opacity: 0.4; }

/* 日志面板 */
.ws-log-panel { border-top: 1px solid var(--border-color); flex-shrink: 0; max-height: 150px; display: flex; flex-direction: column; }
.ws-logs { flex: 1; overflow-y: auto; padding: 8px 12px; font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); }
.ws-log-item { padding: 2px 0; }
.ws-log-item .ws-log-time { color: var(--text-muted); }
.ws-log-item .ws-log-msg { color: var(--text-secondary); }

@media (max-width: 600px) {
    .ws-btn-group { flex-direction: column; }
    .ws-btn { width: 100%; justify-content: center; }
}
