/* Advanced CDOE Assistant */
.chatbot-container {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 10000;
    font-family: var(--default-font, "Roboto", system-ui, sans-serif);
}

.chatbot-button {
    position: relative;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: #1158a8;
    color: #fff;
    box-shadow: 0 16px 34px rgba(17, 88, 168, 0.35);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-button:hover {
    transform: translateY(-2px);
    background: #0d4585;
    box-shadow: 0 18px 38px rgba(17, 88, 168, 0.45);
}

.chatbot-button.active {
    background: #b4232f;
}

.chatbot-pulse {
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(17, 88, 168, 0.28);
    border-radius: 50%;
    animation: chatbotPulse 1.8s infinite;
}

.chatbot-button.active .chatbot-pulse {
    display: none;
}

@keyframes chatbotPulse {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.25);
        opacity: 0;
    }
}

.chatbot-window {
    position: absolute;
    right: 0;
    bottom: 82px;
    width: min(410px, calc(100vw - 28px));
    height: min(640px, calc(100vh - 132px));
    min-height: 520px;
    background: #fff;
    border: 1px solid #d8e1ee;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(18, 38, 63, 0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.active {
    display: flex;
    animation: chatbotSlideUp 0.22s ease-out;
}

@keyframes chatbotSlideUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

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

.chatbot-header {
    background: #0f4f96;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chatbot-header-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.chatbot-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 18px;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
    color: #fff;
}

.chatbot-status {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
}

.chatbot-status span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #44d17a;
    box-shadow: 0 0 0 3px rgba(68, 209, 122, 0.18);
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-icon-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chatbot-icon-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.chatbot-tools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
    background: #f5f8fc;
    border-bottom: 1px solid #e1e8f2;
}

.chatbot-tool {
    height: 54px;
    border: 1px solid #d8e1ee;
    border-radius: 8px;
    background: #fff;
    color: #1f354d;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.chatbot-tool i {
    font-size: 17px;
    color: #0f4f96;
}

.chatbot-tool:hover {
    border-color: #0f4f96;
    color: #0f4f96;
    transform: translateY(-1px);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fbfe;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 7px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #b9c8da;
    border-radius: 999px;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    animation: chatbotFadeIn 0.2s ease-out;
}

.message.user {
    flex-direction: row-reverse;
}

@keyframes chatbotFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 15px;
}

.message.bot .message-avatar {
    background: #e6f0fb;
    color: #0f4f96;
}

.message.user .message-avatar {
    background: #eef1f5;
    color: #334155;
}

.message-body {
    max-width: 78%;
    min-width: 0;
}

.message.user .message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-content {
    padding: 11px 13px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    color: #26384d;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.message.bot .message-content {
    background: #fff;
    border: 1px solid #e1e8f2;
}

.message.user .message-content {
    background: #0f4f96;
    color: #fff;
}

.message-time {
    margin-top: 5px;
    color: #7a8899;
    font-size: 11px;
}

.chatbot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chatbot-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 8px;
    background: #1158a8;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.chatbot-action-link:hover {
    background: #0d4585;
    color: #fff;
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.quick-reply-btn {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #cbd7e6;
    border-radius: 8px;
    background: #fff;
    color: #29435f;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.quick-reply-btn:hover {
    background: #e8f2ff;
    border-color: #0f4f96;
    color: #0f4f96;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 58px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7a8899;
    animation: chatbotTyping 1.1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatbotTyping {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.55;
    }

    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.chatbot-input-area {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e1e8f2;
    display: flex;
    align-items: center;
    gap: 9px;
}

.chatbot-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border: 1px solid #cbd7e6;
    border-radius: 8px;
    padding: 0 13px;
    color: #26384d;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-input:focus {
    border-color: #0f4f96;
    box-shadow: 0 0 0 3px rgba(15, 79, 150, 0.12);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: #1158a8;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.chatbot-send-btn:hover {
    background: #0d4585;
}

.chatbot-send-btn:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

@media (max-width: 575px) {
    .chatbot-container {
        right: 14px;
        bottom: 14px;
    }

    .chatbot-window {
        right: -2px;
        bottom: 76px;
        width: calc(100vw - 24px);
        height: calc(100vh - 118px);
        min-height: 0;
    }

    .chatbot-tools {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 10px;
        gap: 7px;
    }

    .chatbot-tool {
        height: 50px;
        font-size: 10px;
    }

    .message-body {
        max-width: 82%;
    }

    .chatbot-button {
        width: 58px;
        height: 58px;
    }
}
