:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-discovery: #38bdf8;
    --accent-handshake: #fbbf24;
    --accent-call: #4ade80;
    --accent-user: #f472b6;
    --accent-assistant: #818cf8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #9333ea;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: #0ea5e9;
    top: 40%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes move {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(50px, 50px) scale(1.1);
    }
}

.app-container {
    width: 95vw;
    height: 90vh;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo i {
    font-size: 24px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
}

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

.status-indicators {
    display: flex;
    gap: 20px;
}

.indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

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

.indicator.active .dot {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

main {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
}

.pane {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.flow-pane {
    flex: 1;
}

.chat-pane {
    flex: 1.2;
}

.pane-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.pane-header h2 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.pane-header i {
    color: var(--text-secondary);
}

#clear-flow {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

#clear-flow:hover {
    color: #ef4444;
}

.flow-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.flow-item {
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    animation: slideIn 0.3s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.flow-item.discovery {
    border-left: 4px solid var(--accent-discovery);
}

.flow-item.handshake {
    border-left: 4px solid var(--accent-handshake);
}

.flow-item.call {
    border-left: 4px solid var(--accent-call);
}

.flow-item .type {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.discovery .type {
    color: var(--accent-discovery);
}

.handshake .type {
    color: var(--accent-handshake);
}

.call .type {
    color: var(--accent-call);
}

.flow-item .agent {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.flow-item .details {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

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

.message {
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.user .message-bubble {
    background: var(--primary-gradient);
    border-bottom-right-radius: 4px;
}

.assistant .message-bubble {
    background: rgba(51, 65, 85, 0.8);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
}

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

#chat-form {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#user-input:focus {
    border-color: var(--accent-assistant);
}

#send-btn {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    width: 45px;
    height: 45px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

#send-btn:hover {
    transform: scale(1.05);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    gap: 15px;
}

.empty-state i {
    font-size: 40px;
    opacity: 0.3;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    main {
        flex-direction: column;
    }

    .app-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
}

/* Query Suggestions */
.query-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.suggestion-chip {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 6px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: rgba(45, 55, 72, 0.8);
    color: var(--text-primary);
    border-color: var(--accent-assistant);
}

/* Title Block & Subtitle */
.title-block {
    display: flex;
    flex-direction: column;
}

.app-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

/* Header Controls & Tabs */
.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tab-switch {
    display: flex;
    background: rgba(15, 23, 42, 0.5);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    gap: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
}

/* Sub-views */
.sub-view {
    display: none;
    width: 100%;
    height: 100%;
}

.sub-view.active {
    display: flex;
}

#demo-view {
    gap: 20px;
    overflow: hidden;
}

#about-view {
    flex-direction: column;
}

/* About Pane */
.about-pane {
    flex: 1;
    overflow: hidden;
    padding: 0;
    /* Remove padding from pane container, handle in header/content */
}

.about-content {
    padding: 40px;
    overflow-y: auto;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.about-content h3 {
    color: var(--text-primary);
    margin: 30px 0 15px 0;
    font-size: 18px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.about-content h3:first-child {
    margin-top: 0;
}

.about-content p {
    margin-bottom: 15px;
}

.about-content strong {
    color: var(--accent-discovery);
}

.about-list {
    list-style: none;
    padding: 0;
}

.about-list li {
    background: rgba(30, 41, 59, 0.4);
    margin-bottom: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.agent-cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.6));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.card i {
    font-size: 24px;
    color: var(--accent-assistant);
}

.card:nth-child(2) i {
    color: var(--accent-call);
}

.card:nth-child(3) i {
    color: var(--accent-discovery);
}

.card span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

@media (max-width: 768px) {
    body {
        align-items: flex-start;
    }

    .app-container {
        /* Fix for mobile chrome address bar */
        height: 100dvh;
        width: 100vw;
        border-radius: 0;
    }

    header {
        padding: 10px 15px;
    }

    .logo h1 {
        /* Ensure single row */
        white-space: nowrap;
        font-size: 13px;
    }

    .logo i {
        font-size: 16px;
    }

    .app-subtitle {
        font-size: 10px;
        line-height: 1.3;
    }

    .hide-mobile {
        display: none;
    }

    .status-indicators {
        display: none;
    }

    /* Hide 2nd and 4th suggestions on mobile to save space */
    .suggestion-chip:nth-child(2),
    .suggestion-chip:nth-child(4) {
        display: none;
    }
}

.events {
    padding-left: 1.25rem;
}

.events li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    /* aligns content */
}

.label {
    font-weight: 600;
}

.discovery {
    color: #38bdf8;
}

.handshake {
    color: #fbbf24;
}

.call {
    color: #4ade80;
}

.response {
    color: #bbb5b6ff;
}

.output {
    margin-left: 0;
    color: #9ca3af;
}

/* --- Startup Overlay --- */