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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}
.left-panel {
    width: 50%;  /* Changed from 400px to 50% for centered layout */
    min-width: 400px;  /* Increased from 300px for better usability */
    max-width: 60%;  /* Changed from 700px to 60% for more flexibility */
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2a2a2a;
    overflow: hidden;
}

.panel-header {
    padding: 20px;
    background: #222;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.status-dot.connected {
    background: #10b981;
    animation: pulse 2s infinite;
}

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

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 3px;
}

.message {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    animation: slideIn 0.2s;
}

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

.message.system {
    background: #1e3a5f;
    border-left: 3px solid #3b82f6;
}

.message.user {
    background: #2a2a2a;
    border-left: 3px solid #10b981;
}

.message.response {
    background: #2a1a3a;
    border-left: 3px solid #a855f7;
}

.message.error {
    background: #3a1a1a;
    border-left: 3px solid #ef4444;
}

.message-content {
    font-size: 14px;
    line-height: 1.5;
}

.input-area {
    padding: 20px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
}

textarea {
    width: 100%;
    background: #222;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 12px;
    color: #e0e0e0;
    font-size: 14px;
    resize: none;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.input-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #2a2a2a;
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: #3a3a3a;
}

.vm-info {
    padding: 15px 20px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    font-size: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.info-item .label {
    color: #999;
}

.info-item .value {
    color: #10b981;
    font-weight: 500;
}

.right-panel {
    flex: 1;
    min-width: 40%;  /* Ensure right panel has minimum width */
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vnc-controls {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
}

.btn-icon:hover {
    background: #3a3a3a;
}

.vnc-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#vncScreen {
    width: 100%;
    height: 100%;
    position: relative;
}

.vnc-loading {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #2a2a2a;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-details {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
}

.vnc-error {
    text-align: center;
    padding: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.vnc-error h3 {
    color: #ef4444;
    margin-bottom: 10px;
}

.vnc-error p {
    color: #999;
    margin-bottom: 20px;
}

/* Resizable panels */
.resize-handle {
    width: 4px;
    background: #3a3a3a;
    cursor: col-resize;
    position: relative;
    transition: background 0.2s;
}

.resize-handle:hover {
    background: #3b82f6;
    width: 6px;
    margin: 0 -1px;
}

.resize-handle:active {
    background: #60a5fa;
}

/* Update container for resize */
.container {
    display: flex;
    height: 100vh;
    position: relative;
}

.left-panel {
    width: 400px;
    min-width: 300px;
    max-width: 700px;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-panel {
    flex: 1;
    min-width: 400px;
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* AI Message Types */
.message.ai-thinking {
    background: #1a2f4a;
    border-left: 3px solid #60a5fa;
}

.message.ai-clarification {
    background: #3a2f1a;
    border-left: 3px solid #fbbf24;
}

.message.ai-confirmation {
    background: #3a2a1a;
    border-left: 3px solid #fb923c;
}

.message.ai-success {
    background: #1a3a2a;
    border-left: 3px solid #10b981;
}

.message.ai-error {
    background: #3a1a1a;
    border-left: 3px solid #ef4444;
}

.message.ai-partial {
    background: #3a3a1a;
    border-left: 3px solid #eab308;
}

/* Message Header with Icons */
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.message-icon {
    font-size: 18px;
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #60a5fa;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Confirmation Buttons */
.confirmation-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.confirmed {
    color: #10b981;
    font-weight: 500;
}

/* Retry Container */
.retry-container {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    animation: slideIn 0.2s;
}

/* Task Status Bar */
.task-status-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #1a1a1a;
    border-top: 2px solid #2a2a2a;
    transition: all 0.3s;
}

.task-status-bar.status-executing {
    border-top-color: #60a5fa;
    background: #1a2f4a;
}

.task-status-bar.status-completed {
    border-top-color: #10b981;
    background: #1a3a2a;
}

.task-status-bar.status-error {
    border-top-color: #ef4444;
    background: #3a1a1a;
}

.task-status-bar.status-stopped {
    border-top-color: #6b7280;
    background: #1f2937;
}

.status-icon {
    font-size: 18px;
}

.status-message {
    flex: 1;
    font-size: 14px;
}

/* Enhanced scrollbar for chat */
.chat-container {
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a #1a1a1a;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Smooth transitions */
.message {
    transition: all 0.2s ease;
}

.message:hover {
    transform: translateX(2px);
}

/* Code blocks in messages (if needed) */
.message-content code {
    background: #2a2a2a;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.message-content pre {
    background: #2a2a2a;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

/* Loading states */
.message.loading {
    opacity: 0.7;
}

/* Error emphasis */
.message.ai-error .message-content {
    font-weight: 500;
}

/* Success emphasis */
.message.ai-success .message-content {
    color: #10b981;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .confirmation-buttons {
        flex-direction: column;
    }

    .retry-container {
        flex-direction: column;
    }

    .task-status-bar {
        font-size: 12px;
    }
}