/* ==========================================================================
   Cefelito - Asistente Virtual Oficial CFL N° 407
   Estética Premium Tech: Fundaluz XXI / CFL N° 407
   ========================================================================== */

/* Contenedor Flotante Principal de Cefelito (Inferior Izquierda) */
.cefelito-widget-wrap {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999999;
    font-family: inherit;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Burbuja / Botón Lanzador */
.cefelito-launcher {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    outline: none;
}

/* Personaje Cefelito de cuerpo completo flotante (con brazos y piernas) */
.cefelito-character-wrap {
    position: relative;
    width: 58px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cefelitoFloatingAnim 3.8s ease-in-out infinite;
    transition: transform 0.25s ease;
    will-change: transform;
    transform: translateZ(0);
}

/* Imagen del personaje con iluminación 3D y brazos/piernas completos */
.cefelito-character-wrap .cefelito-character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0, 48, 135, 0.45));
    transform-origin: 50% 85%;
    animation: cefelitoWiggleAnim 5.5s ease-in-out infinite;
    transition: transform 0.25s ease, filter 0.25s ease;
    will-change: transform;
    transform: translateZ(0);
}

@media (max-width: 768px) {
    .cefelito-character-wrap .cefelito-character-img {
        filter: drop-shadow(0 3px 6px rgba(0, 48, 135, 0.35)) !important;
    }
}

/* Sombra dinámica 3D en el suelo */
.cefelito-ground-shadow {
    position: absolute;
    bottom: -6px;
    left: 12px;
    right: 12px;
    height: 10px;
    background: radial-gradient(ellipse at center, rgba(0, 12, 36, 0.55) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    animation: cefelitoShadowAnim 3.8s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* Hover: salto de emoción */
.cefelito-launcher:hover .cefelito-character-wrap {
    animation-play-state: paused;
    transform: scale(1.12) translateY(-8px);
}

.cefelito-launcher:hover .cefelito-character-wrap .cefelito-character-img {
    animation-play-state: paused;
    transform: rotate(5deg) scale(1.06);
    filter: drop-shadow(0 12px 22px rgba(0, 48, 135, 0.6)) drop-shadow(0 0 16px rgba(245, 158, 11, 0.5));
}

.cefelito-launcher:hover .cefelito-ground-shadow {
    animation-play-state: paused;
    transform: scale(0.75);
    opacity: 0.3;
}

/* Keyframes de flotación orgánica */
@keyframes cefelitoFloatingAnim {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-9px);
    }
}

/* Keyframes de sombra sincrónica con la altura */
@keyframes cefelitoShadowAnim {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(0.68);
        opacity: 0.35;
    }
}

/* Keyframes de movimiento y saludito de Cefelito */
@keyframes cefelitoWiggleAnim {
    0%, 65%, 100% {
        transform: rotate(0deg) scale(1);
    }
    70% {
        transform: rotate(-6deg) scale(1.08) translateY(-2px);
    }
    75% {
        transform: rotate(6deg) scale(1.1) translateY(-3px);
    }
    80% {
        transform: rotate(-4deg) scale(1.08) translateY(-2px);
    }
    85% {
        transform: rotate(4deg) scale(1.05) translateY(-1px);
    }
    90% {
        transform: rotate(0deg) scale(1.02);
    }
}

/* Anillo de pulso sutil */
.cefelito-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px solid #00A3E0;
    opacity: 0.7;
    animation: cefelitoPulseAnim 2.8s infinite ease-out;
    pointer-events: none;
}

@keyframes cefelitoPulseAnim {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.24);
        opacity: 0;
    }
    100% {
        transform: scale(1.24);
        opacity: 0;
    }
}

/* Ocultar burbuja de saludo cuando el chat está abierto */
.cefelito-chat-open #cefelitoSpeechBubble,
.cefelito-widget-wrap.cefelito-chat-open #cefelitoSpeechBubble,
.cefelito-chat-window.is-open ~ #cefelitoSpeechBubble,
body.cefelito-locked #cefelitoSpeechBubble {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Píldora de saludo flotante (Diseño Blanco Luminoso Institucional CFL N° 407) */
.cefelito-speech-bubble {
    position: relative;
    margin-bottom: 12px;
    background: #ffffff;
    border: 1.5px solid #00A3E0;
    border-radius: 9999px;
    padding: 7px 12px 7px 16px;
    color: #0f172a;
    box-shadow: 0 10px 26px rgba(0, 48, 135, 0.16), 0 2px 6px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    animation: cefelitoPillAppear 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.25s ease;
    cursor: pointer;
    user-select: none;
    z-index: 10;
}

