:root {
    --primary: #dc3545;
    --primary-dark: #c82333;
    --primary-light: #e4606d;
    --secondary: #64748B;
    --success: #10a37f;
    --warning: #F59E0B;
    --error: #dc3545;
    --background: #f9f9f9;
    --surface: #FFFFFF;
    --text: #000000;
    --text-secondary: #666666;
    --border: #e5e5e5;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
}

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

header {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

h1 {
    color: var(--text);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.connection-panel,
.chat-panel,
.task-panel,
.debug-panel {
    background: var(--surface);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

h2 {
    color: var(--text);
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

h3 {
    color: var(--text);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.agent-selection {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.agent-selection label {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--surface);
}

.agent-selection label:hover {
    border-color: var(--primary);
    background: var(--background);
}

.agent-selection input[type="radio"]:checked + .agent-label {
    color: var(--primary);
    font-weight: bold;
}

.agent-label {
    font-size: 1.1rem;
    margin-left: 10px;
}

.server-url {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.server-url > div {
    display: flex;
    gap: 10px;
    align-items: center;
}

.server-url label {
    font-weight: 600;
    color: var(--text);
}

.server-url input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 0;
    display: block;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.agent-info {
    background: #D1FAE5;
    border: 2px solid var(--success);
    border-radius: 8px;
    padding: 15px;
}

.agent-info h3 {
    color: #065F46;
    margin-bottom: 10px;
}

#agentDetails {
    color: var(--text);
    font-size: 0.9rem;
}

#agentDetails .detail-item {
    margin: 5px 0;
    padding: 5px 0;
}

#agentDetails .detail-label {
    font-weight: 600;
    color: var(--text);
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background: var(--background);
}

.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-user {
    background: #DBEAFE;
    color: #1E40AF;
    margin-left: 20%;
}

.message-agent {
    background: #FEF3C7;
    color: #92400E;
    margin-right: 20%;
}

.message-system {
    background: #FEE2E2;
    color: #991B1B;
    text-align: center;
    font-style: italic;
}

.message-header {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.message-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-data {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.message-data summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    user-select: none;
}

.message-data summary:hover {
    opacity: 0.8;
}

.message-data pre {
    margin: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 0.75rem;
    overflow-x: auto;
    line-height: 1.4;
    font-family: 'Courier New', monospace;
}

.input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-area textarea {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.quick-actions {
    margin-top: 15px;
}

.quick-actions h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.quick-btn {
    margin: 5px;
    font-size: 0.9rem;
    padding: 8px 16px;
}

.task-list {
    display: grid;
    gap: 15px;
}

.task-item {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    background: var(--background);
}

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

.task-id {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.task-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-working {
    background: #FEF3C7;
    color: #92400E;
}

.status-completed {
    background: #D1FAE5;
    color: #065F46;
}

.status-failed {
    background: #FEE2E2;
    color: #991B1B;
}

.task-content {
    color: var(--text);
    font-size: 0.9rem;
}

.debug-log {
    height: 300px;
    overflow-y: auto;
    background: #1a202c;
    color: var(--success);
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.debug-entry {
    margin-bottom: 8px;
    padding: 5px;
    border-left: 3px solid var(--success);
    padding-left: 10px;
}

.debug-timestamp {
    color: #a0aec0;
    margin-right: 10px;
}

.debug-error {
    border-left-color: var(--error);
    color: var(--error);
}

.debug-info {
    border-left-color: #4299e1;
    color: #4299e1;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}
