/* ===== Live chat widget =====
   Floating launcher bottom-right + sliding panel.
   Self-contained — no theme dependency. */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1080;
    font-family: inherit;
}

.chat-launcher {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    position: relative;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.22); }

.chat-launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    padding: 4px 6px;
    min-width: 20px;
    text-align: center;
}

.chat-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatPop .15s ease-out;
}
@keyframes chatPop {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
}
.chat-header .chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.chat-status { font-size: 11px; opacity: .85; }
.chat-status.live { color: #d1fae5; }
.chat-status.offline { color: #fecaca; }

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}
.chat-prechat { background: #fff; }
.chat-thread  { background: #f8fafc; }

.chat-messages { display: flex; flex-direction: column; gap: 8px; }

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
    font-size: 13px;
}
.chat-msg.visitor { background: #4f46e5; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg.agent   { background: #fff; color: #111827; align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid #e5e7eb; }
.chat-msg.bot     { background: #e0e7ff; color: #312e81; align-self: flex-start; border-bottom-left-radius: 4px; font-style: italic; }
.chat-msg-meta { font-size: 10px; color: #6b7280; margin-top: 2px; }
.chat-msg.visitor + .chat-msg-meta { text-align: right; }

.chat-composer {
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
}
.chat-composer textarea {
    resize: none;
    max-height: 100px;
}
