.chat-widget-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #4a6cf7;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 1050;
}

.chat-widget-bubble:hover {
    background-color: #3a5ce4;
}

.chat-widget-panel {
    position: fixed;
    right: 24px;
    bottom: 92px;
    width: 340px;
    max-width: 92vw;
    height: 480px;
    max-height: 70vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1050;
}

.chat-widget-header {
    background-color: #4a6cf7;
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-widget-reset {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.chat-widget-reset:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-widget-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.chat-widget-key-form {
    padding: 14px;
    font-size: 13px;
    color: #333;
}

.chat-widget-error {
    color: #d9534f;
    font-size: 12px;
    margin-top: 6px;
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background-color: #f4f6fb;
}

.chat-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-line;
}

.chat-bubble-user {
    background-color: #4a6cf7;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.chat-bubble-assistant {
    background-color: #fff;
    color: #333;
    border: 1px solid #e2e5ec;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.chat-widget-provenance {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e2e5ec;
    font-size: 11px;
    line-height: 1.35;
    color: #8a8f9c;
    white-space: normal;
}

.chat-widget-provenance div + div {
    margin-top: 2px;
}

.chat-widget-flag {
    margin-top: 6px;
    font-size: 11px;
    white-space: normal;
}

.chat-widget-flag-link {
    color: #c0392b;
}

.chat-widget-flag-done {
    color: #2e7d32;
}

.chat-widget-flag-error {
    color: #c0392b;
    margin-top: 4px;
}

.chat-widget-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}

.chat-widget-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #9aa3b5;
    animation: chat-widget-typing-bounce 1.2s infinite ease-in-out;
}

.chat-widget-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-widget-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chat-widget-typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-widget-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: -2px 0 10px;
}

.chat-widget-option-btn {
    background-color: #fff;
    border: 1px solid #4a6cf7;
    color: #4a6cf7;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

.chat-widget-option-btn:hover {
    background-color: #4a6cf7;
    color: #fff;
}

.chat-widget-option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-widget-option-btn:disabled:hover {
    background-color: #fff;
    color: #4a6cf7;
}

.chat-widget-input-area {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid #e2e5ec;
    flex-shrink: 0;
}

.chat-widget-input-area input {
    flex: 1;
}

@media (max-width: 480px) {
    .chat-widget-panel {
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
    }

    .chat-widget-bubble {
        right: 16px;
        bottom: 16px;
    }
}