.cefelito-speech-bubble:hover {
    transform: translateY(-2px);
    border-color: #003087;
    box-shadow: 0 14px 30px rgba(0, 48, 135, 0.22), 0 4px 10px rgba(0, 0, 0, 0.08);
}

.cefelito-bubble-content {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    letter-spacing: 0.1px;
    line-height: 1.2;
}

.cefelito-bubble-name {
    font-weight: 700;
    color: #003087;
}

.cefelito-bubble-sep {
    color: #94a3b8;
    font-weight: 600;
}

.cefelito-bubble-text {
    font-weight: 500;
    color: #475569;
}

.cefelito-text-green {
    color: #059669 !important;
    font-weight: 700 !important;
}

/* Botón de cierre sutil y elegante */
.cefelito-speech-bubble-close {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    margin-left: 2px;
    transition: all 0.2s ease;
}

.cefelito-speech-bubble-close:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: scale(1.08);
}

/* Flechita indicadora blanca hacia Cefelito */
.cefelito-bubble-tail {
    position: absolute;
    bottom: -6px;
    left: 24px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-right: 1.5px solid #00A3E0;
    border-bottom: 1.5px solid #00A3E0;
    transform: rotate(45deg);
    pointer-events: none;
}

@keyframes cefelitoPillAppear {
    0% { transform: scale(0.85) translateY(8px); opacity: 0; }
    70% { transform: scale(1.02) translateY(-1px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ==========================================================================
   Ventana del Asistente Virtual (Chat Window - Diseño Luminoso Institucional)
   ========================================================================== */
.cefelito-chat-window {
    position: fixed;
    bottom: 96px;
    left: 24px;
    width: 385px;
    max-width: calc(100vw - 48px);
    height: 565px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border: 1px solid rgba(0, 163, 224, 0.28);
    border-radius: 20px;
    box-shadow: 0 16px 45px rgba(0, 48, 135, 0.16), 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transform-origin: bottom left;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cefelito-chat-window.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header del Chat: Azul Oficial con Acabado Institucional */
.cefelito-chat-header {
    background: linear-gradient(135deg, #003087 0%, #00449e 55%, #00A3E0 100%);
    border-bottom: 1px solid rgba(0, 163, 224, 0.25);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 48, 135, 0.12);
}

.cefelito-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cefelito-header-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.cefelito-header-avatar img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.cefelito-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.2px;
}

.cefelito-header-text h3 .badge-bot {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.cefelito-header-text p {
    margin: 2px 0 0 0;
    font-size: 11.5px;
    color: #e0f2fe;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.cefelito-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cefelito-btn-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cefelito-btn-close:hover {
    background: rgba(239, 68, 68, 0.85);
    border-color: #ef4444;
    color: #ffffff;
    transform: scale(1.06);
}

/* Área de Mensajes del Chat */
.cefelito-chat-messages {
    position: relative;
    flex: 1;
    padding: 16px;
    background: #f8fafc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 163, 224, 0.35) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Estilo de la barra de desplazamiento moderno y sin flechas */
.cefelito-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.cefelito-chat-messages::-webkit-scrollbar-button {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.cefelito-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.cefelito-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 163, 224, 0.35);
    border-radius: 10px;
}
.cefelito-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 163, 224, 0.6);
}

/* Ocultar sutilmente el launcher cuando el chat está abierto */
.cefelito-widget-wrap.cefelito-chat-open .cefelito-launcher {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: scale(0.65);
    transition: all 0.25s ease;
}

body.cefelito-locked {
    overflow: hidden !important;
    touch-action: none;
}

/* Burbujas de mensaje */
.cefelito-msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    animation: cefelitoMsgFade 0.3s ease;
}

@keyframes cefelitoMsgFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.cefelito-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #00A3E0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 48, 135, 0.1);
}

