/* Baha Builder — public site live chat widget (visitor <-> platform admin) */
.baha-visitor-chat-toggle {
    position: fixed;
    left: 22px;
    bottom: 96px;
    z-index: 9700;
    border: 0;
    border-radius: 50%;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #1d4ed8, #7c3aed);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(29, 78, 216, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.baha-visitor-chat-toggle:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 16px 36px rgba(29, 78, 216, 0.5);
}

.baha-visitor-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font: 700 12px/20px Arial, sans-serif;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.baha-visitor-chat-badge[hidden] {
    display: none;
}

.baha-visitor-chat-panel {
    position: fixed;
    left: 22px;
    bottom: 166px;
    z-index: 9701;
    width: min(380px, calc(100vw - 32px));
    max-height: min(560px, 72vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
    border: 1px solid #e5e7eb;
    font-family: Arial, sans-serif;
}

.baha-visitor-chat-panel[hidden] {
    display: none;
}

.baha-visitor-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1d4ed8, #7c3aed);
    color: #fff;
}

.baha-visitor-chat-header-title {
    flex: 1;
    min-width: 0;
}

.baha-visitor-chat-header-title strong {
    display: block;
    font-size: 15px;
}

.baha-visitor-chat-header-title span {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}

.baha-visitor-chat-close {
    border: 0;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.baha-visitor-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.baha-visitor-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    min-height: 220px;
}

.baha-visitor-chat-empty {
    margin: auto;
    text-align: center;
    color: #64748b;
    font-size: 13.5px;
    line-height: 1.7;
    padding: 12px;
}

.baha-visitor-chat-bubble {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.baha-visitor-chat-bubble.admin {
    align-self: flex-start;
    background: #eef2ff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.baha-visitor-chat-bubble.visitor {
    align-self: flex-end;
    background: #1d4ed8;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.baha-visitor-chat-time {
    display: block;
    margin-top: 4px;
    font-size: 10.5px;
    opacity: 0.65;
}

.baha-visitor-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.baha-visitor-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    resize: none;
    max-height: 90px;
    outline: none;
}

.baha-visitor-chat-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.baha-visitor-chat-send {
    border: 0;
    border-radius: 10px;
    background: #1d4ed8;
    color: #fff;
    padding: 0 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.baha-visitor-chat-send:hover {
    background: #1e40af;
}

.baha-visitor-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .baha-visitor-chat-toggle {
        left: 14px;
        bottom: 110px;
        width: 52px;
        height: 52px;
    }

    .baha-visitor-chat-panel {
        left: 12px;
        right: 12px;
        bottom: 172px;
        width: auto;
        max-height: 68vh;
    }
}
