/* ============================================
   Vimosa AI Chat - Frontend Styles
   ============================================ */

/* CSS Variables */
.vimosa-chat-right,
.vimosa-chat-left {
    --vimosa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-family: var(--vimosa-font);
    z-index: 999999;
    position: fixed;
    bottom: 20px;
}

.vimosa-chat-right { right: 20px; }
.vimosa-chat-left  { left: 20px; }

/* Floating Button */
.vimosa-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--vimosa-primary, #0066cc);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 999999;
}

.vimosa-chat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}

.vimosa-chat-btn:active {
    transform: scale(0.97);
}

.vimosa-btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vimosa-btn-icon {
    font-size: 22px;
    line-height: 1;
}

.vimosa-btn-icon-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.vimosa-btn-text {
    white-space: nowrap;
}

/* Chat Container */
.vimosa-chat-container {
    position: fixed;
    bottom: 90px;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: 600px;
    height: 550px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: vimosa-slide-up 0.3s ease-out;
    font-family: var(--vimosa-font);
}

.vimosa-chat-right .vimosa-chat-container { right: 0; }
.vimosa-chat-left  .vimosa-chat-container { left: 0; }

@keyframes vimosa-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.vimosa-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--vimosa-primary, #0066cc);
    color: #fff;
    flex-shrink: 0;
}

.vimosa-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vimosa-header-avatar {
    font-size: 28px;
    line-height: 1;
}

.vimosa-header-title {
    font-weight: 700;
    font-size: 15px;
}

.vimosa-header-sub {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.vimosa-header-sub::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4cff4c;
    border-radius: 50%;
}

.vimosa-chat-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.vimosa-chat-close:hover { background: rgba(255,255,255,0.35); }

/* Body */
.vimosa-chat-body {
    flex: 1;
    overflow-y: auto;
    background: #f7f8fa;
}

/* Lead Form */
.vimosa-lead-form {
    padding: 24px 20px;
}

.vimosa-form-header {
    text-align: center;
    margin-bottom: 20px;
}

.vimosa-form-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.vimosa-form-header h3 {
    margin: 0 0 6px;
    font-size: 17px;
    color: #1a1a2e;
}

.vimosa-form-header p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.vimosa-field {
    margin-bottom: 14px;
}

.vimosa-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.vimosa-field input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--vimosa-font);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.vimosa-field input:focus {
    outline: none;
    border-color: var(--vimosa-primary, #0066cc);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.vimosa-btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--vimosa-primary, #0066cc);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 8px;
}

.vimosa-btn-submit:hover { opacity: 0.9; }
.vimosa-btn-submit:active { transform: scale(0.98); }
.vimosa-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Chat Messages */
.vimosa-chat-messages {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.vimosa-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.vimosa-message {
    margin-bottom: 12px;
    max-width: 85%;
    animation: vimosa-msg-in 0.25s ease-out;
}

@keyframes vimosa-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vimosa-msg-user {
    margin-left: auto;
}

.vimosa-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}

.vimosa-msg-bot .vimosa-msg-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}

.vimosa-msg-user .vimosa-msg-bubble {
    background: var(--vimosa-primary, #0066cc);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.vimosa-msg-time {
    font-size: 10px;
    color: #999;
    margin-top: 3px;
    padding: 0 4px;
}

.vimosa-msg-user .vimosa-msg-time { text-align: right; }

/* Typing indicator */
.vimosa-typing {
    padding: 10px 20px;
    display: flex;
    gap: 5px;
}

.vimosa-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: vimosa-bounce 1.4s infinite ease-in-out both;
}

.vimosa-typing span:nth-child(1) { animation-delay: -0.32s; }
.vimosa-typing span:nth-child(2) { animation-delay: -0.16s; }
.vimosa-typing span:nth-child(3) { animation-delay: 0s; }

@keyframes vimosa-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input */
.vimosa-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.vimosa-chat-input textarea {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--vimosa-font);
    resize: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

.vimosa-chat-input textarea:focus {
    outline: none;
    border-color: var(--vimosa-primary, #0066cc);
}

.vimosa-chat-input button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--vimosa-primary, #0066cc);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vimosa-chat-input button:disabled { opacity: 0.4; cursor: not-allowed; }
.vimosa-chat-input button:not(:disabled):hover { opacity: 0.9; }
.vimosa-chat-input button:not(:disabled):active { transform: scale(0.95); }

/* Error state */
.vimosa-error {
    background: #fff0f0;
    color: #c0392b;
    padding: 12px;
    margin: 8px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .vimosa-chat-container {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        border-radius: 0;
        position: fixed;
    }
    
    .vimosa-chat-right .vimosa-chat-container,
    .vimosa-chat-left .vimosa-chat-container {
        right: 0;
        left: 0;
    }

    .vimosa-chat-btn {
        padding: 14px 20px;
        border-radius: 50px;
    }
    
    .vimosa-btn-text { display: none; }
}
