.faq-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
    font-family: inherit;
}

.faq-chat-toggle {
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    background: linear-gradient(135deg, #62a6fa, #a882f9);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.faq-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.faq-chat-toggle-icon {
    font-size: 26px;
    line-height: 1;
}

.faq-chat-panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: min(380px, calc(100vw - 24px));
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.faq-chat-panel.is-open {
    display: flex;
}

.faq-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: #f7f8fc;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.faq-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.faq-chat-avatar {
    width: 86px;
    height: 86px;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.faq-chat-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.faq-chat-header-text strong {
    font-size: 15px;
    color: #1f2430;
}

.faq-chat-header-text small {
    font-size: 12px;
    color: #667085;
}

.faq-chat-close {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.faq-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fcfcfe;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-message {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.faq-message-user {
    align-self: flex-end;
    background: #dfeaff;
    color: #223049;
    border-bottom-right-radius: 6px;
}

.faq-message-bot {
    align-self: flex-start;
    background: #f1f2f7;
    color: #222b38;
    border-bottom-left-radius: 6px;
}

.faq-message-text {
    white-space: pre-line;
}

.faq-message-link-container {
    margin-top: 8px;
}

.faq-message-link-container a {
    color: #3557d6;
    text-decoration: none;
    font-weight: 600;
}

.faq-message-link-container a:hover {
    text-decoration: underline;
}

.faq-chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    position: relative;
}

.faq-chat-input-wrapper {
    min-width: 0;
    width: 100%;
    position: relative;
}

.faq-chat-submit-wrapper {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
}

#faqChatInput,
.faq-chat-input-wrapper input,
.faq-chat-form input[type="text"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    margin: 0;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    background: #ffffff;
    color: #1f2430;
    appearance: none;
    -webkit-appearance: none;
    position: static;
    float: none;
    transform: none;
}

#faqChatInput::placeholder,
.faq-chat-input-wrapper input::placeholder,
.faq-chat-form input[type="text"]::placeholder {
    color: #98a2b3;
    opacity: 1;
}

#faqChatInput:focus,
.faq-chat-input-wrapper input:focus,
.faq-chat-form input[type="text"]:focus {
    border-color: #9dbbff;
    box-shadow: 0 0 0 3px rgba(157, 187, 255, 0.18);
}

.faq-chat-submit-wrapper button,
.faq-chat-form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 110px;
    height: auto;
    margin: 0;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: #2f67ff;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
    position: static;
    inset: auto;
    float: none;
    transform: none;
    flex: 0 0 auto;
}

@media (max-width: 576px) {
    .faq-chat-widget {
        right: 12px;
        bottom: 12px;
    }

    .faq-chat-panel {
        width: calc(100vw - 24px);
        height: 72vh;
        bottom: 74px;
    }

    .faq-chat-toggle {
        width: 58px;
        height: 58px;
    }

    .faq-chat-submit-wrapper button,
    .faq-chat-form button[type="submit"] {
        min-width: 96px;
    }
}