#consultant-widget-root {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    font-family: inherit;
}

#consultant-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #7c3aed;
    color: #fff;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#consultant-toggle:hover {
    transform: scale(1.05);
}

#consultant-panel {
    display: none;
    position: absolute;
    bottom: 68px;
    left: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 460px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    flex-direction: column;
}

#consultant-panel.open {
    display: flex;
}

#consultant-panel.is-loading #consultant-header::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: #fde68a;
    animation: consultant-pulse 1s ease-in-out infinite;
}

#consultant-header {
    background: #7c3aed;
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#consultant-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

#consultant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

.consultant-msg {
    margin-bottom: 12px;
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.consultant-msg.bot {
    background: #fff;
    border: 1px solid #e2e8f0;
    margin-left: auto;
    margin-right: 0;
    max-width: 92%;
}

.consultant-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.consultant-product-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.consultant-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.consultant-product-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12);
    text-decoration: none;
    color: inherit;
}

.consultant-product-card-image {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
}

.consultant-product-card-image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: #ede9fe;
}

.consultant-product-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.consultant-product-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.consultant-product-card-price {
    font-size: 12px;
    color: #7c3aed;
    font-weight: 700;
}

.consultant-product-card-action {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.consultant-msg.bot a,
.consultant-msg.bot .consultant-product-link {
    color: #7c3aed;
    font-weight: 600;
    text-decoration: underline;
}

.consultant-msg.user {
    background: #7c3aed;
    color: #fff;
    margin-right: auto;
    margin-left: 0;
}

.consultant-msg.typing {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 0;
}

.consultant-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.consultant-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7c3aed;
    animation: consultant-bounce 1.4s ease-in-out infinite both;
}

.consultant-typing-dots span:nth-child(1) { animation-delay: 0s; }
.consultant-typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.consultant-typing-dots span:nth-child(3) { animation-delay: 0.32s; }

.consultant-typing-text {
    font-size: 13px;
}

@keyframes consultant-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes consultant-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

#consultant-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

#consultant-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    min-height: 42px;
    max-height: 100px;
}

#consultant-send {
    border: none;
    background: #7c3aed;
    color: #fff;
    border-radius: 10px;
    width: 44px;
    cursor: pointer;
    font-size: 18px;
    transition: opacity 0.2s ease;
}

#consultant-send:disabled,
#consultant-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #consultant-widget-root {
        bottom: 80px;
        left: 16px;
    }

    #consultant-panel {
        width: calc(100vw - 32px);
        height: 60vh;
    }
}
