/* ========================================
   Energent AI Computer Use Agent — Light Theme
   Matching Legent AI Screenshot Design
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Light Theme matching screenshot */
    --bg-body: #f0f4fa;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fc;
    --bg-tertiary: #f0f2f7;
    --bg-elevated: #e8ecf4;
    --bg-hover: #e1e7f0;
    --bg-active: #d4dff0;

    --text-primary: #1a1d26;
    --text-secondary: #5e6577;
    --text-muted: #9099a8;
    --text-placeholder: #b0b7c4;

    --accent: #4a9eff;
    --accent-hover: #3a8eef;
    --accent-dark: #2870d6;
    --accent-light: rgba(74, 158, 255, 0.12);
    --accent-glow: rgba(74, 158, 255, 0.25);
    --accent-gradient: linear-gradient(135deg, #4a9eff 0%, #6cb8ff 100%);

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.12);

    --border: #e2e6ee;
    --border-subtle: #edf0f7;
    --border-accent: rgba(74, 158, 255, 0.4);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    --shadow-accent: 0 4px 16px rgba(74, 158, 255, 0.2);

    /* Sizing */
    --sidebar-width: 250px;
    --chat-width: 350px;
    --toolbar-height: 48px;
    --statusbar-height: 34px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

/* ====== Layout ====== */

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: var(--bg-body);
}

/* ====== Left Sidebar ====== */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
}

.logo-icon svg {
    width: 18px;
    height: 18px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Search */

.sidebar-search {
    padding: 12px 16px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--accent);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-placeholder);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-primary);
}

/* Sidebar Sections */

.sidebar-section {
    padding: 4px 0;
    flex-shrink: 0;
}

/* Task history: scrollable, fills remaining space */
.sidebar-section-tasks {
    flex: 1 1 0;
    overflow-y: auto;
    min-height: 80px;
}

.sidebar-section-tasks::-webkit-scrollbar {
    width: 5px;
}

.sidebar-section-tasks::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section-tasks::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Prompt gallery: fixed at bottom, never shrinks */
.sidebar-section-prompts {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
}

.section-header {
    padding: 10px 16px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

/* Folder Tree */

.folder-tree {
    padding: 0 8px;
}

.folder-item {
    margin-bottom: 2px;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.folder-header:hover {
    background: var(--bg-hover);
}

.folder-icon {
    color: var(--warning);
    flex-shrink: 0;
}

.folder-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.folder-children {
    padding-left: 20px;
    margin-top: 2px;
}

/* Task Items */

.task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1.5px solid transparent;
    margin-bottom: 2px;
}

.task-item:hover {
    background: var(--bg-hover);
}

.task-item.active {
    background: var(--accent-light);
    border-color: var(--accent);
}

.task-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-icon::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239099a8' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.task-icon.running::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3C/svg%3E");
    animation: pulse 1.5s infinite;
}

.task-icon.idle::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a9eff' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3C/svg%3E");
}

.task-icon.error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3C/svg%3E");
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.task-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.task-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    color: var(--error);
    background: var(--error-light);
}

/* Prompt Gallery */

.prompt-gallery {
    padding: 0 8px;
}

.prompt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.prompt-item:hover {
    background: var(--bg-hover);
}

.prompt-icon {
    font-size: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.prompt-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Sidebar Footer */

.sidebar-footer {
    flex-shrink: 0;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    border-radius: var(--radius-xl);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    padding: 12px 20px;
    font-size: 14px;
    width: 100%;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button Group */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-bottom: 12px;
}

/* Dual Workspace Button */
.btn-dual-workspace {
    background: linear-gradient(135deg, #f0f7ff 0%, #e1effe 100%);
    color: #1a56db;
    padding: 12px 20px;
    font-size: 14px;
    width: 100%;
    border: 1px solid rgba(26, 86, 219, 0.15);
    box-shadow: 0 4px 6px rgba(26, 86, 219, 0.05);
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-dual-workspace:hover {
    background: linear-gradient(135deg, #e1effe 0%, #d1e9ff 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(26, 86, 219, 0.15);
    border-color: rgba(26, 86, 219, 0.25);
    color: #1e40af;
}

.btn-dual-workspace:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(26, 86, 219, 0.1);
}

.btn-dual-workspace svg {
    stroke: currentColor;
    width: 16px;
    height: 16px;
}

.btn-dual-workspace span {
    font-weight: 600;
}

.btn-new-task svg {
    width: 16px;
    height: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-fast);
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

/* Empty State */

.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.empty-state.small {
    padding: 12px;
}

.empty-state p {
    font-size: 13px;
}

/* ====== VNC Panel ====== */

.vnc-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    min-width: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.vnc-toolbar {
    height: var(--toolbar-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.vnc-toolbar-left,
.vnc-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vnc-toolbar-center {
    flex: 1;
    text-align: center;
}

.vnc-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.toolbar-btn svg {
    width: 14px;
    height: 14px;
}

#btn-record {
    border-color: var(--border-accent);
    background: var(--accent-light);
    color: var(--accent);
}

#btn-record:hover {
    background: var(--accent);
    color: white;
}

#btn-record svg {
    color: inherit;
}

#btn-stop {
    border-color: var(--border);
}

#btn-stop:hover {
    border-color: var(--error);
    color: var(--error);
    background: var(--error-light);
}

