/* ==========================================
   Tasklyn Chat Styles - EXACT MATCH
   Bot bubble: soft lavender on periwinkle bg
   User bubble: dark navy pill
   Input: white pill capsule at bottom
   ========================================== */

/* Chat Layout */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    max-width: 95%;
    margin: 0 auto;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Message rows */
.message {
    max-width: 85%;
    display: flex;
    gap: 0.8rem;
    animation: fadeIn 0.3s ease;
}

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

/* Avatars */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    flex-shrink: 0;
}

/* Bot avatar: soft periwinkle gray */
.avatar-bot {
    background: #e8eaf6;
    color: var(--text-secondary);
    border: 1px solid #d8daf0;
}

/* User avatar: dark navy — matches active nav pill */
.avatar-user {
    background: var(--nav-active-bg);
    color: #ffffff;
}

/* ==========================================
   BUBBLES — KEY ELEMENT
   Bot: white card (Tasklyn "Chat" panel style)
   User: dark navy (same as nav active pill)
   ========================================== */

/* Bot bubble: pure white card, like Tasklyn's chat messages */
.bubble {
    background: #1e293b;
    border: none;
    border-radius: 20px;
    border-top-left-radius: 5px;
    padding: 0.9rem 1.25rem;
    line-height: 1.6;
    font-size: 0.9rem;
    color: #f1f5f9;
    box-shadow: var(--shadow-card);
}

/* User bubble: exact match — Tasklyn purple pill bubble (#ede8f7) */
.message-user .bubble {
    background: rgba(139, 125, 216, 0.25);
    color: #f1f5f9;
    border-radius: 20px;
    border-top-right-radius: 5px;
    border: none;
    box-shadow: 0 2px 12px rgba(100, 80, 180, 0.12);
    font-weight: 500;
}

/* Markdown within bubbles */
.bubble p { margin-bottom: 0.65rem; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin-left: 1.2rem; margin-bottom: 0.65rem; }
.bubble li { margin-bottom: 0.2rem; }

/* Links inside bubbles */
.bubble a {
    color: #64b5f6;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.18s ease;
}
.bubble a:hover {
    color: #90caf9;
}
.bubble strong { font-weight: 700; }
.bubble code {
    background: rgba(255, 255, 255, 0.07);
    padding: 0.15rem 0.4rem;
    border-radius: 5px;
    font-size: 0.85em;
}
.bubble h1, .bubble h2, .bubble h3 {
    font-family: var(--font-heading);
    margin: 0.75rem 0 0.4rem;
    font-weight: 700;
}

/* Sources */
.sources-wrapper {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid #e8eaf0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.source-tag {
    background: rgba(93, 200, 168, 0.15);
    border: 1px solid rgba(93, 200, 168, 0.2);
    color: #7dd4b8;
    font-size: 0.7rem;
    padding: 0.18rem 0.55rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
}

/* ==========================================
   INPUT CAPSULE — floating white pill at bottom
   Exact match to Tasklyn
   ========================================== */
.input-area {
    padding: 0.9rem 2rem 1.5rem;
    background: transparent;
}

.input-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    padding: 0.55rem 0.6rem 0.55rem 1.2rem;
    box-shadow: 0 6px 24px rgba(60, 65, 120, 0.1);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.input-wrapper:focus-within {
    border-color: #b8b0e8;
    box-shadow: 0 8px 28px rgba(60, 65, 120, 0.15);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    height: 24px;
    max-height: 120px;
    line-height: 1.4;
}

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

/* Send button: dark navy circle — exact Tasklyn match */
.send-btn {
    background: var(--nav-active-bg);
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.18s ease;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(28, 25, 66, 0.3);
}

.send-btn:hover { transform: scale(1.05); box-shadow: 0 5px 16px rgba(28, 25, 66, 0.4); }

.send-btn:disabled {
    background: #cdd0e8;
    color: #9a9db8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
