/* AI assistant chat widget: floating launcher + panel with FAQ quick replies. */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
}

.chat-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-left: auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: var(--rr-theme-primary, #185EC8);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.chat-toggle-btn:hover,
.chat-toggle-btn:focus-visible {
    background-color: #124a9e;
    transform: scale(1.05);
}
.chat-widget.is-open .chat-toggle-btn .fa-comment-dots {
    display: none;
}
.chat-toggle-btn .fa-xmark {
    display: none;
}
.chat-widget.is-open .chat-toggle-btn .fa-xmark {
    display: block;
}

.chat-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 720px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    background: #fff;
    color: var(--rr-theme-black, #02110B);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.chat-panel[hidden] {
    display: none;
}

.chat-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    background: var(--rr-theme-primary, #185EC8);
    color: #fff;
}
.chat-panel__title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-panel__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    font-size: 16px;
}
.chat-panel__title {
    color: #fff;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}
.chat-panel__subtitle {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}
.chat-panel__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}
.chat-panel__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.chat-panel__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f6f8fb;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
}
.chat-message p {
    margin: 0;
}
.chat-message p + p {
    margin-top: 6px;
}
.chat-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}
.chat-message--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(2, 17, 11, 0.08);
    border-bottom-left-radius: 4px;
}
.chat-message--user {
    align-self: flex-end;
    background: var(--rr-theme-primary, #185EC8);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-message--user p {
    color: #fff;
}
.chat-message--typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(2, 17, 11, 0.08);
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}
.chat-message--typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(2, 17, 11, 0.35);
    animation: chat-typing-blink 1s infinite ease-in-out;
}
.chat-message--typing span:nth-child(2) {
    animation-delay: 0.15s;
}
.chat-message--typing span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes chat-typing-blink {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

.chat-panel__faq {
    flex: 0 0 auto;
    padding: 10px 18px;
    border-top: 1px solid rgba(2, 17, 11, 0.08);
    background: #fff;
}
.chat-panel__faq-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
}
.chat-faq-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 112px;
    overflow-y: auto;
}
.chat-faq-btn {
    padding: 6px 12px;
    border: 1px solid rgba(24, 94, 200, 0.3);
    border-radius: 999px;
    background: rgba(24, 94, 200, 0.06);
    color: var(--rr-theme-primary, #185EC8);
    font-size: 12.5px;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.chat-faq-btn:hover,
.chat-faq-btn:focus-visible {
    background: rgba(24, 94, 200, 0.15);
}

.chat-faq-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--rr-theme-primary, #185EC8);
    text-decoration: none;
}
.chat-faq-more:hover,
.chat-faq-more:focus-visible {
    text-decoration: underline;
}
.chat-faq-more i {
    font-size: 11px;
}

.chat-panel__footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(2, 17, 11, 0.08);
    background: #fff;
}
.chat-input {
    flex: 1 1 auto;
    height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(2, 17, 11, 0.15);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}
.chat-input:focus {
    border-color: var(--rr-theme-primary, #185EC8);
}
.chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    background: var(--rr-theme-primary, #185EC8);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
}
.chat-send-btn:hover {
    background: #124a9e;
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }
    .chat-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        height: 85vh;
        max-height: none;
        border-radius: 16px 16px 0 0;
    }
}
