/* Desktop advisor chat — laptop/desktop only, site theme */

.advisor-chat {
    --advisor-chat-primary: var(--ep-primary-color-1, #0037eb);
    --advisor-chat-primary-2: var(--ep-primary-color-2, #006bff);
    --advisor-chat-accent: var(--ep-primary-color-9, #764ba2);
    --advisor-chat-soft: var(--ep-primary-color-6, #d6e0ff);
    --advisor-chat-title: var(--ep-title-color, #1f1c35);
    --advisor-chat-text: var(--ep-paragraph-color, #4f536c);
    --advisor-chat-border: var(--ep-border-color, #e7e7eb);
    --advisor-chat-online: #22c55e;
    font-family: var(--ep-font-family, Inter, system-ui, sans-serif);
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10010;
    width: 360px;
    max-width: calc(100vw - 48px);
    display: none;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
}

@media (min-width: 992px) {
    .advisor-chat {
        display: flex;
    }
}

.advisor-chat__window {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 480px;
    max-height: calc(100vh - 48px);
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--advisor-chat-border);
    box-shadow: 0 16px 48px rgba(31, 28, 53, 0.14);
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
                opacity 0.3s ease,
                visibility 0.3s ease;
}

.advisor-chat.is-open .advisor-chat__window {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.advisor-chat__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.advisor-chat__close:hover,
.advisor-chat__close:focus {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

.advisor-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 48px 14px 16px;
    background: linear-gradient(135deg, var(--advisor-chat-primary) 0%, var(--advisor-chat-accent) 100%);
    color: #fff;
}

.advisor-chat__avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.advisor-chat__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.advisor-chat__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.advisor-chat__online-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--advisor-chat-online);
    border: 2px solid var(--advisor-chat-primary);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: advisor-chat-pulse 1.8s ease-out infinite;
}

.advisor-chat__header-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.advisor-chat__name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.advisor-chat__name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.advisor-chat__verified {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.advisor-chat__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.92);
}

.advisor-chat__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--advisor-chat-online);
}

.advisor-chat__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: var(--ep-offwhite-color, #f5f5f5);
}

.advisor-chat__messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.advisor-chat__bubble {
    position: relative;
    max-width: 86%;
    padding: 10px 14px 8px;
    background: #fff;
    border: 1px solid var(--advisor-chat-border);
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 2px rgba(31, 28, 53, 0.04);
    font-size: 14px;
    line-height: 1.45;
    color: var(--advisor-chat-title);
    align-self: flex-start;
}

.advisor-chat__bubble--user {
    align-self: flex-end;
    border-color: var(--advisor-chat-soft);
    background: var(--advisor-chat-soft);
}

.advisor-chat__time {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #8b8fa3;
    text-align: right;
}

.advisor-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px 14px;
    background: #fff;
    border-top: 1px solid var(--advisor-chat-border);
}

.advisor-chat__input {
    flex: 1;
    min-height: 42px;
    max-height: 96px;
    height: 42px;
    resize: none;
    overflow: hidden;
    border: 1px solid var(--advisor-chat-border);
    border-radius: 20px;
    padding: 11px 16px;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: var(--advisor-chat-title);
    background: var(--ep-offwhite-color, #f5f5f5);
}

.advisor-chat__input::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.advisor-chat__input:focus {
    outline: none;
    border-color: var(--advisor-chat-primary);
    background: #fff;
}

.advisor-chat__send {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--advisor-chat-primary) 0%, var(--advisor-chat-accent) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.advisor-chat__send:hover,
.advisor-chat__send:focus {
    background: var(--advisor-chat-primary-2);
    outline: none;
}

.advisor-chat.is-sending .advisor-chat__send,
.advisor-chat__send:disabled {
    opacity: 0.45;
    cursor: default;
}

.advisor-chat__send svg {
    width: 18px;
    height: 18px;
    display: block;
}

.advisor-chat__launcher {
    align-self: flex-end;
    margin-top: 12px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--advisor-chat-primary) 0%, var(--advisor-chat-accent) 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 55, 235, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    padding: 0;
}

.advisor-chat__launcher:hover,
.advisor-chat__launcher:focus {
    background: var(--advisor-chat-primary-2);
    outline: none;
}

.advisor-chat.is-open .advisor-chat__launcher {
    display: none;
}

.advisor-chat__launcher svg {
    width: 26px;
    height: 26px;
}

@keyframes advisor-chat-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .advisor-chat__window,
    .advisor-chat__online-dot {
        animation: none;
        transition: none;
    }

    .advisor-chat.is-open .advisor-chat__window {
        transform: none;
    }
}
