/* assets/css/chat-widget.css */

/* Variables matching the premium/dermatological theme */
:root {
    --chat-primary: #008080;
    /* Teal/Turquoise base */
    --chat-primary-dark: #006666;
    --chat-bg: #ffffff;
    --chat-text: #333333;
    --chat-text-light: #666666;
    --chat-input-bg: #f5f5f5;
    --chat-border: #e0e0e0;
    --chat-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    --chat-radius: 16px;
    --chat-msg-user-bg: #e0f2f1;
    /* Light Teal */
    --chat-msg-ai-bg: #f9f9f9;
}

/* 1. Floating Button (The "Bubble") */
.chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 128, 128, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-launcher:hover {
    transform: scale(1.1);
}

.chat-launcher svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.chat-launcher .close-icon {
    display: none;
}

.chat-launcher.active .chat-icon {
    display: none;
}

.chat-launcher.active .close-icon {
    display: block;
}

/* Tooltip */
.chat-tooltip {
    position: absolute;
    right: 70px;
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    color: var(--chat-text);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-launcher:hover .chat-tooltip {
    opacity: 1;
    visibility: visible;
    right: 80px;
}

/* 2. Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: 80vh;
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;

    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.chat-window.open {
    transform: scale(1);
    opacity: 1;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chat-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #00fa9a;
    /* Spring Green */
    border-radius: 50%;
    display: inline-block;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #fff;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.ai {
    background: var(--chat-msg-ai-bg);
    color: var(--chat-text);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message.user {
    background: var(--chat-msg-user-bg);
    color: var(--chat-primary-dark);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    background: #fff;
}

.chat-input {
    flex: 1;
    border: none;
    background: var(--chat-input-bg);
    padding: 12px 15px;
    border-radius: 25px;
    font-size: 14px;
    color: var(--chat-text);
    outline: none;
    transition: background 0.2s;
}

.chat-input:focus {
    background: #f0f0f0;
}

.chat-send-btn {
    background: var(--chat-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: var(--chat-primary-dark);
}

.chat-send-btn svg {
    fill: white;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    /* Visual balance */
}

/* Typing Indicator */
.typing-indicator {
    padding: 10px 15px;
    background: var(--chat-msg-ai-bg);
    border-radius: 12px;
    align-self: flex-start;
    display: none;
    /* Hidden by default */
    gap: 5px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .chat-launcher {
        bottom: 20px;
        right: 20px;
    }
}

/* Link Buttons (UX Optimization for Conversion) */
.chat-link-btn {
    display: inline-block;
    margin: 8px 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, #008080, #006666);
    color: white !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 128, 128, 0.3);
    border: none;
    cursor: pointer;
    text-align: center;
    width: 100%;
    max-width: 280px;
}

.chat-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 128, 128, 0.4);
    background: linear-gradient(135deg, #006666, #004d4d);
}

.chat-link-btn:active {
    transform: translateY(0);
}

/* Premium variant for Rutina Personalizada */
.chat-link-btn.premium {
    background: linear-gradient(90deg, #ff9a9e 0%, #ff6b6b 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.chat-link-btn.premium:hover {
    background: linear-gradient(90deg, #ff8a8e 0%, #ff5b5b 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

/* Ensure buttons look good in AI messages */
.message.ai .chat-link-btn {
    margin-top: 10px;
    display: block;
}

/* Lead Capture Form */
.lead-capture-form {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2f1 100%);
    padding: 16px;
    border-radius: 12px;
    border: 2px solid var(--chat-primary);
    margin-top: 8px;
}

.lead-capture-form p {
    margin: 0 0 12px 0;
    color: var(--chat-text);
}

.lead-input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.lead-input:focus {
    outline: none;
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.1);
}

.lead-submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.lead-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 128, 128, 0.3);
}

.lead-skip-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.lead-skip-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.lead-capture-message {
    max-width: 90% !important;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}