:root {
    --bg-color: #030704;
    --panel-bg: rgba(5, 15, 10, 0.85);
    --border-color: rgba(0, 230, 118, 0.3);
    --primary-color: #00e676;
    --primary-glow: rgba(0, 230, 118, 0.6);
    --text-primary: #e0f2e5;
    --text-secondary: #60a07a;
    --user-msg-bg: rgba(0, 230, 118, 0.08);
    --bot-msg-bg: rgba(8, 20, 12, 0.8);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 230, 118, 0.04), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(30, 80, 50, 0.05), transparent 25%);
}

.cortex-wrapper {
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

@media (min-width: 768px) {
    .cortex-wrapper {
        height: 90vh;
        border-radius: 20px;
        background: var(--panel-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--border-color);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cortex-orb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, var(--primary-color));
    box-shadow: 0 0 15px var(--primary-glow);
    animation: pulse 3s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 10px var(--primary-glow); }
    100% { transform: scale(1.1); box-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-color); }
}

h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #fff, #a0a0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.connection-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #00e676;
    border-radius: 50%;
    box-shadow: 0 0 8px #00e676;
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

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

.chat-history::-webkit-scrollbar {
    width: 6px;
}
.chat-history::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.message {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    line-height: 1.6;
    animation: slideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

.message p {
    margin-bottom: 0.5rem;
}
.message p:last-child {
    margin-bottom: 0;
}
.message pre {
    background: #0a0a0f;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}
.message code {
    font-family: 'Roboto Mono', monospace;
    background: rgba(0,0,0,0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #e2a0ff;
}

.system-message, .bot-message {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    border: 1px solid rgba(255,255,255,0.05);
    border-bottom-left-radius: 2px;
}

.user-message {
    align-self: flex-end;
    background: var(--user-msg-bg);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-bottom-right-radius: 2px;
}

.input-container {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: transparent;
}

#chat-form {
    display: flex;
    gap: 1rem;
    position: relative;
    align-items: center;
}

#user-input {
    flex-grow: 1;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 30px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

#user-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2), inset 0 2px 5px rgba(0,0,0,0.2);
}

#send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

#send-btn svg {
    width: 20px;
    height: 20px;
}

#send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
}

#send-btn:active {
    transform: translateY(0);
}

.loading-indicator {
    display: flex;
    gap: 4px;
    padding: 1rem;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
