/* Consultor Virtual Arte do Sono - Chatbot Styles */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;700&display=swap');

:root {
    --cv-primary: #59429d;
    --cv-primary-hover: #4a3685;
    --cv-secondary-bg: #f3f0ff;
    --cv-text-dark: #1f1f1f;
    --cv-text-grey: #666666;
    --cv-white: #ffffff;
    --cv-border-light: #eaeaea;
    --cv-radius-card: 24px;
    --cv-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --cv-font-header: 'Outfit', sans-serif;
}

#cv-chat-container * {
    box-sizing: border-box;
}

/* --- Floating Button --- */
#cv-floating-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 64px;
    height: 64px;
    background-color: var(--cv-primary);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(89, 66, 157, 0.4);
    cursor: pointer;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#cv-floating-btn:hover {
    transform: scale(1.1);
}

#cv-floating-btn svg {
    color: white;
    width: 32px;
    height: 32px;
}

.cv-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff4757;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--cv-primary);
}

/* --- Chat Container --- */
#cv-chat-container {
    font-family: var(--cv-font);
    position: fixed;
    bottom: 100px;
    left: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 680px;
    max-height: calc(100vh - 120px);
    background: #FAFAFA;
    border-radius: var(--cv-radius-card);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    border: none;
    display: flex;
    flex-direction: column;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

#cv-chat-container.cv-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- Header --- */
#cv-chat-header {
    background: var(--cv-primary);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(89, 66, 157, 0.2);
}

.cv-header-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cv-header-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#cv-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
    font-family: var(--cv-font-header);
    letter-spacing: -0.3px;
}

#cv-chat-header span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
    font-family: var(--cv-font-header);
}

#cv-close-chat {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

#cv-close-chat:hover {
    color: white;
}

/* --- Messages Area --- */
#cv-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #FAFAFA;
}

#cv-messages::-webkit-scrollbar {
    width: 6px;
}

#cv-messages::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}

/* --- Chat Bubbles --- */
.cv-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: cv-fade-in 0.4s ease-out;
    width: 100%;
}

.cv-msg-row .cv-avatar {
    width: 32px;
    height: 32px;
    background: var(--cv-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    margin-top: 4px;
}

.cv-msg {
    max-width: 80%;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    box-shadow: none;
    border: 1px solid transparent;
}

.cv-msg.bot {
    background: var(--cv-white);
    color: var(--cv-text-dark);
    border-radius: 4px 20px 20px 20px;
    border: 1px solid var(--cv-border-light);
}

.cv-msg-row.user {
    justify-content: flex-end;
}

.cv-msg.user {
    background: var(--cv-primary);
    color: var(--cv-white);
    border-radius: 20px 20px 4px 20px;
    box-shadow: none;
}

/* --- Options Buttons --- */
#cv-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: -10px;
    margin-bottom: 10px;
}

.cv-btn-opt {
    background: var(--cv-white);
    color: var(--cv-primary);
    border: 1px solid var(--cv-primary);
    padding: 10px 20px;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cv-btn-opt:hover {
    background: var(--cv-primary);
    color: white;
    transform: translateY(-2px);
}

/* --- Product Cards --- */
.cv-product-card {
    background: var(--cv-white);
    border-radius: var(--cv-radius-card);
    padding: 24px;
    box-shadow: none;
    margin-bottom: 24px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid var(--cv-border-light);
    transition: transform 0.3s ease;
    animation: cv-fade-in 0.5s ease-out;
}

.cv-product-card:hover {
    transform: translateY(-2px);
    border-color: #d0d0d0;
}

.cv-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
}

