:root {
    /* THEME COLOR: CYBER EMERALD */
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.15);
    --primary-dark: #059669;
    
    /* DARK PALETTE */
    --bg-deep: #0a0a0c;
    --bg-surface: #121215;
    --bg-subtle: #1c1c21;
    --border: rgba(255, 255, 255, 0.06);
    --border-bright: rgba(255, 255, 255, 0.12);
    
    /* TEXT */
    --text-main: #e4e4e7;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    
    /* UI CONSTANTS */
    --sidebar-width: 320px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ============ SIDEBAR (MEMORY BANK) ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-header {
    padding: 32px 24px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background: var(--primary);
    color: var(--bg-deep);
    border-color: var(--primary);
}

.memory-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin: 20px 8px 12px;
    font-weight: 600;
}

.memory-card {
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.memory-card:hover {
    background: var(--bg-subtle);
    border-color: var(--border);
}

.memory-card.active {
    background: var(--primary-glow);
    border-color: var(--primary);
}

.memory-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.memory-preview {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.memory-stats {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.7rem;
}

.memory-badge {
    padding: 2px 6px;
    background: var(--bg-deep);
    border-radius: 4px;
    color: var(--text-muted);
}

/* ============ MAIN CHAT AREA ============ */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

header {
    height: 70px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.status-pill {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot { 
    width: 6px; 
    height: 6px; 
    border-radius: 50%; 
    background: var(--primary);
    animation: pulse 2s infinite;
}

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

.model-switcher {
    background: var(--bg-subtle);
    padding: 4px;
    border-radius: 100px;
    display: flex;
    gap: 4px;
    border: 1px solid var(--border);
}

.model-tab {
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.model-tab.active {
    background: var(--primary);
    color: var(--bg-deep);
}

.header-logo-small {
    width: 120px;
    display: flex;
    justify-content: flex-end;
}

.small-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    opacity: 0.8;
    transition: var(--transition);
}

.small-logo:hover {
    opacity: 1;
    transform: scale(1.05);
}

.chat-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 40px 0;
    scroll-behavior: smooth;
}

.chat-boundary {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ MESSAGES ============ */
.msg-row {
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(10px);
    animation: slideIn 0.4s forwards;
}

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

.msg-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-row.ai .msg-avatar {
    background: var(--primary-glow);
    border: 1px solid var(--primary);
}

.msg-content {
    line-height: 1.7;
    font-size: 1.05rem;
    color: var(--text-main);
    padding-left: 40px;
}

.msg-content code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.msg-content p {
    margin-bottom: 1em;
}

.msg-content p:last-child {
    margin-bottom: 0;
}

.msg-content strong {
    color: var(--primary);
    font-weight: 600;
}

/* Welcome Message with Logo */
.welcome-message .msg-content {
    padding-left: 40px;
}

.welcome-content {
    text-align: center;
    padding: 20px;
}

.welcome-logo-large {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    object-fit: cover;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.welcome-content h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.thinking-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: thinking 1.4s infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking {
    0%, 60%, 100% { transform: scale(1); opacity: 0.5; }
    30% { transform: scale(1.2); opacity: 1; }
}

/* ============ INPUT AREA ============ */
.input-anchor {
    padding: 20px 40px 40px;
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    transition: var(--transition);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    padding: 12px 0;
    resize: none;
    outline: none;
    max-height: 200px;
    line-height: 1.5;
}

textarea::placeholder {
    color: var(--text-dim);
}

.action-circle {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--primary);
    color: var(--bg-deep);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.action-circle:hover:not(:disabled) {
    transform: scale(1.05);
    background: #fff;
}

.action-circle:disabled {
    background: var(--bg-subtle);
    color: var(--text-dim);
    cursor: not-allowed;
}

.input-footer {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.footer-note {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-note span {
    color: var(--primary);
}

.inline-logo {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    object-fit: cover;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Quick Prompts */
.quick-prompts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 32px;
}

.quick-prompt {
    padding: 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.quick-prompt:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Empty State with Logo */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-dim);
}

.empty-state-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    header {
        padding: 0 20px;
    }
    
    .input-anchor {
        padding: 20px;
    }
    
    .quick-prompts {
        grid-template-columns: 1fr;
    }
    
    .welcome-logo-large {
        width: 80px;
        height: 80px;
    }
}