.badge {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: var(--radius-xl);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
}

.badge.running {
    background: var(--success-light);
    color: var(--success);
}

.badge.error {
    background: var(--error-light);
    color: var(--error);
}

.vnc-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d1b2a;
    margin: 0;
    border-radius: 0;
}

.vnc-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.vnc-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.placeholder-icon {
    margin-bottom: 20px;
    opacity: 0.3;
}

.placeholder-icon svg {
    stroke: var(--text-muted);
}

.placeholder-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.placeholder-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.vnc-statusbar {
    height: var(--statusbar-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    background: #1b2838;
    border-top: none;
}

.workspace-label {
    font-size: 12px;
    color: #8599b0;
    font-weight: 500;
}

/* ====== Chat Panel ====== */

.chat-panel {
    width: var(--chat-width);
    min-width: var(--chat-width);
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Welcome Message */

.welcome-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.bot-avatar {
    width: 38px;
    height: 38px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.25);
}

.bot-avatar svg {
    width: 20px;
    height: 20px;
}

.welcome-text {
    background: var(--bg-secondary);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border-top-left-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.welcome-text p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Chat Messages */

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeIn 0.25s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message-avatar.user {
    background: var(--accent);
    color: white;
}

.message-avatar.assistant {
    background: var(--accent-gradient);
    color: white;
}

.message-avatar.tool {
    background: var(--warning-light);
    color: var(--warning);
}

.message-content {
    max-width: 82%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--accent);
    color: white;
    border-top-right-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.2);
}

.message.assistant .message-bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-top-left-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.message.tool .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Mono', monospace;
    font-size: 12px;
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
}

.message.thinking .message-bubble {
    background: transparent;
    border: 1.5px dashed var(--border);
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
}

.message.error .message-bubble {
    background: var(--error-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.message.status .message-bubble {
    background: transparent;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 8px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.message.user .message-time {
    text-align: right;
}

/* Chat Input */

.chat-input-container {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}

.chat-form {
    width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 8px 8px 8px 16px;
    transition: all var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-primary);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
}

#chat-input::placeholder {
    color: var(--text-placeholder);
}

#chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send {
    background: var(--accent);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 6px rgba(74, 158, 255, 0.2);
}

.btn-send:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-send svg {
    width: 18px;
    height: 18px;
}

/* ====== File Section ====== */

.file-section {
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 220px;
}

.file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.file-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.btn-icon-small {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-small:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--accent);
}

.btn-icon-small:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* File Upload Area */

.file-upload-area {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    margin: 10px 12px;
    background: var(--bg-secondary);
}

.file-upload-area:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.upload-icon {
    color: var(--accent);
    margin-bottom: 8px;
}

.upload-icon svg {
    opacity: 0.7;
    stroke: var(--accent);
}

.upload-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

/* File List */

.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.file-list::-webkit-scrollbar {
    width: 4px;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.file-item:hover {
    background: var(--bg-hover);
}

.file-icon {
    font-size: 16px;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.file-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-actions {
    display: flex;
    gap: 4px;
}

.file-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.file-action-btn:hover {
    background: var(--bg-elevated);
    color: var(--accent);
}

/* ====== Animations ====== */

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

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

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

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

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Close Button for file section */
.file-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 4px;
}

.file-close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ====== Responsive ====== */

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 220px;
        --chat-width: 310px;
    }
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar, .chat-panel {
        width: 100%;
        min-width: 100%;
        max-height: 30vh;
    }
    .vnc-panel {
        min-height: 40vh;
    }
}

/* ====== Dual Workspace (Embedded Mode) ====== */
body.is-embedded .app-container {
    flex-wrap: wrap !important;
    flex-direction: row !important;
}

body.is-embedded .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    height: 60px !important;
    max-height: 60px !important;
    display: flex !important;
    flex-direction: row !important;
    padding: 0 16px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    overflow: hidden !important;
}

body.is-embedded .sidebar-header,
body.is-embedded .sidebar-search,
body.is-embedded .sidebar-section-tasks,
body.is-embedded .sidebar-section-prompts {
    display: none !important;
}

body.is-embedded .sidebar-footer {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    border-top: none !important;
    padding: 0 !important;
    background: transparent !important;
}

body.is-embedded #btn-new-session {
    margin: 0 !important;
    width: auto !important;
    padding: 8px 24px !important;
}

body.is-embedded #health-status {
    margin-top: 0 !important;
}

/* Side-by-Side View inside iframes */
body.is-embedded .vnc-panel {
    width: 60% !important;
    min-width: 60% !important;
    height: calc(100vh - 60px) !important;
    min-height: calc(100vh - 60px) !important;
    flex: none !important;
    border-right: 1px solid var(--border) !important;
}

body.is-embedded .chat-panel {
    width: 40% !important;
    min-width: 40% !important;
    height: calc(100vh - 60px) !important;
    max-height: calc(100vh - 60px) !important;
    flex: none !important;
    border-left: none !important;
}
