/* MK-CanDu site assistant — docked full-height panel */
:root {
    --mk-ai-panel-width: 380px;
}

.mk-ai-widget {
    position: fixed;
    z-index: 1080;
    inset-inline-end: 22px;
    bottom: 22px;
    font-family: inherit;
}

.mk-ai-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #1B3A5F 0%, #396EB0 100%);
    color: #FFFFFF;
    font-size: 22px;
    box-shadow: 0 12px 28px rgba(27, 58, 95, 0.35);
    cursor: pointer;
}

.mk-ai-fab:hover,
.mk-ai-fab:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.mk-ai-widget.is-open {
    inset: 0;
    inset-inline-start: auto;
    width: var(--mk-ai-panel-width);
    height: 100%;
    bottom: 0;
}

.mk-ai-widget.is-open .mk-ai-fab {
    display: none;
}

.mk-ai-panel {
    display: flex;
    flex-direction: column;
    width: var(--mk-ai-panel-width);
    height: 100%;
    overflow: hidden;
    border: 0;
    border-inline-start: 1px solid rgba(20, 39, 62, 0.12);
    border-radius: 0;
    background: #FFFFFF;
    box-shadow: -16px 0 40px rgba(20, 39, 62, 0.12);
}

html.mk-lang-ar .mk-ai-panel {
    border-inline-start: 0;
    border-inline-end: 1px solid rgba(20, 39, 62, 0.12);
    box-shadow: 16px 0 40px rgba(20, 39, 62, 0.12);
}

html.mk-ai-open {
    overflow-x: hidden;
}

html.mk-ai-open body {
    box-sizing: border-box;
    width: 100%;
    padding-inline-end: var(--mk-ai-panel-width);
    transition: padding-inline-end 0.28s ease, padding-inline-start 0.28s ease;
}

/* Site content shrinks instead of sitting under the panel */
html.mk-ai-open .header-area,
html.mk-ai-open .sub-header,
html.mk-ai-open .mk-site-header,
html.mk-ai-open .footer-area,
html.mk-ai-open .footer-bottom {
    max-width: 100%;
}

@media (max-width: 767px) {
    :root {
        --mk-ai-panel-width: min(380px, 100vw);
    }

    html.mk-ai-open body {
        padding-inline-end: 0;
        padding-inline-start: 0;
    }

    .mk-ai-widget.is-open {
        width: 100%;
    }

    .mk-ai-panel {
        width: 100%;
        box-shadow: none;
    }
}

.mk-ai-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 14px;
    background: linear-gradient(135deg, #1B3A5F 0%, #396EB0 100%);
    color: #FFFFFF;
}

.mk-ai-head-copy {
    display: grid;
    gap: 2px;
}

.mk-ai-head-copy strong {
    font-size: 15px;
    font-weight: 700;
}

.mk-ai-head-copy span {
    font-size: 12px;
    opacity: 0.86;
}

.mk-ai-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
    cursor: pointer;
}

.mk-ai-messages {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    overflow-y: auto;
    background: #F5F8FC;
}

.mk-ai-bubble {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 14px;
    color: inherit;
    font-size: 14px;
    line-height: 1.55;
    text-align: start;
    white-space: pre-wrap;
    word-break: break-word;
}

.mk-ai-bubble[data-mk-ai-welcome] {
    white-space: normal;
}

.mk-ai-bubble.is-bot {
    align-self: flex-start;
    background: #FFFFFF;
    color: #1B3A5F;
    border: 1px solid #E2E9F2;
    border-end-start-radius: 4px;
}

.mk-ai-bubble.is-user {
    align-self: flex-end;
    background: #396EB0;
    color: #FFFFFF;
    border-end-end-radius: 4px;
}

.mk-ai-bubble.is-pending {
    color: #6B7C93;
    font-style: italic;
}

html.mk-lang-ar .mk-ai-bubble.is-bot {
    border-end-start-radius: 14px;
    border-end-end-radius: 4px;
}

html.mk-lang-ar .mk-ai-bubble.is-user {
    border-end-end-radius: 14px;
    border-end-start-radius: 4px;
}

.mk-ai-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 6px;
    border-top: 1px solid #E2E9F2;
    background: #FFFFFF;
}

.mk-ai-form textarea {
    flex: 1 1 auto;
    min-height: 42px;
    max-height: 96px;
    resize: none;
    padding: 10px 12px;
    border: 1px solid #D5E0EE;
    border-radius: 12px;
    color: #1B3A5F;
    font-size: 14px;
    line-height: 1.4;
}

.mk-ai-form textarea:focus {
    outline: none;
    border-color: #396EB0;
    box-shadow: 0 0 0 3px rgba(57, 110, 176, 0.15);
}

.mk-ai-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: #396EB0;
    color: #FFFFFF;
    cursor: pointer;
}

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

.mk-ai-note {
    margin: 0;
    padding: 0 16px 10px;
    color: #7A8799;
    font-size: 11px;
    text-align: center;
}

html.mk-lang-ar .mk-ai-panel,
html.mk-lang-ar .mk-ai-form textarea {
    direction: rtl;
    text-align: right;
}
