/* ═══════════════════════════════════════════════
   8ing.com — Chat Onboarding Styles
   Clean, modern chat interface with personality.
   ═══════════════════════════════════════════════ */

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-hover: #242424;
    --border: #2a2a2a;
    --text: #e4e4e4;
    --text-muted: #888;
    --accent: #6c5ce7;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --bot-bubble: #1e1e2e;
    --user-bubble: #2d2049;
    --success: #00d2a0;
    --warning: #ffa940;
    --error: #ff4d4f;
    --radius: 16px;
    --radius-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

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

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

/* ═══ Layout ═══ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

/* ═══ Header ═══ */

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.chat-header .logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
}

.chat-header .title {
    font-weight: 600;
    font-size: 16px;
}

.chat-header .subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-header .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-left: 4px;
    animation: pulse 2s ease-in-out infinite;
}

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

/* ═══ Messages ═══ */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    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: 2px;
}

/* Message bubbles */

.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: slideIn 0.3s ease-out;
}

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

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

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

.message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.message.bot .avatar {
    background: var(--accent);
    color: #fff;
}

.message.user .avatar {
    background: #3a3a4a;
    color: var(--text-muted);
}

.message .bubble {
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.55;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
}

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

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

/* Typing indicator */

.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* ═══ Input ═══ */

.chat-input-area {
    padding: 12px 20px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: border-color 0.2s;
}

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

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

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

.send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    font-size: 16px;
}

.send-button:hover {
    background: #7c6ff7;
    transform: scale(1.05);
}

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

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

/* ═══ Terminal state ═══ */

.terminal-state {
    text-align: center;
    padding: 40px 20px;
}

.terminal-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.terminal-state h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.terminal-state p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.terminal-state .action-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 24px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.terminal-state .action-link:hover {
    background: #7c6ff7;
}

/* ═══ Mobile ═══ */

@media (max-width: 600px) {
    .chat-container {
        max-width: 100%;
    }

    .message {
        max-width: 92%;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-messages {
        padding: 14px;
    }

    .chat-input-area {
        padding: 10px 14px 16px;
    }
}
