/* ===  HopeBot chat — warm, inviting palette  === */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #f5f0eb;
    color: #2c2c2c;
}

/* --- Title area --- */
.title-area {
    text-align: center;
    margin: 12px 0 8px;
}
.title-area h2 {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b3024;
    margin: 0 0 4px;
}
.title-area .subtitle {
    font-size: 0.82rem;
    color: #7a6e60;
}
.title-area .subtitle a {
    color: #6b7fa3;
    text-decoration: none;
}
.title-area .subtitle a:hover {
    text-decoration: underline;
}

/* --- Chat container --- */
#chat-box {
    width: 92%;
    max-width: 640px;
    height: 58vh;
    border: 1px solid #ddd5ca;
    background-color: #faf8f5;
    overflow-y: auto;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(60, 48, 36, 0.08);
    margin-bottom: 12px;
    border-radius: 12px;
}

/* --- Messages (shared) --- */
#chat-box p, #chat-box .message {
    margin: 6px 0;
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 82%;
    line-height: 1.5;
    font-size: 0.94rem;
    position: relative;
}
#chat-box p.user,
#chat-box .message.user {
    background: linear-gradient(135deg, #5b7fa5, #4a6d8c);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

/* --- User reply (label + body) --- */
#chat-box .message.user.user-reply {
    margin: 6px 0;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    max-width: 82%;
    position: relative;
}
#chat-box .msg-label {
    margin-bottom: 4px;
    font-weight: 600;
}
#chat-box .msg-body {
    font-size: 0.94rem;
    line-height: 1.5;
    white-space: pre-wrap;
}
#chat-box p.bot,
#chat-box .message.bot {
    background-color: #eee8df;
    color: #2c2c2c;
    border-bottom-left-radius: 4px;
}

/* --- Hope reply (markdown-rendered) --- */
#chat-box .message.bot.hope-reply {
    margin: 6px 0;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 82%;
    background-color: #eee8df;
    position: relative;
}
#chat-box .hope-label {
    margin-bottom: 4px;
    font-weight: 600;
    color: #3b3024;
}
#chat-box .hope-md {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.55;
}
#chat-box .hope-md p:first-child { margin-top: 0; }
#chat-box .hope-md p:last-child  { margin-bottom: 0; }
#chat-box .hope-md blockquote {
    margin: 0.5em 0;
    padding: 0.45em 0.85em;
    border-left: 3px solid #b0a08a;
    background: #f5f0eb;
    color: #3b3024;
    font-style: italic;
}
#chat-box .hope-md ul,
#chat-box .hope-md ol {
    margin: 0.35em 0;
    padding-left: 1.35em;
}
#chat-box .hope-md code {
    font-size: 0.92em;
    background: #e0d8ce;
    padding: 0.05em 0.25em;
    border-radius: 3px;
}
#chat-box .hope-md pre {
    margin: 0.5em 0;
    padding: 8px;
    overflow-x: auto;
    background: #e8e0d6;
    border-radius: 6px;
    font-size: 0.9em;
}

/* --- Copy button on individual messages --- */
.share-msg-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #7a6e60;
    line-height: 1;
    width: auto;
    font-family: 'Inter', system-ui, sans-serif;
}
.share-msg-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #3b3024;
}
#chat-box .message.user .share-msg-btn {
    color: rgba(255,255,255,0.6);
}
#chat-box .message.user .share-msg-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}
#chat-box p:hover .share-msg-btn,
#chat-box .message:hover .share-msg-btn {
    opacity: 1;
}
.share-msg-btn.copied {
    opacity: 1;
    color: #5a8a5a;
}

/* --- Thinking indicator --- */
#chat-box p.thinking .thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 4px;
    vertical-align: middle;
}
#chat-box p.thinking .thinking-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #8a7e70;
    animation: thinking-bounce 1.1s ease-in-out infinite;
    opacity: 0.55;
}
#chat-box p.thinking .thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}
#chat-box p.thinking .thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes thinking-bounce {
    0%, 70%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    35% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* --- Input area --- */
#user-input {
    width: 92%;
    max-width: 640px;
    height: 60px;
    padding: 12px 14px;
    box-shadow: 0 1px 6px rgba(60, 48, 36, 0.08);
    border: 1px solid #ddd5ca;
    border-radius: 10px;
    margin-bottom: 10px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.94rem;
    background: #faf8f5;
    color: #2c2c2c;
    resize: none;
}
#user-input:focus {
    outline: none;
    border-color: #5b7fa5;
    box-shadow: 0 0 0 2px rgba(91, 127, 165, 0.2);
}
#user-input::placeholder {
    color: #a89e90;
}

/* --- Send button --- */
.btn-send {
    width: 92%;
    max-width: 640px;
    padding: 13px;
    background: linear-gradient(135deg, #5b7fa5, #4a6d8c);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(74, 109, 140, 0.25);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s;
}
.btn-send:hover {
    background: linear-gradient(135deg, #4a6d8c, #3d5e7a);
    box-shadow: 0 3px 12px rgba(74, 109, 140, 0.35);
}
.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Action bar (New Topic, Forget Me, Share) --- */
.action-bar {
    margin-top: 10px;
    margin-bottom: 16px;
    text-align: center;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-action {
    display: inline-block;
    width: auto;
    padding: 9px 18px;
    background: #eee8df;
    color: #3b3024;
    border: 1px solid #ddd5ca;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
    box-shadow: none;
}
.btn-action:hover {
    background: #e4dcd0;
}

/* --- Toast notification --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #3b3024;
    color: #faf8f5;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Inter', system-ui, sans-serif;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 1000;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