.cefelito-msg-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.cefelito-msg-row.bot .cefelito-msg-avatar img {
    animation: cefelitoAvatarPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cefelitoAvatarPop {
    0% { transform: scale(0.6) rotate(-10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.cefelito-msg-bubble {
    max-width: 84%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.cefelito-msg-row.bot .cefelito-msg-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.cefelito-msg-row.user .cefelito-msg-bubble {
    background: linear-gradient(135deg, #003087 0%, #0077b6 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    font-weight: 500;
    box-shadow: 0 3px 10px rgba(0, 48, 135, 0.22);
}

.cefelito-msg-bubble strong {
    color: #003087;
    font-weight: 700;
}

.cefelito-msg-row.user .cefelito-msg-bubble strong {
    color: #ffffff;
}

/* Opciones / Acciones Rápidas (Pills Limpias y Luminosas) */
.cefelito-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.cefelito-action-btn {
    background: #ffffff;
    border: 1.5px solid #bae6fd;
    color: #0369a1;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0, 48, 135, 0.03);
}

.cefelito-action-btn i {
    color: #00A3E0;
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.cefelito-action-btn .cefelito-btn-label {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.cefelito-action-btn .cefelito-btn-count,
.cefelito-action-btn span:last-child {
    margin-left: auto;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.75;
}

.cefelito-action-btn:hover {
    background: #f0f9ff;
    border-color: #00A3E0;
    color: #003087;
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 163, 224, 0.16);
}

/* Variantes temáticas de botones en diseño claro */
.cefelito-action-btn.btn-whatsapp {
    background: #f0fdf4 !important;
    border-color: #86efac !important;
    color: #15803d !important;
}
.cefelito-action-btn.btn-whatsapp i {
    color: #16a34a !important;
}
.cefelito-action-btn.btn-whatsapp:hover {
    background: #dcfce7 !important;
    border-color: #22c55e !important;
}

.cefelito-action-btn.btn-inscription {
    background: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
    color: #047857 !important;
}
.cefelito-action-btn.btn-inscription i {
    color: #059669 !important;
}
.cefelito-action-btn.btn-inscription:hover {
    background: #d1fae5 !important;
    border-color: #10b981 !important;
}

.cefelito-action-btn.btn-instagram {
    background: #fff1f2 !important;
    border-color: #fecdd3 !important;
    color: #be123c !important;
}
.cefelito-action-btn.btn-instagram i {
    color: #e11d48 !important;
}
.cefelito-action-btn.btn-instagram:hover {
    background: #ffe4e6 !important;
    border-color: #fb7185 !important;
}

.cefelito-action-btn.btn-facebook {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
}
.cefelito-action-btn.btn-facebook i {
    color: #2563eb !important;
}
.cefelito-action-btn.btn-facebook:hover {
    background: #dbeafe !important;
    border-color: #3b82f6 !important;
}

.cefelito-action-btn.btn-pdf {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #b91c1c !important;
}
.cefelito-action-btn.btn-pdf i {
    color: #dc2626 !important;
}
.cefelito-action-btn.btn-pdf:hover {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
}

/* Botón Destacado de Curso Directo */
.cefelito-action-btn.btn-course-main {
    background: linear-gradient(135deg, #003087 0%, #00A3E0 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(0, 163, 224, 0.28) !important;
}
.cefelito-action-btn.btn-course-main i {
    color: #ffffff !important;
}
.cefelito-action-btn.btn-course-main:hover {
    background: linear-gradient(135deg, #002266 0%, #0284c7 100%) !important;
    color: #ffffff !important;
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 18px rgba(0, 163, 224, 0.38) !important;
}

/* Enlaces inline seguros */
.cefelito-inline-link {
    color: #0088cc;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.cefelito-inline-link:hover {
    color: #003087;
}

/* Tarjetas de Cursos Encontrados en el Chat */
.cefelito-course-card {
    background: #ffffff;
    border: 1.5px solid #e0f2fe;
    border-radius: 14px;
    padding: 12px 14px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-shadow: 0 4px 12px rgba(0, 48, 135, 0.05);
}

.cefelito-course-card-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #003087;
}

.cefelito-course-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    color: #64748b;
}

.cefelito-course-card-cat {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.cefelito-course-card-btn {
    background: linear-gradient(135deg, #003087 0%, #00A3E0 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 48, 135, 0.18);
}

.cefelito-course-card-btn:hover {
    background: linear-gradient(135deg, #00A3E0 0%, #0284c7 100%);
    box-shadow: 0 4px 12px rgba(0, 163, 224, 0.35);
}

/* Footer / Input del Chat */
.cefelito-chat-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
}

.cefelito-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.cefelito-input {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 24px;
    padding: 10px 16px;
    color: #0f172a;
    font-size: 13px;
    outline: none;
    transition: all 0.25s ease;
}

.cefelito-input::placeholder {
    color: #94a3b8;
    font-size: 12.5px;
}

.cefelito-input:focus {
    border-color: #00A3E0;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.15);
}

.cefelito-btn-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003087 0%, #00A3E0 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(0, 163, 224, 0.3);
}

.cefelito-btn-send:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, #00A3E0 0%, #0284c7 100%);
    box-shadow: 0 4px 14px rgba(0, 48, 135, 0.3);
}

/* Indicador escribiendo (Typing Dots) */
.cefelito-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
}

.cefelito-typing-dots span {
    width: 6px;
    height: 6px;
    background: #00A3E0;
    border-radius: 50%;
    animation: cefelitoTypingAnim 1.4s infinite ease-in-out both;
}

.cefelito-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.cefelito-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes cefelitoTypingAnim {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* ==========================================================================
   Adaptación Responsive Integral (Desktop, Tablets y Móviles)
   ========================================================================== */

/* Tablets e intermedias */
@media (min-width: 641px) and (max-width: 991px) {
    .cefelito-widget-wrap {
        bottom: 22px;
        left: 20px;
    }

    .cefelito-chat-window {
        bottom: 92px;
        left: 20px;
        width: 370px;
        max-width: calc(100vw - 40px);
        height: 520px;
        max-height: calc(100dvh - 110px);
    }
}

/* Teléfonos y Dispositivos Móviles */
@media (max-width: 640px) {
    .cefelito-widget-wrap {
        bottom: 16px;
        left: 14px;
    }

    /* Píldora de saludo compacta y adaptada a pantallas móviles */
    .cefelito-speech-bubble {
        display: inline-flex;
        margin-bottom: 8px;
        padding: 5px 10px 5px 12px;
        font-size: 11.5px;
        max-width: calc(100vw - 28px);
        white-space: nowrap;
        box-shadow: 0 4px 14px rgba(0, 48, 135, 0.12);
        animation: cefelitoPillAppear 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform, opacity;
    }

    .cefelito-bubble-content {
        gap: 4px;
        font-size: 11.5px;
    }

    .cefelito-speech-bubble-close {
        width: 18px;
        height: 18px;
        font-size: 9px;
        margin-left: 2px;
    }

    /* Optimización de rendimiento móvil: aceleración por hardware pura sin filtros pesados */
    .cefelito-character-wrap {
        width: 48px;
        height: 54px;
        will-change: transform;
        transform: translateZ(0); /* Capa GPU independiente para evitar lag al scrollear */
    }

    .cefelito-character-wrap .cefelito-character-img {
        /* Sombra ultra ligera de 1 solo pase para no sobrecargar la GPU del móvil */
        filter: drop-shadow(0 3px 6px rgba(0, 48, 135, 0.25)) !important;
        will-change: transform;
        transform: translateZ(0);
    }

    .cefelito-ground-shadow {
        bottom: -4px;
        left: 10px;
        right: 10px;
        height: 8px;
        will-change: transform, opacity;
        transform: translateZ(0);
    }

    /* En móviles el modal ocupa pantalla completa estilo App Nativa */
    .cefelito-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        width: 100%;
        height: 100dvh;
        height: 100vh;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        z-index: 10000000;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transform-origin: center bottom;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    }

    .cefelito-chat-window.is-open {
        transform: translateY(0);
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* Header optimizado con safe area para móviles */
    .cefelito-chat-header {
        padding: max(14px, env(safe-area-inset-top)) 16px 12px;
        border-radius: 0;
    }

    .cefelito-header-avatar {
        width: 40px;
        height: 40px;
    }

    .cefelito-header-avatar img {
        width: 32px;
        height: 32px;
    }

    .cefelito-header-text h3 {
        font-size: 15px;
    }

    .cefelito-btn-close {
        width: 38px;
        height: 38px;
        font-size: 20px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .cefelito-btn-close:active {
        transform: scale(0.92);
    }

    /* Área de mensajes con mejor espacio horizontal */
    .cefelito-chat-messages {
        padding: 16px 14px;
        gap: 13px;
    }

    .cefelito-msg-bubble {
        max-width: 88%;
        font-size: 13.5px;
        line-height: 1.5;
        padding: 11px 14px;
        border-radius: 18px;
    }

    .cefelito-msg-avatar {
        width: 32px;
        height: 32px;
    }

    .cefelito-msg-avatar img {
        width: 28px;
        height: 28px;
    }

    /* Acciones rápidas (Pills) cómodas para pulsar en pantalla táctil */
    .cefelito-action-btn {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 12px;
    }

    /* Footer / Input móvil con safe area */
    .cefelito-chat-footer {
        padding: 10px 12px max(12px, env(safe-area-inset-bottom));
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
    }

    .cefelito-input {
        font-size: 15px; /* Evita auto-zoom en iOS Safari */
        padding: 10px 16px;
        border-radius: 24px;
    }

    .cefelito-input::placeholder {
        font-size: 13px;
    }

    .cefelito-btn-send {
        width: 42px;
        height: 42px;
        font-size: 14px;
    }
}

/* Pantallas muy pequeñas (menos de 380px) */
@media (max-width: 380px) {
    .cefelito-chat-messages {
        padding: 12px 10px;
    }

    .cefelito-msg-bubble {
        max-width: 92%;
        font-size: 13px;
    }

    .cefelito-action-btn {
        padding: 9px 12px;
        font-size: 12.5px;
    }
}

/* ==========================================================================
   OPTIMIZACIONES INTELIGENTES CEFELITO:
   1. Orientador Vocacional en 2 clics
   2. Rich Cards (Mini Tarjetas Visuales de Cursos)
   3. WhatsApp Inteligente con mensaje contextual pre-armado
   4. Conexión interactiva Chat <-> Mapa con resplandor luminoso
   5. Botón TTS de Lectura por Voz
   6. Botón de Reinicio en Header
   ========================================================================== */

/* Contenedor de Tarjetas de Curso */
.cefelito-cards-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    width: 100%;
}

.cefelito-course-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(0, 48, 135, 0.05);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.cefelito-course-card:hover {
    border-color: #0284c7;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12);
    transform: translateY(-1px);
}

.cefelito-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.cefelito-card-title {
    color: #003087;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.35;
    flex: 1;
}

.cefelito-card-badge-open {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.cefelito-card-badge-regular {
    background: #f1f5f9;
    color: #475569;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.cefelito-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 11.5px;
    color: #64748b;
    border-top: 1px dashed #e2e8f0;
    padding-top: 6px;
}

.cefelito-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cefelito-meta-item i {
    color: #0284c7;
    font-size: 11px;
}

.cefelito-card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

@media (min-width: 480px) {
    .cefelito-card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .cefelito-btn-card-wa {
        grid-column: span 2;
    }
}

.cefelito-btn-card-inscribirme {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    transition: all 0.2s ease;
}

.cefelito-btn-card-inscribirme:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.cefelito-btn-card-map {
    background: #f0f9ff !important;
    border: 1.5px solid #bae6fd !important;
    color: #0284c7 !important;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cefelito-btn-card-map:hover {
    background: #e0f2fe !important;
    border-color: #0284c7 !important;
}

.cefelito-btn-card-wa {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    color: #15803d !important;
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cefelito-btn-card-wa:hover {
    background: #25d366 !important;
    color: #ffffff !important;
    border-color: #25d366 !important;
}

/* Botón TTS (Lectura por Voz) */
.cefelito-tts-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.cefelito-tts-btn i {
    color: #0284c7;
    font-size: 11px;
}

.cefelito-tts-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.cefelito-tts-btn:hover i {
    color: #ffffff;
}

.cefelito-tts-btn.is-speaking {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    animation: cefelitoPulseAnim 1.5s infinite;
}

.cefelito-tts-btn.is-speaking i {
    color: #ffffff;
}

/* Botón Header Reset / Reiniciar */
.cefelito-header-btn-reset {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    margin-right: 6px;
}

.cefelito-header-btn-reset:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

/* Resplandor luminoso en el mapa interactivo */
@keyframes cflGlowPulseAnim {
    0% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.85);
        outline: 3px solid #0284c7;
    }
    50% {
        box-shadow: 0 0 28px 8px rgba(245, 158, 11, 0.75), 0 0 0 4px #f59e0b;
        outline: 3px solid #f59e0b;
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        outline: none;
    }
}

.cfl-card-glow-pulse {
    animation: cflGlowPulseAnim 2.8s ease-out forwards !important;
}

/* Botón Destacado del Orientador Vocacional */
.cefelito-btn-vocacional {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35) !important;
}

.cefelito-btn-vocacional i {
    color: #ffffff !important;
}

.cefelito-btn-vocacional:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}
