/* Customer chat bubble - bottom-right floating widget */
.cb-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 99999; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }

.cb-toggle {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; border: none; cursor: pointer;
    box-shadow: 0 6px 22px rgba(37, 99, 235, .42);
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; position: relative;
    transition: transform .15s, box-shadow .15s;
}
.cb-toggle:hover { transform: scale(1.05); box-shadow: 0 6px 22px rgba(37, 99, 235, .5); }
.cb-toggle .cb-unread {
    position: absolute; top: -4px; right: -4px;
    background: #ef4444; color: #fff;
    border-radius: 50%; min-width: 24px; height: 24px;
    font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    padding: 0 6px; border: 2px solid #fff;
}
.cb-toggle .cb-unread.hidden { display: none; }

.cb-panel {
    position: absolute; right: 0; bottom: 88px;
    width: 380px; height: 540px; max-height: calc(100vh - 110px);
    background: #fff; border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,.22);
    display: none; flex-direction: column; overflow: hidden;
}
.cb-panel.open { display: flex; animation: cbOpen .18s ease-out; }
@keyframes cbOpen { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.cb-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
}
.cb-header .cb-title { font-weight: 700; font-size: 15px; }
.cb-header .cb-sub { font-size: 11px; opacity: .9; margin-top: 2px; }
.cb-header .cb-close {
    background: transparent; border: none; color: #fff;
    font-size: 24px; cursor: pointer; line-height: 1;
    padding: 0 6px; opacity: .85;
}
.cb-header .cb-close:hover { opacity: 1; }

.cb-body {
    flex: 1; overflow-y: auto; padding: 12px;
    background: #f3f4f6;
    display: flex; flex-direction: column; gap: 5px;
}
.cb-msg {
    max-width: 80%; padding: 8px 12px; border-radius: 14px;
    font-size: 13.5px; line-height: 1.4;
    word-wrap: break-word; white-space: pre-wrap;
}
.cb-msg.customer {
    background: #2563eb; color: #fff;
    align-self: flex-end; border-bottom-right-radius: 4px;
}
.cb-msg.admin {
    background: #fff; color: #111;
    align-self: flex-start;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.cb-msg .cb-ts { font-size: 10px; opacity: .65; margin-top: 3px; }
.cb-welcome { color: #6b7280; font-size: 12.5px; text-align: center; padding: 20px 10px; }

.cb-msg.cb-msg-image {
    padding: 4px;
    background: transparent !important;
    border: none !important;
    max-width: 75%;
}
.cb-img {
    max-width: 100%; max-height: 240px;
    border-radius: 10px;
    display: block;
    cursor: zoom-in;
    border: 1px solid rgba(0,0,0,.08);
}
.cb-msg.customer .cb-img { border-color: rgba(255,255,255,.4); }
.cb-msg.cb-msg-image .cb-ts { margin-top: 4px; padding: 0 4px; text-align: right; }

.cb-name {
    padding: 14px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex; flex-direction: column; gap: 8px;
}
.cb-name label { font-size: 12.5px; color: #4b5563; }
.cb-name input {
    width: 100%; padding: 9px 11px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; outline: none;
}
.cb-name input:focus { border-color: #2563eb; }
.cb-name button {
    width: 100%; background: #2563eb; color: #fff;
    border: none; padding: 9px; border-radius: 6px;
    cursor: pointer; font-weight: 600; font-size: 14px;
}
.cb-name button:hover { background: #1d4ed8; }

.cb-composer {
    display: flex; padding: 10px; gap: 6px;
    background: #fff; border-top: 1px solid #e5e7eb;
    align-items: center;
}
.cb-attach {
    width: 38px; height: 38px;
    flex-shrink: 0;
    background: #f3f4f6;
    color: #2563eb;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    font-size: 17px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.cb-attach:hover:not(:disabled) { background: #e5e7eb; }
.cb-attach:disabled { opacity: .6; cursor: wait; }
.cb-composer input {
    flex: 1; padding: 10px 14px;
    border: 1px solid #d1d5db; border-radius: 20px;
    outline: none; font-size: 14px;
}
.cb-composer input:focus { border-color: #2563eb; }
.cb-composer button {
    padding: 8px 16px; background: #2563eb; color: #fff;
    border: none; border-radius: 20px;
    cursor: pointer; font-weight: 600; font-size: 14px;
}
.cb-composer button:disabled { background: #cbd5e1; cursor: not-allowed; }

.cb-typing { padding: 4px 14px 0; font-size: 11px; color: #6b7280; font-style: italic; }
.cb-typing.hidden { display: none; }

@media (max-width: 480px) {
    .cb-wrap { right: 14px; bottom: 14px; }
    .cb-panel { width: calc(100vw - 28px); height: 78vh; bottom: 80px; right: 0; }
    .cb-toggle { width: 64px; height: 64px; font-size: 30px; }
}
