﻿:root {
    --primary: #019680;
    --bg: #ffffff;
    --border: #e5e7eb;
    --assistant: #f3f4f6;
    --text: #111827;
    --muted: #6b7280;
}

/* ================= RESET ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background: var(--bg);
    height: 100vh;
    color: var(--text);
}

/* ================= LAYOUT ================= */
.app {
    display: flex;
    height: 100vh;
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: 260px;
    background: #f9fafb;
    border-right: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.new-chat {
    display: block;
    text-align: center;
    text-decoration: none;
    background: #ffffff;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

    .new-chat:hover {
        background: #e6f6f3;
    }

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 2px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-weight: 600;
}

    .chat-item a {
        display: block;
        padding: 10px 12px;
        border-radius: 8px;
        text-decoration: none;
        color: #065f55;
        font-size: 14px;
        transition: background 0.15s;
    }

    .chat-item.active,
    .chat-item:hover {
        background: #e6f6f3;
    }

/* ================= CHAT ================= */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ================= MESSAGES ================= */
.messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ================= MESSAGE ================= */
.message {
    display: flex;
    width: 100%;
}

    .message.user {
        justify-content: flex-end;
    }

    .message.assistant {
        justify-content: flex-start;
    }

/* ================= BUBBLE ================= */
.bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 14px;
    line-height: 1.65;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Colors */
.message.user .bubble {
    background: var(--primary);
    color: #ffffff;
    border-bottom-right-radius: 6px;
}

.message.assistant .bubble {
    background: var(--assistant);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

/* ================= MARKDOWN ================= */
.bubble p {
    margin: 6px 0;
}

.bubble ul {
    padding-left: 18px;
    margin: 8px 0;
}

.bubble li {
    margin-bottom: 6px;
}

.bubble strong {
    font-weight: 600;
}

/* Code block */
.bubble pre {
    background: #0f172a;
    color: #e5e7eb;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
}

.bubble code {
    font-family: Consolas, monospace;
}

/* ================= INPUT ================= */
.input-area {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: #f9fafb;
}

    .input-area form {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .input-area input {
        flex: 1;
        background: #ffffff;
        border: 1px solid var(--border);
        color: var(--text);
        padding: 14px;
        border-radius: 10px;
        outline: none;
        font-size: 15px;
    }

        .input-area input:focus {
            border-color: var(--primary);
        }

    .input-area button {
        background: var(--primary);
        border: none;
        color: #ffffff;
        padding: 0 18px;
        height: 46px;
        border-radius: 10px;
        cursor: pointer;
        font-size: 18px;
        transition: opacity 0.2s;
    }

        .input-area button:hover {
            opacity: 0.9;
        }

/* ================= MOBILE ================= */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .messages {
        padding: 14px;
    }

    .bubble {
        max-width: 85%;
    }
}

/* ================= ANIMATION ================= */
.message.assistant .bubble {
    animation: fadeIn 0.25s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
