.chat-widget-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: #689f38;
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 6px 16px rgba(104, 159, 56, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.chat-widget-toggle:hover {
    transform: scale(1.05);
}

.chat-widget-panel {
    position: fixed;
    right: 20px;
    bottom: 90px;
    z-index: 1050;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 130px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget-header {
    background-color: #689f38;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-widget-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-widget-subtitle {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
}

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

.chat-widget-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
}

.chat-widget-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f8f8f8;
}

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

.chat-widget-bubble-user {
    align-self: flex-end;
    background-color: #689f38;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-widget-bubble-assistant {
    align-self: flex-start;
    background-color: #fff;
    color: #212529;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.chat-widget-bubble-offtopic {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: #6c757d;
    border-bottom-left-radius: 4px;
    font-style: italic;
}

.chat-widget-bubble-error {
    align-self: center;
    background-color: #fdecea;
    color: #b42318;
    text-align: center;
    font-size: 0.8rem;
}

.chat-widget-cta {
    align-self: flex-start;
    margin-top: -4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #689f38;
    background-color: #fff;
    color: #689f38;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.chat-widget-cta:hover {
    background-color: #689f38;
    color: #fff;
}

.chat-widget-confirmation {
    align-self: flex-start;
    max-width: 90%;
    padding: 12px 14px;
    border-radius: 12px;
    background-color: #eafaf1;
    border: 1px solid #34c759;
    color: #1b6b3a;
    font-size: 0.85rem;
}

.chat-widget-confirmation .bi {
    color: #34c759;
    margin-right: 6px;
}

.chat-widget-typing {
    padding: 0 16px 8px;
    display: flex;
    gap: 4px;
    background-color: #f8f8f8;
    flex-shrink: 0;
}

.chat-widget-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #adb5bd;
    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-form {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e9ecef;
    background: #fff;
}

.chat-widget-input {
    flex: 1 1 auto;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.875rem;
    outline: none;
}

.chat-widget-input:focus {
    border-color: #689f38;
}

.chat-widget-input:disabled {
    background-color: #f1f1f1;
}

.chat-widget-send {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #689f38;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

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

@media (max-width: 420px) {
    .chat-widget-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 84px;
    }

    .chat-widget-toggle {
        right: 14px;
        bottom: 14px;
    }
}
