/* ============================================
   RVOLUCION — Overlay de bienvenida del cotizador
   Glassmorphism + blur gaussiano + typewriter
   ============================================ */

.cotiz-welcome {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(6, 8, 13, 0.55);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.cotiz-welcome.active {
    opacity: 1;
    visibility: visible;
}

/* Tarjeta central */
.cotiz-welcome-card {
    position: relative;
    max-width: 560px;
    width: 100%;
    text-align: center;
    padding: 3rem 2.5rem;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(20, 24, 34, 0.85), rgba(11, 14, 22, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
                0 0 60px rgba(255, 87, 34, 0.1);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cotiz-welcome.active .cotiz-welcome-card {
    transform: translateY(0) scale(1);
}

/* Glow superior */
.cotiz-welcome-card::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 60%; height: 3px;
    background: linear-gradient(90deg, transparent, #ff5722, #2ce8f5, transparent);
    border-radius: 3px;
}

/* Logo */
.cotiz-welcome-logo {
    height: 46px;
    width: auto;
    margin: 0 auto 1.8rem;
    display: block;
}
.cotiz-welcome-logo-fallback {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 1.8rem;
    display: none;
}
.cotiz-welcome-logo-fallback .rmark { color: #ff5722; }

/* Ícono asistente */
.cotiz-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Sora', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #2ce8f5;
    background: rgba(44, 232, 245, 0.08);
    border: 1px solid rgba(44, 232, 245, 0.25);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    margin-bottom: 1.5rem;
}
.cotiz-welcome-badge span { width: 7px; height: 7px; border-radius: 50%; background: #c6f24e; box-shadow: 0 0 8px #c6f24e; }

/* Texto typewriter */
.cotiz-welcome-text {
    font-family: 'Sora', sans-serif;
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.92);
    min-height: 5.5em;
    margin-bottom: 2rem;
}
.cotiz-welcome-text .hl {
    background: linear-gradient(120deg, #ff5722, #ff7a18);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}
/* Cursor parpadeante del typewriter */
.cotiz-welcome-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #2ce8f5;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cotizCursorBlink 0.9s steps(2) infinite;
}
@keyframes cotizCursorBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Botón */
.cotiz-welcome-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(120deg, #ff5722 0%, #ff7a18 40%, #2ce8f5 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2.4rem;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(255, 87, 34, 0.35);
    opacity: 0;
    transform: translateY(10px);
    transition: transform 0.3s, box-shadow 0.3s, opacity 0.4s;
}
.cotiz-welcome-btn.show { opacity: 1; transform: translateY(0); }
.cotiz-welcome-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(255, 87, 34, 0.5); }
.cotiz-welcome-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

@media (max-width: 540px) {
    .cotiz-welcome-card { padding: 2.2rem 1.5rem; }
    .cotiz-welcome-text { font-size: 1.05rem; }
}

/* ============================================
   EFECTO DE ENTRADA del chat del agente (1ª vez/sesión)
   ============================================ */
/* Rebote del panel al entrar */
.ai-chat-panel.chat-entrance {
    animation: chatPanelPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes chatPanelPop {
    0%   { transform: scale(0.85) translateY(20px); opacity: 0; }
    60%  { transform: scale(1.03) translateY(-4px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Glow pulsante del borde (2-3 pulsos y se calma) */
.ai-chat-panel.chat-entrance::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.5);
    animation: chatGlowPulse 1s ease-out 0.3s 2;
    z-index: 1;
}
@keyframes chatGlowPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.55), 0 0 30px rgba(255, 87, 34, 0.4); }
    50%  { box-shadow: 0 0 0 6px rgba(44, 232, 245, 0.0), 0 0 45px rgba(44, 232, 245, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(44, 232, 245, 0), 0 0 0 rgba(44, 232, 245, 0); }
}

/* Saludo (primer mensaje) aparece con fade-up */
.ai-chat-panel.chat-entrance .chat-message.ai:first-child {
    animation: chatGreetingUp 0.55s ease 0.45s both;
}
@keyframes chatGreetingUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Ícono R en avatares del chat del agente
   ============================================ */
.chat-title-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 50%;
}
.message-avatar-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

/* ============================================
   Formato Markdown en mensajes del agente
   ============================================ */
.message-content p { margin: 0 0 0.6rem; line-height: 1.6; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { color: #ff7a18; font-weight: 700; }
.message-content em { font-style: italic; opacity: 0.95; }
.message-content ul {
    margin: 0.5rem 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.message-content li {
    position: relative;
    padding-left: 1.4rem;
    line-height: 1.5;
}
.message-content li::before {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 0.55em;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff5722, #2ce8f5);
}
