/**
 * Keybuki Preboarding Chat Widget – Styling
 */

/* ─── Chat Bubble ─────────────────────────────── */

#preboarding-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C73178, #d4457f);
    color: white;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(199, 49, 120, 0.4);
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s;
}

#preboarding-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(199, 49, 120, 0.5);
}

#preboarding-chat-bubble .material-icons {
    font-size: 26px;
}

#chat-bubble-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
}

/* ─── Chat Window ─────────────────────────────── */

#preboarding-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Header ──────────────────────────────────── */

#chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #C73178, #d4457f);
    color: white;
    flex-shrink: 0;
}

#chat-header-title {
    font-weight: 600;
    font-size: 15px;
}

#chat-header-status {
    font-size: 12px;
    opacity: 0.8;
}

#chat-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

#chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─── Messages Area ───────────────────────────── */

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background: #FAF9F6;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ─── Message Bubbles ─────────────────────────── */

div.chat-msg {
    display: block !important;
    max-width: 75%;
    margin-bottom: 8px;
    clear: both;
}

div.chat-msg-own {
    margin-left: auto;
    margin-right: 0;
}

div.chat-msg-other {
    margin-left: 0;
    margin-right: auto;
}

.chat-msg-sender {
    font-size: 11px;
    font-weight: 600;
    color: #C73178;
    margin-bottom: 1px;
    padding: 0 2px;
}

div.chat-msg-bubble {
    display: block !important;
    padding: 6px 7px 4px 9px;
    border-radius: 7.5px;
    font-size: 14.2px;
    line-height: 19px;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-align: left !important;
    box-sizing: border-box;
}

div.chat-msg-own div.chat-msg-bubble {
    background: rgb(255, 217, 241);
    color: #111;
    border-top-right-radius: 0;
}

div.chat-msg-other div.chat-msg-bubble {
    background: #fff;
    color: #111;
    border-top-left-radius: 0;
}

/* Zeit + Haken: eigene Zeile, rechts, innerhalb Bubble */
div.chat-msg-footer {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 1px;
    height: 18px;
}

.chat-msg-time {
    font-size: 11px;
    color: #999;
    line-height: 1;
}

.chat-msg-check .material-icons {
    font-size: 16px;
    vertical-align: middle;
}

/* ─── Input Area ──────────────────────────────── */

#chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid #e5e7eb;
    background: #f0f0f0;
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 21px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: white;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #C73178;
}

#chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #C73178, #d4457f);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
    flex-shrink: 0;
}

#chat-send-btn:hover {
    transform: scale(1.08);
}

#chat-send-btn .material-icons {
    font-size: 20px;
}

/* ─── Mobile ──────────────────────────────────── */

@media (max-width: 768px) {
    #preboarding-chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 8px;
        border-radius: 12px;
    }

    #preboarding-chat-bubble {
        bottom: 16px;
        right: 16px;
    }
}