:root {
    --bg-dark: #09090b;
    --bg-panel: #18181b;
    --bg-input: #27272a;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --border: #27272a;
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg-dark);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--accent);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-panel);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.welcome-message {
    text-align: center;
    margin: auto 0;
    color: var(--text-secondary);
}

.welcome-message h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in-out;
}

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

.message.user {
    align-self: flex-end;
    background-color: var(--bg-panel);
    padding: 1rem 1.25rem;
    border-radius: 1rem 1rem 0 1rem;
    border: 1px solid var(--border);
}

.message.agent {
    align-self: flex-start;
}

.message-content {
    line-height: 1.6;
}

.code-block {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 1rem;
}

.code-header {
    background-color: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.code-content {
    padding: 1rem;
    font-family: monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    color: #e2e8f0;
}

.execute-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s;
}

.execute-btn:hover {
    background-color: var(--accent-hover);
}

.execute-btn:disabled {
    background-color: var(--border);
    cursor: not-allowed;
    color: var(--text-secondary);
}

.execution-result {
    margin-top: 0.5rem;
    background-color: #000;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: #a3e635; /* Terminal green */
    white-space: pre-wrap;
}

.execution-error {
    color: var(--danger);
}

.input-area {
    padding: 1.5rem 2rem;
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 0.5rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

#prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: var(--font-main);
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 200px;
}

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

#send-btn {
    background: var(--accent);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    margin: 0.25rem;
    transition: transform 0.2s, background 0.2s;
}

#send-btn:hover {
    background: var(--accent-hover);
}

#send-btn:active {
    transform: scale(0.95);
}

.hidden {
    display: none !important;
}

/* Typing animation */
.dot-typing {
    position: relative;
    left: -9999px;
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background-color: var(--accent);
    color: var(--accent);
    box-shadow: 9984px 0 0 0 var(--accent), 9999px 0 0 0 var(--accent), 10014px 0 0 0 var(--accent);
    animation: dot-typing 1.5s infinite linear;
    margin-left: 20px;
}

@keyframes dot-typing {
    0% { box-shadow: 9984px 0 0 0 var(--accent), 9999px 0 0 0 rgba(59, 130, 246, 0.2), 10014px 0 0 0 rgba(59, 130, 246, 0.2); }
    30% { box-shadow: 9984px 0 0 0 rgba(59, 130, 246, 0.2), 9999px 0 0 0 var(--accent), 10014px 0 0 0 rgba(59, 130, 246, 0.2); }
    60% { box-shadow: 9984px 0 0 0 rgba(59, 130, 246, 0.2), 9999px 0 0 0 rgba(59, 130, 246, 0.2), 10014px 0 0 0 var(--accent); }
    100% { box-shadow: 9984px 0 0 0 rgba(59, 130, 246, 0.2), 9999px 0 0 0 rgba(59, 130, 246, 0.2), 10014px 0 0 0 rgba(59, 130, 246, 0.2); }
}

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.login-box {
    background: #111;
    border: 1px solid #333;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.login-box h2 { margin-bottom: 10px; color: #fff; font-size: 20px; }
.login-box p { color: #aaa; font-size: 14px; margin-bottom: 20px; }

.login-box input {
    width: 100%;
    padding: 12px;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
    outline: none;
}
.login-box input:focus { border-color: #3b82f6; }

.login-box button {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.login-box button:hover { background: #2563eb; }

.error-msg {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 13px;
}

.header-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.4rem;
    border-radius: 0.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.header-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}