.cv-tag-brand {
    background: var(--cv-primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cv-tag-comfort {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--cv-text-dark);
    font-weight: 600;
    font-size: 14px;
}

.cv-tag-comfort svg {
    color: var(--cv-primary);
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.cv-prod-img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 20px;
    mix-blend-mode: multiply;
}

.cv-prod-title {
    font-size: 20px;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.2;
}

.cv-prod-desc {
    font-size: 14px;
    color: #777;
    margin-bottom: 16px;
    line-height: 1.5;
}

.cv-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

.cv-meta svg {
    color: var(--cv-primary);
    width: 18px;
    height: 18px;
}

.cv-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.cv-feat-pill {
    background: var(--cv-secondary-bg);
    color: var(--cv-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 12px;
}

.cv-btn-view {
    background: var(--cv-primary);
    color: white;
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.cv-btn-view:hover {
    background: var(--cv-primary-hover);
}

/* --- Final CTA Block --- */
.cv-final-cta {
    background: var(--cv-primary);
    color: white;
    padding: 24px;
    border-radius: var(--cv-radius-card);
    text-align: center;
    margin-top: 10px;
    margin-bottom: 24px;
    animation: cv-fade-in 0.6s ease-out;
}

.cv-cta-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

.cv-cta-text {
    font-size: 14px;
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.5;
}

.cv-btn-whatsapp {
    background: #25D366;
    color: white;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    margin-bottom: 12px;
    border: none;
}

.cv-btn-whatsapp:hover {
    background: #128C7E;
}

.cv-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.2s;
}

.cv-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Input Area --- */
#cv-input-area {
    padding: 20px 24px;
    background: var(--cv-white);
    border-top: 1px solid var(--cv-border-light);
    box-shadow: none;
}

.cv-input-group {
    display: flex;
    gap: 10px;
}

#cv-text-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 100px;
    outline: none;
    font-size: 15px;
    background: #f8f9fa;
}

#cv-text-input:focus {
    border-color: var(--cv-primary);
    background: white;
}

#cv-send-btn {
    background: var(--cv-primary);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#cv-send-btn:hover {
    background: var(--cv-primary-hover);
    transform: scale(1.05);
}

#cv-send-btn:disabled {
    background: #e0e0e0;
    cursor: default;
    transform: none;
}

/* --- Animations --- */
.cv-typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background: white;
    width: fit-content;
    border-radius: 4px 20px 20px 20px;
    border: 1px solid var(--cv-border-light);
    box-shadow: none;
}

.cv-dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: cv-bounce 1.4s infinite ease-in-out both;
}

.cv-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.cv-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes cv-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cv-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* --- Form --- */
.cv-form-container {
    background: white;
    padding: 24px;
    border-radius: 20px;
    box-shadow: none;
    border: 1px solid var(--cv-border-light);
}

.cv-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    background: #fafafa;
}

.cv-btn-submit {
    width: 100%;
    padding: 14px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
    margin-top: 8px;
}

.cv-btn-submit:hover {
    background: #27ae60;
}

/* --- AI Chat Section --- */
.cv-ai-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: var(--cv-radius-card);
    margin-top: 16px;
    animation: cv-fade-in 0.6s ease-out;
}

.cv-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
}

.cv-ai-header svg {
    flex-shrink: 0;
}

.cv-ai-hint {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

/* --- Inline WhatsApp Button (for AI fallback) --- */
.cv-wa-inline-container {
    padding: 8px 0;
    animation: cv-fade-in 0.4s ease-out;
}

.cv-btn-whatsapp-inline {
    background: #25D366;
    color: white;
    padding: 12px 20px;
    border-radius: 100px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.cv-btn-whatsapp-inline:hover {
    background: #128C7E;
    color: white;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 480px) {
    #cv-floating-btn {
        bottom: 16px;
        left: 16px;
        width: 56px;
        height: 56px;
    }

    #cv-chat-container {
        bottom: 84px;
        left: 8px;
        width: calc(100vw - 16px);
        max-height: calc(100vh - 100px);
        border-radius: 20px;
    }

    #cv-messages {
        padding: 16px;
    }

    .cv-product-card {
        padding: 16px;
    }

    .cv-prod-img {
        height: 140px;
    }

    .cv-final-cta,
    .cv-ai-section {
        padding: 16px;
    }
}