/* =============================================
   CLOSER CHAT — Estilos del widget real
   Hereda contenedor + header de conversation-showcase.css
   y añade input real, bubbles, typing, atención.
   ============================================= */

/* Cabecera con degradado brand (sobreescribe en caso de que el showcase
   se renderice antes — coincide con el cambio en conversation-showcase.css). */
.closer-header {
    background: linear-gradient(135deg, #0d4f4a 0%, #0c2d4d 100%);
}

/* "Parpadeo de atención" al cargar la página: 2 pulsos suaves del borde. */
@keyframes closerAttentionPulse {
    0%, 100% {
        box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04), 0 0 0 0 rgba(46, 196, 182, 0);
    }
    25%, 75% {
        box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04), 0 0 0 6px rgba(46, 196, 182, 0.32);
    }
}
.closer-attention {
    animation: closerAttentionPulse 1.8s ease-in-out 1;
}

/* ── Mensajes ── */
.closer-messages {
    position: relative;
    padding: 20px 18px;
    min-height: 320px;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    background: var(--surface-0, #fff);
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.08) transparent;
}

/* "En línea" centrado mientras el chat está vacío — invita a escribir. */
.closer-online-pill {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(46, 196, 182, 0.08);
    border: 1px solid rgba(46, 196, 182, 0.28);
    color: #0d4f4a;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    pointer-events: none;
    animation: closerOnlinePulse 2.4s ease-in-out infinite;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.closer-online-pill .closer-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ec4b6;
    box-shadow: 0 0 0 0 rgba(46, 196, 182, 0.55);
    animation: closerOnlineDot 2.4s ease-in-out infinite;
}
.closer-online-pill-hide {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 6px));
}
@keyframes closerOnlinePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(46, 196, 182, 0.0);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(46, 196, 182, 0.08);
    }
}
@keyframes closerOnlineDot {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(46, 196, 182, 0.55);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(46, 196, 182, 0);
        transform: scale(1.08);
    }
}
@media (prefers-reduced-motion: reduce) {
    .closer-online-pill,
    .closer-online-pill .closer-online-dot {
        animation: none;
    }
}
.closer-messages::-webkit-scrollbar {
    width: 4px;
}
.closer-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.08);
    border-radius: 4px;
}
.closer-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* ── Bubble base ── */
.closer-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    opacity: 0;
    transform: translateY(8px);
    animation: closerMsgAppear 0.35s ease forwards;
}
@keyframes closerMsgAppear {
    to { opacity: 1; transform: translateY(0); }
}

.closer-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-light, #e2e8f0);
}

/* Sofia messages (left) */
.closer-msg-sofia {
    align-items: flex-start;
}
.closer-msg-sofia .closer-msg-bubble {
    background: var(--surface-1, #f8fafc);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 14px 14px 14px 4px;
    padding: 12px 16px;
    max-width: 85%;
}
.closer-msg-sofia .closer-msg-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary, #475569);
}
.closer-msg-sofia .closer-msg-text strong {
    color: var(--text-primary, #1e293b);
    font-weight: 600;
}

/* User messages (right) — verde brand para que se sienta "tú estás aquí" */
.closer-msg-user {
    justify-content: flex-end;
}
.closer-msg-user .closer-msg-bubble {
    background: linear-gradient(135deg, #0d4f4a 0%, #0c2d4d 100%);
    border-radius: 14px 14px 4px 14px;
    padding: 12px 16px;
    max-width: 80%;
}
.closer-msg-user .closer-msg-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: rgba(255,255,255,0.95);
}

/* Links dentro de bubbles (incl. Stripe checkout) */
.closer-link {
    color: #2ec4b6;
    word-break: break-all;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}
.closer-msg-user .closer-link {
    color: #ffffff;
    text-decoration: underline;
}
.closer-link:hover { opacity: 0.85; }

/* ── Typing indicator ── */
.closer-typing {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    opacity: 0;
    animation: closerMsgAppear 0.3s ease forwards;
}
.closer-typing-dots {
    background: var(--surface-1, #f8fafc);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 14px 14px 14px 4px;
    padding: 12px 18px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.closer-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted, #94a3b8);
    animation: closerTypingBounce 1.2s ease-in-out infinite;
}
.closer-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.closer-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes closerTypingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* ── Input real ── */
.closer-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border-light, #e2e8f0);
    background: var(--surface-0, #fff);
}
.closer-input {
    flex: 1;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 14px;
    color: var(--text-primary, #1e293b);
    background: var(--surface-1, #f8fafc);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    font-family: inherit;
}
.closer-input:focus {
    border-color: #2ec4b6;
    background: #fff;
}
.closer-input::placeholder {
    color: var(--text-muted, #94a3b8);
}
.closer-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.closer-send {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0d4f4a 0%, #0c2d4d 100%);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.2s ease;
}
.closer-send:not(:disabled):hover {
    transform: scale(1.06);
}
.closer-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── CTA "Entrar a mi panel" tras alta ── */
.closer-entry-cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 6px 0 14px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(46, 196, 182, 0.10) 0%, rgba(12, 45, 77, 0.10) 100%);
    border: 1px solid rgba(46, 196, 182, 0.35);
    border-radius: 14px;
    opacity: 0;
    transform: translateY(8px);
    animation: closerMsgAppear 0.45s ease 0.1s forwards;
}
.closer-entry-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0d4f4a 0%, #0c2d4d 100%);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(12, 45, 77, 0.22);
}
.closer-entry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(12, 45, 77, 0.30);
}
.closer-entry-btn i {
    font-size: 14px;
}
.closer-entry-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-tertiary, #64748b);
    letter-spacing: 0.01em;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .closer-messages {
        min-height: 280px;
        max-height: 380px;
    }
    .closer-msg-sofia .closer-msg-text,
    .closer-msg-user .closer-msg-text {
        font-size: 14px;
    }
}
