.ai-chat-widget {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    left: auto !important;
    top: auto !important;
    z-index: 999999 !important;
    direction: rtl;
    font-family: inherit;

    width: auto;
    height: auto;
}

.ai-chat-toggle {
    position: relative;
    border: none;
    background: linear-gradient(to right, #56ccf2, #2f80ed) !important;
    color: #fff;
    padding: 12px 18px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e11d48 !important;
    color: #fff !important;
    border: 2px solid #fff;
    box-shadow: 0 3px 9px rgba(127, 29, 29, .35);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}
.support-unread-badge[hidden] { display: none !important; }

.ai-chat-toggle[hidden] { display: none !important; }

.ai-chat-box {
    position: absolute;
    right: 0;
    bottom: 30px;

    width: 360px;
    max-width: calc(100vw - 32px);
    height: 500px;

    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.25);

    display: flex;
    flex-direction: column;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateX(120%) scale(.96);

    transition:
        transform .45s cubic-bezier(.22, 1, .36, 1),
        opacity .25s ease,
        visibility 0s linear .45s;
}

.ai-chat-box.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) scale(1);

    transition:
        transform .45s cubic-bezier(.22, 1, .36, 1),
        opacity .25s ease,
        visibility 0s;
}

.support-panel {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.support-panel[hidden] { display: none !important; }

.support-mode-picker {
    display: grid;
    gap: 12px;
    padding: 18px;
    margin: auto 0;
}

.support-mode-picker[hidden] { display: none !important; }

.support-mode-picker button {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    background: #fff;
    color: #111827;
    text-align: right;
    cursor: pointer;
}

.support-mode-picker button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(15,23,42,.1); }
.support-mode-picker small { color: #64748b; }
.human-support-toolbar { display:flex; justify-content:space-between; gap:8px; padding:8px 12px; border-bottom:1px solid #e5e7eb; background:#fff; }
.human-support-toolbar button { border:0; background:transparent; color:#2563eb; cursor:pointer; font-family:inherit; }
.human-chat-form{display:flex!important;flex-direction:column;gap:8px}.human-chat-form>div{display:flex}.human-chat-phone{width:100%!important;border:1px solid #dbe3ef!important;border-radius:12px!important;padding:10px!important;background:#fff!important;color:#111827!important}.human-chat-phone:disabled{opacity:.7}

.ai-chat-header {
    background: linear-gradient(to right, #56ccf2, #2f80ed) !important;
    color: #fff;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header small {
    display: block;
    font-size: 11px;
    opacity: 0.9;
    margin-top: 4px;
}

.ai-chat-header button {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}

.ai-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f9fafb;
}

.ai-msg {
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    animation: messagePop .25s ease;
}

.ai-msg-user {
    background: linear-gradient(to right, #56ccf2, #2f80ed) !important;;
    color: #fff;
    margin-right: auto;
    max-width: 85%;
}

.ai-msg-bot {
    background: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    margin-left: auto;
    max-width: 90%;
}

.ai-sources {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #7c2d12;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    font-size: 12px;
}

.ai-sources-title {
    font-weight: bold;
    margin-bottom: 6px;
}

.ai-sources a {
    display: block;
    color: #9a3412;
    text-decoration: none;
    margin-top: 4px;
    word-break: break-word;
}

.ai-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.ai-chat-form input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 30px;
    padding: 10px;
    outline: none;
    font-family: inherit;
}

.ai-chat-form input:focus {
    border-color: #2563eb;
}

.ai-chat-form button {
    border: none;
    background: linear-gradient(to right, #56ccf2, #2f80ed) !important;
    color: #fff;
    border-radius: 30px;
    padding: 0 14px;
    cursor: pointer;
    font-family: inherit;
}

.typing {
    letter-spacing: 4px;
    animation: typingDots 1s infinite;
}

@keyframes messagePop {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDots {
    0% {
        opacity: .3;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: .3;
    }
}

@media (max-width: 600px) {
    .ai-chat-widget {
        right: 12px !important;
        bottom: 12px !important;
        left: auto !important;
        top: auto !important;
    }

    .ai-chat-box {
        right: 0;
        bottom: 62px;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: 70vh;
        transform: translateX(110%) scale(.96);
    }

    .ai-chat-box.open {
        transform: translateX(0) scale(1);
    }
}
