/* Dashboard assistant chat card, launcher, dialog, composer, and message states. */

.dashboard-chat-card {
    width: 100%;
    max-height: 800px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-chat-header {
    flex: 0 0 auto;
    padding: 22px 0px 18px;
    border-bottom: 1px solid var(--edm-outline);
}

.dashboard-chat-title {
    color: var(--text-color-primary);
    font-size: 20px;
    font-weight: 600;
}

.dashboard-chat-subtitle {
    margin-top: 4px;
    color: var(--text-color-muted);
    font-size: 13px;
}

.dashboard-chat-history {
    min-height: 0;
    padding: 24px 26px;
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    transition: padding-bottom 0.2s ease;
}

.dashboard-chat-history.dashboard-chat-history-composer-open {
    padding-bottom: 104px;
}

.dashboard-chat-history:empty {
    min-height: max(360px, min(720px, calc(100vh - 180px)));
}

.dashboard-chat-message {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.dashboard-chat-message-user {
    justify-content: flex-end;
}

.dashboard-chat-agent-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-accent-blue);
}

.dashboard-chat-agent-icon img {
    width: 20px;
    height: 20px;
}

.dashboard-chat-bubble {
    max-width: min(74%, 720px);
    padding: 12px 16px;
    border-radius: 16px;
    color: var(--text-color-primary);
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.dashboard-chat-markdown > :first-child {
    margin-top: 0;
}

.dashboard-chat-markdown > :last-child {
    margin-bottom: 0;
}

.dashboard-chat-markdown p {
    margin: 0 0 8px;
}

.dashboard-chat-markdown ul,
.dashboard-chat-markdown ol {
    margin: 8px 0;
    padding-left: 20px;
}

.dashboard-chat-markdown li + li {
    margin-top: 4px;
}

.dashboard-chat-markdown strong {
    font-weight: 700;
}

.dashboard-chat-bubble-agent {
    border-top-left-radius: 5px;
    background: var(--edm-background-accent-blue);
}

.dashboard-chat-bubble-agent-alert {
    border-top-left-radius: 5px;
    background: var(--edm-alert-background);
}

.dashboard-chat-bubble-user {
    border-top-right-radius: 5px;
    background: var(--edm-background-btn-hover);
}

.dashboard-chat-widget {
    position: fixed;
    z-index: 1100;
    right: 20px;
    bottom: 20px;
    pointer-events: none;
}

.dashboard-chat-launcher {
    position: relative;
    width: 68px;
    height: 68px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(22, 127, 229, 0.16);
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow:
        0 8px 20px rgba(35, 60, 90, 0.16),
        0 18px 42px rgba(35, 60, 90, 0.18);
    pointer-events: auto;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-chat-launcher:hover,
.dashboard-chat-launcher:focus-visible {
    transform: translateY(-3px);
    box-shadow:
        0 10px 24px rgba(35, 60, 90, 0.2),
        0 22px 48px rgba(35, 60, 90, 0.22);
}

.dashboard-chat-launcher:focus-visible,
.dashboard-chat-close:focus-visible {
    outline: 3px solid rgba(22, 127, 229, 0.25);
    outline-offset: 3px;
}

.dashboard-chat-launcher-logo {
    width: 46px;
    height: 38px;
    display: block;
    object-fit: contain;
}

.dashboard-chat-launcher-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 29px;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #FFFFFF;
    border-radius: 50%;
    background: var(--edm-accent-blue);
    box-shadow: 0 4px 10px rgba(22, 127, 229, 0.28);
}

.dashboard-chat-launcher-badge img {
    width: 17px;
    height: 17px;
    display: block;
}

.dashboard-chat-dialog {
    pointer-events: auto;
}

.dashboard-chat-dialog[hidden],
.dashboard-chat-launcher[hidden] {
    display: none !important;
}

.dashboard-chat-close {
    position: absolute;
    z-index: 3;
    top: -14px;
    right: 0;
    width: 32px;
    height: 32px;
    padding: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(35, 60, 90, 0.12);
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 5px 14px rgba(35, 60, 90, 0.16);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.dashboard-chat-close:hover {
    background: var(--edm-background-btn-hover);
    transform: translateY(-1px);
}

.dashboard-chat-close img {
    width: 17px;
    height: 17px;
    display: block;
}

.dashboard-chat-composer {
    position: fixed;
    z-index: 1025;
    left: 280px;
    right: 16px;
    bottom: 16px;
    padding: 0;
    display: block;
    border: 0;
    background: transparent;
}

.dashboard-chat-input {
    width: 100%;
    box-sizing: border-box;
    display: block;
    min-height: 48px;
    max-height: 128px;
    padding: 12px 62px 12px 14px;
    resize: vertical;
    border: 1px solid var(--edm-outline);
    border-radius: 16px;
    outline: none;
    color: var(--text-color-primary);
    background: var(--card-bg-agent);
    box-shadow:
        0 2px 8px rgba(35, 60, 90, 0.08),
        0 10px 28px rgba(35, 60, 90, 0.18),
        0 24px 52px rgba(35, 60, 90, 0.12);
    font-family: "Inter", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.dashboard-chat-input:focus {
    border-color: var(--edm-accent);
    box-shadow:
        0 0 0 3px rgba(137, 177, 87, 0.16),
        0 10px 28px rgba(35, 60, 90, 0.2),
        0 24px 52px rgba(35, 60, 90, 0.14);
}

.dashboard-chat-send {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    color: var(--edm-accent);
    background: var(--edm-background-accent);
}

.dashboard-chat-send-icon {
    width: 20px;
    height: 20px;
    display: block;
    background: var(--edm-accent-dark);
    -webkit-mask: url("/assets/icons/send.svg") center / contain no-repeat;
    mask: url("/assets/icons/send.svg") center / contain no-repeat;
}

.dashboard-chat-send-loading {
    cursor: wait;
}

.dashboard-chat-send-loading .dashboard-chat-send-icon {
    animation: dashboard-chat-send-spin 0.8s linear infinite;
}

@keyframes dashboard-chat-send-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-chat-launcher,
    .dashboard-chat-close {
        transition: none;
    }

    .dashboard-chat-send-loading .dashboard-chat-send-icon {
        animation: dashboard-chat-send-pulse 1s ease-in-out infinite alternate;
    }

    @keyframes dashboard-chat-send-pulse {
        to {
            opacity: 0.45;
        }
    }
}

.dashboard-chat-send:hover,
.dashboard-chat-send:focus,
.dashboard-chat-send:active {
    color: var(--text-color-primary) !important;
    background: var(--edm-accent) !important;
    box-shadow: none !important;
}

.dashboard-chat-send:hover .dashboard-chat-send-icon,
.dashboard-chat-send:focus .dashboard-chat-send-icon,
.dashboard-chat-send:active .dashboard-chat-send-icon {
    background: #FFFFFF;
}

.dashboard-chat-send:active {
    transform: translateY(-50%) scale(0.96);
}
