:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-input: #16161f;
    --border-color: #2a2a3a;
    --border-focus: #4f46e5;
    --text-primary: #f1f1f3;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-hover: #818cf8;
    --user-bubble: #6366f1;
    --user-bubble-text: #ffffff;
    --bot-bubble: #1e1e2a;
    --bot-bubble-border: #2a2a3a;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
}

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

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

.bg-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar {
    position: relative;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.avatar-initial {
    font-size: 24px;
    font-weight: 700;
    color: white;
    letter-spacing: -1px;
}

.status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 3px solid var(--bg-secondary);
    border-radius: var(--radius-full);
}

.header-info {
    flex: 1;
}

.header-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-tagline {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chat-container {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

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

.welcome-message {
    padding: 40px 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 32px var(--accent-glow);
}

.welcome-message h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    color: var(--text-secondary);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

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

.messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    color: white;
}

.message.bot .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--user-bubble);
    color: var(--user-bubble-text);
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: var(--bot-bubble);
    border: 1px solid var(--bot-bubble-border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.typing-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.typing-indicator.visible {
    display: flex;
}

.typing-indicator .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.typing-indicator span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span::before,
.typing-indicator span::after {
    content: '';
}

.typing-indicator span:first-child::before,
.typing-indicator span:nth-child(2)::before,
.typing-indicator span:last-child::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1)::before { animation-delay: 0s; }
.typing-indicator span:nth-child(2)::before { animation-delay: 0.2s; }
.typing-indicator span:last-child::before { animation-delay: 0.4s; }

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

.input-container {
    margin-top: 16px;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 6px;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    padding: 12px 16px;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.send-button {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    transform: none;
}

.send-button svg {
    transition: transform 0.2s ease;
}

.send-button:hover svg {
    transform: translateX(2px);
}

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}

.input-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.error-message {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
    padding: 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

@media (max-width: 640px) {
    .container {
        padding: 12px;
        max-height: 100vh;
    }

    .header {
        padding: 16px;
    }

    .avatar {
        width: 48px;
        height: 48px;
    }

    .avatar-initial {
        font-size: 20px;
    }

    .header-name {
        font-size: 18px;
    }

    .message {
        max-width: 90%;
    }

    .welcome-message {
        padding: 24px 16px;
    }

    .welcome-icon {
        width: 48px;
        height: 48px;
    }

    .welcome-message h2 {
        font-size: 18px;
    }
}
