/* QS Chatbot Widget */
.qs-chatbot-wrap {
    --qs-primary: #c8a96e;
    --qs-primary-dark: #a8894e;
    --qs-bg: #ffffff;
    --qs-bg-dark: #f4f4f5;
    --qs-text: #1a1a2e;
    --qs-text-light: #6b7280;
    --qs-radius: 16px;
    --qs-chat-height: 480px;

    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    height: var(--qs-chat-height);
    border-radius: var(--qs-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    overflow: hidden;
    background: var(--qs-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
}

/* Header */
.qs-chatbot-header {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px 20px !important;
    background: #c8a96e !important;
    color: #fff !important;
}

.qs-chatbot-avatar {
    font-size: 24px;
    line-height: 1;
}

.qs-chatbot-header-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.qs-chatbot-header-info strong {
    font-size: 15px;
    font-weight: 600;
}

.qs-chatbot-status {
    font-size: 12px;
    opacity: .85;
}

.qs-chatbot-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* Messages area */
.qs-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--qs-bg);
}

.qs-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
.qs-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.qs-chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* Message bubbles */
.qs-chatbot-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.qs-chatbot-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.5;
    word-break: break-word;
}

.qs-chatbot-block {
    margin: 0;
}

.qs-chatbot-block + .qs-chatbot-block {
    margin-top: 10px;
}

.qs-chatbot-block--list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.qs-chatbot-block--list li {
    margin: 0;
}

.qs-chatbot-block--question {
    font-weight: 500;
}

.qs-chatbot-bubble a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.qs-chatbot-msg--bot {
    align-self: flex-start;
}

.qs-chatbot-msg--bot .qs-chatbot-bubble {
    background: var(--qs-bg-dark);
    color: var(--qs-text);
    border-bottom-left-radius: 4px;
}

.qs-chatbot-msg--user {
    align-self: flex-end;
}

.qs-chatbot-msg--user .qs-chatbot-bubble {
    background: var(--qs-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.qs-chatbot-msg--error .qs-chatbot-bubble {
    background: #fee2e2;
    color: #dc2626;
    border-bottom-left-radius: 4px;
}

.qs-chatbot-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-left: 4px;
    color: var(--qs-text-light);
    font-size: 12px;
}

.qs-chatbot-feedback__label {
    white-space: nowrap;
}

.qs-chatbot-feedback__buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qs-chatbot-feedback__btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: var(--qs-text);
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s;
    padding: 0;
    line-height: 1;
}

.qs-chatbot-feedback__btn:hover {
    border-color: var(--qs-primary);
    background: #f8f4ec;
}

.qs-chatbot-feedback__btn:disabled {
    cursor: wait;
    opacity: .7;
}

.qs-chatbot-feedback__btn.is-active {
    background: var(--qs-primary);
    border-color: var(--qs-primary);
    color: #fff;
}

.qs-chatbot-feedback__status {
    color: var(--qs-text-light);
}

/* Typing indicator */
.qs-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 20px;
    height: 36px;
}

.qs-chatbot-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #c8a96e;
    border-radius: 50%;
    animation: qs-bounce 1.2s infinite ease-in-out;
}

.qs-chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.qs-chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes qs-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: .5; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* Form */
.qs-chatbot-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: var(--qs-bg);
}

.qs-chatbot-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    color: var(--qs-text);
    background: var(--qs-bg-dark);
}

.qs-chatbot-input:focus {
    border-color: var(--qs-primary);
    background: #fff;
}

.qs-chatbot-send {
    flex-shrink: 0 !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    border: none !important;
    background: #c8a96e !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background .2s, transform .15s;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.qs-chatbot-send:hover { background: #a8894e !important; }
.qs-chatbot-send:active { transform: scale(.93); }
.qs-chatbot-send:disabled {
    opacity: .5 !important;
    cursor: not-allowed !important;
}

/* Mobile */
@media (max-width: 600px) {
    .qs-chatbot-wrap {
        max-width: 100%;
        border-radius: 0;
        height: 70vh;
    }
}
