/* Gaya panel ESTER bersama, mengikuti panel Distributor. */
.ester-ai-chat-window {
    background: #fff;
    border: 1px solid rgba(52, 42, 48, 0.18);
    border-radius: 8px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    height: min(602px, calc(100vh - 36px));
    max-height: calc(100vh - 36px);
    max-width: calc(100vw - 32px);
    overflow: hidden;
    position: fixed;
    right: 18px;
    width: 360px;
    z-index: 2040;
}

.ester-ai-chat-resize-y {
    cursor: ns-resize;
    height: 10px;
    left: 0;
    position: absolute;
    right: 0;
    top: -5px;
    z-index: 2;
}

.ester-ai-chat-resize-y:after {
    background: rgba(52, 42, 48, 0.22);
    border-radius: 2px;
    content: "";
    display: block;
    height: 3px;
    margin: 3px auto 0;
    width: 42px;
}

.ester-ai-chat-header {
    align-items: center;
    background: #342A30;
    border-bottom: 3px solid #17a2b8;
    color: #fff;
    cursor: move;
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    min-height: 56px;
    padding: 10px 12px;
    user-select: none;
}

.ester-ai-chat-title {
    align-items: center;
    display: flex;
    min-width: 0;
}

.ester-ai-chat-avatar {
    align-items: center;
    background: #17a2b8;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    margin-right: 10px;
    width: 34px;
}

.ester-ai-chat-avatar svg {
    display: block;
    height: auto;
    width: 16px;
}

.ester-ai-chat-body {
    background: #DFEFED;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
}

.ester-ai-chat-message {
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-size: 0.82rem;
    line-height: 1.35;
    margin-bottom: 10px;
    max-width: 88%;
    padding: 9px 10px;
}

.ester-ai-chat-message-ai {
    background: #fff;
    color: #342A30;
}

.ester-ai-chat-message-user {
    background: #17a2b8;
    color: #fff;
    margin-left: auto;
}

.ester-ai-chat-message-error {
    background: #fff3cd;
    color: #856404;
}

.ester-ai-chat-message-loading {
    color: #6c757d;
    font-style: italic;
}

.ester-ai-chat-input {
    align-items: flex-end;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex: 0 0 auto;
    padding: 10px;
}

.ester-ai-chat-input textarea {
    min-height: 54px;
    resize: none;
}

.ester-ai-chat-window.ester-ai-chat-minimized {
    bottom: 18px !important;
    border: 0;
    border-radius: 24px;
    cursor: pointer;
    height: 44px !important;
    left: 18px !important;
    max-height: 44px !important;
    max-width: calc(100vw - 36px);
    min-height: 44px !important;
    overflow: hidden;
    right: auto !important;
    top: auto !important;
    width: 110px;
}

.ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-header {
    background: #342A30;
    border-bottom: 0;
    border-radius: 24px;
    cursor: pointer;
    min-height: 44px;
    padding: 6px 12px 6px 8px;
}

.ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-title {
    width: 100%;
}

.ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-avatar {
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.18);
    height: 30px;
    margin-right: 8px;
    width: 30px;
}

.ester-ai-chat-window.ester-ai-chat-minimized h6 {
    font-size: 0.86rem;
    font-weight: 700;
}

.ester-ai-chat-window.ester-ai-chat-minimized:hover .ester-ai-chat-header {
    background: #4f5759;
}

.ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-body,
.ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-input,
.ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-resize-y,
.ester-ai-chat-window.ester-ai-chat-minimized .btn_ester_ai_chat_minimize,
.ester-ai-chat-window.ester-ai-chat-minimized small {
    display: none;
}

@media (max-width: 575.98px) {
    .ester-ai-chat-window {
        border-radius: 0;
        bottom: auto;
        height: 100vh;
        height: 100dvh;
        left: 0;
        max-height: 100vh;
        max-height: 100dvh;
        max-width: 100vw;
        min-height: 100dvh;
        min-width: 100vw;
        right: auto;
        top: 0;
        width: 100vw;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized {
        bottom: 60px !important;
        border-radius: 0 5px 5px 0;
        height: 24px !important;
        left: 0 !important;
        max-height: 24px !important;
        min-height: 24px !important;
        box-shadow: none !important;
        max-width: 30px !important;
        min-width: 30px !important;
        width: 30px !important;
        z-index: 9999 !important;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-header {
        border-radius: 0 5px 5px 0;
        justify-content: center;
        min-height: 24px;
        padding: 0;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-avatar {
        background: transparent;
        display: inline-flex;
        height: 24px;
        margin-right: 0;
        width: 48px;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized .ester-ai-chat-title {
        justify-content: center;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized h6 {
        font-size: 0;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized h6:after {
        content: "";
        font-size: 11px;
        font-weight: 700;
        line-height: 24px;
    }

    .ester-ai-chat-window.ester-ai-chat-minimized .text-truncate {
        align-items: center;
        display: none;
        flex: 0 0 auto;
        height: 24px;
    }
}
