/* assets/css/chat-widget.css */
#conversio-chat-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#conversio-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--conversio-primary-color, #007cba);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    position: absolute;
    bottom: 0;
    right: 0;
}

#conversio-chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

#conversio-chat-button svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#conversio-chat-button .conversio-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.conversio-open #conversio-chat-button .conversio-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.conversio-open #conversio-chat-button .conversio-icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

#conversio-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 550px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.conversio-open #conversio-chat-window {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.conversio-chat-header {
    background-color: var(--conversio-primary-color, #007cba);
    color: #fff;
    padding: 20px 24px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 2;
}

.conversio-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.conversio-status-dot {
    width: 8px;
    height: 8px;
    background-color: #4cd964;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

.conversio-chat-close {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
}

.conversio-chat-close:hover {
    opacity: 1;
}

.conversio-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.conversio-chat-body::-webkit-scrollbar {
    width: 6px;
}
.conversio-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.conversio-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

.conversio-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: conversioFadeInUp 0.3s ease forwards;
}

@keyframes conversioFadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.conversio-message.bot {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.conversio-message.user {
    background-color: var(--conversio-primary-color, #007cba);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.conversio-chat-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    z-index: 2;
}

.conversio-chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.conversio-chat-input {
    width: 100%;
    border: 1px solid #e1e4e8;
    border-radius: 24px;
    padding: 12px 16px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #f8f9fa;
}

.conversio-chat-input:focus {
    border-color: var(--conversio-primary-color, #007cba);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1); /* fallback color, typically overridden by CSS var */
}

.conversio-chat-send {
    background-color: var(--conversio-primary-color, #007cba);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.conversio-chat-send:active {
    transform: scale(0.95);
}

.conversio-chat-send svg {
    margin-left: -2px;
}

.conversio-typing {
    font-size: 13px;
    color: #888;
    align-self: flex-start;
    padding: 0 20px 15px;
    display: none;
    background: transparent;
    font-style: italic;
}

.conversio-typing-dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    background-color: #aaa;
    border-radius: 50%;
    margin: 0 2px;
    animation: conversioBounce 1.4s infinite ease-in-out both;
}

.conversio-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.conversio-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes conversioBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@media (max-width: 480px) {
    #conversio-chat-wrapper {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }
    
    #conversio-chat-button {
        bottom: 20px;
        right: 20px;
        pointer-events: auto;
    }

    #conversio-chat-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        transform: translateY(100%);
        pointer-events: auto;
    }
}
