/* ============================================================
   EXOS AGENTIC BSS — Demo Microsite
   Dark Navy + Electric Cyan | Glassmorphism
   ============================================================ */

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

:root {
    --bg:           #080e1c;
    --bg-surface:   #0d1529;
    --bg-card:      rgba(13, 21, 41, 0.95);
    --bg-input:     rgba(255,255,255,0.05);
    --border:       rgba(0, 210, 255, 0.12);
    --border-hover: rgba(0, 210, 255, 0.28);
    --cyan:         #00d2ff;
    --cyan-dim:     rgba(0, 210, 255, 0.15);
    --cyan-glow:    rgba(0, 210, 255, 0.06);
    --teal:         #00b4a0;
    --gold:         #f0b429;
    --text:         #ccd6f6;
    --text-bright:  #e8f0fe;
    --text-muted:   #6b7fa8;
    --text-dim:     #3d5077;
    --success:      #00e5a0;
    --warning:      #f0b429;
    --error:        #ff5c7a;
    --radius:       12px;
    --radius-lg:    18px;
    --font:         'DM Sans', 'Inter', system-ui, sans-serif;
    --font-mono:    'IBM Plex Mono', 'JetBrains Mono', monospace;
    --nav-h:        64px;
    --sidebar-w:    280px;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    overflow: hidden;
}

/* ── NAV ────────────────────────────────────────────────── */
.nav {
    position: fixed;
    inset: 0 0 auto;
    height: var(--nav-h);
    background: rgba(8,14,28,0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.nav-logo-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--cyan), var(--teal));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--bg);
    font-family: var(--font-mono);
    letter-spacing: -1px;
    flex-shrink: 0;
}

.nav-brand {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-bright);
    line-height: 1.2;
}

.nav-brand span {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.nav-live {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.nav-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.nav-spacer { flex: 1; }

.nav-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--cyan);
    background: var(--cyan-dim);
    border: 1px solid rgba(0,210,255,0.25);
    border-radius: 100px;
    padding: 0.15rem 0.6rem;
    letter-spacing: 0.04em;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    padding-top: var(--nav-h);
}

/* ── TOP BAR ─────────────────────────────────────────────── */
.topbar {
    grid-column: 1 / -1;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.topbar-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

/* Account selector */
.account-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.account-btn {
    padding: 0.3rem 0.85rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.account-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--cyan-dim);
}

.account-btn.active {
    border-color: var(--cyan);
    color: var(--cyan);
    background: var(--cyan-dim);
    font-weight: 600;
}

.topbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
}

/* Agent tabs */
.agent-tabs {
    display: flex;
    gap: 0.25rem;
}

.agent-tab {
    padding: 0.35rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.agent-tab:hover {
    background: var(--cyan-glow);
    color: var(--text);
    border-color: var(--border);
}

.agent-tab.active {
    background: var(--cyan-dim);
    border-color: rgba(0,210,255,0.3);
    color: var(--cyan);
    font-weight: 600;
}

.agent-tab-icon {
    font-size: 0.85rem;
    line-height: 1;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 0.25rem;
}

.prompt-chip {
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
    font-family: var(--font);
}

.prompt-chip:hover {
    border-color: var(--border-hover);
    background: rgba(0,210,255,0.06);
    color: var(--text-bright);
}

.prompt-chip:active {
    transform: scale(0.98);
}

/* ── MAIN CHAT ───────────────────────────────────────────── */
.chat-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scroll-behavior: smooth;
}

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

/* Welcome state */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 1rem;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.chat-welcome-icon {
    font-size: 2.5rem;
    opacity: 0.4;
}

.chat-welcome h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.chat-welcome p {
    font-size: 0.85rem;
    max-width: 320px;
}

/* Messages */
.msg {
    display: flex;
    gap: 0.75rem;
    max-width: 100%;
}

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

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.msg-ai .msg-avatar {
    background: linear-gradient(135deg, var(--cyan), var(--teal));
    color: var(--bg);
}

.msg-user .msg-avatar {
    background: rgba(255,255,255,0.07);
    color: var(--text-muted);
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-user .msg-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.msg-meta {
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.msg-bubble {
    padding: 0.7rem 1rem;
    border-radius: 14px;
    max-width: min(640px, 100%);
    font-size: 0.875rem;
    line-height: 1.65;
}

.msg-ai .msg-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px 14px 14px 14px;
    color: var(--text);
}

.msg-user .msg-bubble {
    background: var(--cyan-dim);
    border: 1px solid rgba(0,210,255,0.2);
    border-radius: 14px 4px 14px 14px;
    color: var(--text-bright);
}

/* Message content formatting */
.msg-bubble p { margin-bottom: 0.6rem; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble strong { color: var(--text-bright); font-weight: 600; }
.msg-bubble code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: rgba(0,210,255,0.08);
    border: 1px solid rgba(0,210,255,0.15);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    color: var(--cyan);
}
.msg-bubble pre {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
}
.msg-bubble ul, .msg-bubble ol {
    padding-left: 1.25rem;
    margin-bottom: 0.6rem;
}
.msg-bubble li { margin-bottom: 0.2rem; }
.msg-bubble h3, .msg-bubble h4 {
    color: var(--text-bright);
    font-weight: 600;
    margin: 0.5rem 0 0.3rem;
}

/* Tool calls */
.tool-calls {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--teal);
    background: rgba(0,180,160,0.1);
    border: 1px solid rgba(0,180,160,0.25);
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
    letter-spacing: 0.02em;
}

.tool-badge::before {
    content: '⚙';
    font-size: 0.7rem;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px 14px 14px 14px;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    animation: typing 1.2s ease-in-out infinite;
    opacity: 0.4;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Error message */
.msg-error .msg-bubble {
    background: rgba(255,92,122,0.08);
    border-color: rgba(255,92,122,0.25);
    color: var(--error);
}

/* ── INPUT ───────────────────────────────────────────────── */
.chat-input-area {
    padding: 1rem 2rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}

.chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.6rem 0.75rem 0.6rem 1rem;
    transition: border-color 0.18s ease;
}

.chat-input-wrap:focus-within {
    border-color: rgba(0,210,255,0.4);
    box-shadow: 0 0 0 3px var(--cyan-glow);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-bright);
    font-family: var(--font);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    min-height: 24px;
}

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

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--cyan), var(--teal));
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.18s ease, transform 0.12s ease;
    font-size: 1rem;
}

.send-btn:hover { opacity: 0.85; }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.chat-input-hint {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 0.5rem;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .chat-messages { padding: 1rem; }
    .chat-input-area { padding: 0.75rem 1rem; }
    .topbar { flex-wrap: wrap; gap: 0.6rem; }
    .topbar-sep { display: none; }
}
