.fsk-ai-widget-root {
    position: fixed;
    z-index: 9999;
    font-family: inherit;
    direction: rtl;
    text-align: right;
}

.fsk-ai-fab {
    position: fixed;
    bottom: 86px;
    right: 14px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 16px;
    border-radius: 50px;
    background-color: #f3e8ff !important;
    border: 1px solid #e9d5ff !important;
    color: #6d28d9 !important;
    box-shadow: 0 8px 24px rgba(109, 40, 217, 0.16);
    font-weight: 700;
    font-size: 0.84rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.fsk-ai-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(109, 40, 217, 0.22);
}

.fsk-ai-fab:active {
    transform: scale(0.97);
}

.fsk-ai-fab-icon {
    font-size: 1.15rem;
    line-height: 1;
    color: #6d28d9 !important;
}

.fsk-ai-fab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #15803d;
    box-shadow: 0 0 0 3px #dcfce7;
    flex-shrink: 0;
}

.fsk-ai-panel {
    position: fixed;
    bottom: 140px;
    right: 4vw;
    width: 92vw;
    max-width: 375px;
    height: min(64vh, 480px);
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.fsk-ai-panel.fsk-ai-open,
.fsk-ai-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fsk-ai-header {
    background: linear-gradient(135deg, #f3e8ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.fsk-ai-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.fsk-ai-brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fsk-ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid #e9d5ff;
    color: #6d28d9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.fsk-ai-title-box {
    min-width: 0;
}

.fsk-ai-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.25;
}

.fsk-ai-subtitle {
    font-size: 0.74rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.fsk-ai-header-btns {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fsk-ai-icon-btn,
.fsk-ai-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background-color: rgba(255, 255, 255, 0.85);
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.fsk-ai-icon-btn:hover,
.fsk-ai-close-btn:hover {
    background-color: #ffffff;
    color: #6d28d9;
}

.fsk-ai-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.fsk-ai-contact-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 50px;
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fsk-ai-pill-call {
    background-color: #e0f2fe !important;
    border: 1px solid #bae6fd !important;
    color: #0f172a !important;
}

.fsk-ai-pill-wa {
    background-color: #dcfce7 !important;
    border: 1px solid #bbf7d0 !important;
    color: #064e3b !important;
}

.fsk-ai-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #ffffff;
}

.fsk-ai-msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 0.84rem;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-line;
}

.fsk-ai-msg-bot {
    align-self: flex-start;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-top-right-radius: 4px;
}

.fsk-ai-msg-user {
    align-self: flex-end;
    background-color: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
    font-weight: 600;
    border-top-left-radius: 4px;
}

.fsk-ai-prompts-bar {
    padding: 8px 12px;
    background-color: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.fsk-ai-prompts-bar::-webkit-scrollbar {
    display: none;
}

.fsk-ai-chip {
    background-color: #f3e8ff;
    border: 1px solid #e9d5ff;
    color: #6d28d9;
    border-radius: 50px;
    padding: 5px 11px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.fsk-ai-chip:hover {
    background-color: #e9d5ff;
}

.fsk-ai-footer {
    position: relative;
    z-index: 20;
    padding: 10px 12px;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    pointer-events: auto;
}

.fsk-ai-input {
    position: relative;
    z-index: 21;
    flex: 1 1 auto;
    height: 40px;
    border-radius: 50px;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    padding: 0 14px;
    font-size: 16px;
    color: #1e293b;
    outline: none;
    pointer-events: auto;
}

.fsk-ai-input:focus {
    border-color: #a855f7;
    background-color: #ffffff;
}

.fsk-ai-send-btn {
    position: relative;
    z-index: 22;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f3e8ff !important;
    border: 1px solid #e9d5ff !important;
    color: #6d28d9 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.fsk-ai-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.fsk-ai-typing {
    align-self: flex-start;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.fsk-ai-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #6d28d9;
    opacity: 0.4;
    animation: fskAiPulse 1.2s infinite ease-in-out;
}

.fsk-ai-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.fsk-ai-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.fsk-ai-fallback-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.fsk-ai-links-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.fsk-ai-link-card {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 50px;
    background-color: #f3e8ff;
    border: 1px solid #e9d5ff;
    color: #6d28d9 !important;
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.fsk-ai-link-card:hover {
    background-color: #e9d5ff;
    transform: translateY(-1px);
}

.fsk-ai-link-card i {
    font-size: 0.78rem;
    color: inherit !important;
}

@keyframes fskAiPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.35;
    }
    40% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .fsk-ai-panel {
        position: fixed;
        inset: 0;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        z-index: 10050;
        background-color: #ffffff;
        display: flex;
        flex-direction: column;
    }

    .fsk-ai-header {
        flex-shrink: 0;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }

    .fsk-ai-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .fsk-ai-prompts-bar {
        flex-shrink: 0;
    }

    .fsk-ai-footer {
        flex-shrink: 0;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        background-color: #ffffff;
    }

    body.fsk-ai-chat-open {
        overflow: hidden !important;
    }

    body.fsk-ai-chat-open .fsk-ai-fab,
    body.fsk-ai-chat-open .back-to-top,
    body.fsk-ai-chat-open .fsk-bst-mobile-dock,
    body.fsk-ai-chat-open #fskBstMobileDock,
    body.fsk-ai-chat-open .forsank-mobile-bar {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .fsk-ai-fab {
        bottom: 24px;
        left: 75px;
        right: auto;
        height: 48px;
        padding: 0 18px;
        font-size: 0.88rem;
    }

    .fsk-ai-panel {
        bottom: 84px;
        left: 24px;
        right: auto;
        width: 370px;
        height: 510px;
    }
}
