﻿/* ============================================================
   ChatBook — Complete Responsive + Functional UI
   ============================================================ */

.chatbook {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    background: #f0f2f5;
    overflow: hidden;
    box-sizing: border-box;
    font-family: "Segoe UI", sans-serif;
}

/* HEADER */
.chatbook-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #2a3942;
    color: #fff;
    border-bottom: 1px solid #222;
}

.chatbook-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    color: #2a3942;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.chatbook-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.status {
    font-size: 13px;
    color: #b9c1c7;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
}

    .status-dot.connected {
        background: #4caf50
    }

    .status-dot.disconnected {
        background: #d32f2f
    }

/* MESSAGES */
.chatbook-messages {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #111b21;
    scroll-behavior: smooth;
}

.bubble {
    position: relative;
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 14px;
    word-wrap: break-word;
    margin: 6px 0;
    line-height: 1.3;
    font-size: 15px;
}

    .bubble.me {
        align-self: flex-end;
        background-color: #005c4b;
        color: #e9edef;
        border-top-right-radius: 2px;
    }

    .bubble.them {
        align-self: flex-start;
        background-color: #1f2c33;
        color: #e9edef;
        border-top-left-radius: 2px;
    }

/*.meta {
    font-size: 11px;
    color: #8696a0;
    margin-top: 4px;
    text-align: right;
}
*/
.meta {
    font-size: 12px;
    color: #8696a0;
    margin-top: 3px;
    text-align: right;
}


/* BUBBLE ACTIONS (edit/delete on hover) */
.bubble-actions {
    position: absolute;
    top: -6px;
    right: -6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s ease;
}

.bubble:hover .bubble-actions {
    opacity: 0.95;
}

.bubble-actions .tool {
    background: transparent;
    border: none;
    color: #e9edef;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    transition: transform .15s;
}

    .bubble-actions .tool:hover {
        transform: scale(1.15)
    }

/* REACTIONS & REACTION BAR */
.reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.reaction-item {
    background: #2a3942;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 14px;
    color: #e9edef;
    cursor: pointer;
}

    .reaction-item:hover {
        transform: scale(1.05)
    }

.reaction-bar {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.reaction-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.8;
    color: #e9edef;
    transition: transform .12s, opacity .12s;
}

    .reaction-btn:hover {
        transform: scale(1.2);
        opacity: 1
    }

/* FOOTER */
.chatbook-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #202c33;
    border-top: 1px solid #2a3942;
}

.msg-input {
    flex: 1;
    border-radius: 20px;
    border: none;
    background: #2a3942;
    padding: 10px 14px;
    color: #e9edef;
    outline: none;
}

    .msg-input::placeholder {
        color: #7c8a92
    }

.send {
    background-color: #0084ff;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    cursor: pointer;
}

/* EMOJI PICKER */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 10px;
    background: #2a3942;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 260px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

    .emoji-picker .tool {
        background: transparent;
        border: none;
        font-size: 18px;
        cursor: pointer;
        opacity: 0.9;
    }

        .emoji-picker .tool:hover {
            transform: scale(1.2);
            opacity: 1
        }

/* SCROLL DOWN BUTTON */
.scroll-down-btn {
    position: absolute;
    right: 16px;
    bottom: 80px;
    background: #0084ff;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    z-index: 20;
    opacity: .95;
    transition: .15s;
}

    .scroll-down-btn:hover {
        transform: translateY(-2px)
    }

/* TYPING */
.typing-indicator {
    padding: 6px 12px;
    font-style: italic;
    font-size: 13px;
    color: #ccc;
    text-align: center;
}

/* SCROLLBAR */
.chatbook-messages::-webkit-scrollbar {
    width: 8px
}

.chatbook-messages::-webkit-scrollbar-thumb {
    background: #2a3942;
    border-radius: 4px
}

    .chatbook-messages::-webkit-scrollbar-thumb:hover {
        background: #3a4c54
    }

/* MEDIA */
@media (max-width:600px) {
    .chatbook-header, .chatbook-footer {
        padding: 8px
    }

    .msg-input {
        font-size: 14px
    }

    .bubble {
        font-size: 14px
    }
}
/* ================= DATE SEPARATOR ================= */
.date-separator {
    align-self: center;
    margin: 12px 0;
    padding: 4px 12px;
    background: #2a3942;
    color: #e9edef;
    font-size: 13px;
    border-radius: 12px;
    opacity: 0.85;
    text-align: center;
}
.empty-state {
    text-align: center;
    color: #8696a0;
    font-style: italic;
    margin: auto;
}
.bubble.system {
    align-self: center;
    background: transparent;
    color: #9aa5ac;
    font-style: italic;
    font-size: 13px;
    text-align: center;
    box-shadow: none;
}
