/* ===== Coachmark (ayuda) ===== */
.cm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none; /* no bloquea todo por defecto */
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.cm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    animation: cmFadeIn .25s ease forwards;
    pointer-events: auto; /* sí captura click para cerrar */
}

.cm-highlight {
    position: fixed;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .0), /* lo controla el backdrop */ 0 0 0 3px rgba(255, 255, 255, .9),
    0 10px 30px rgba(0, 0, 0, .35);
    outline: 2px solid rgba(59, 130, 246, .9);
    outline-offset: 2px;
    pointer-events: none;
    animation: cmPulse 1.2s ease-in-out infinite;
}

.cm-bubble {
    position: fixed;
    max-width: min(320px, calc(100vw - 24px));
    background: #fff;
    color: #0f172a;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
    padding: 12px 12px 10px;
    opacity: 0;
    transform: translateY(8px) scale(.98);
    animation: cmPop .25s ease forwards;
    pointer-events: auto; /* para poder click */
}

.cm-title {
    font-weight: 700;
    font-size: 14px;
    margin: 0 0 6px;
}

.cm-text {
    font-size: 13px;
    line-height: 1.35;
    margin: 0 0 10px;
    color: #334155;
}

.cm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.cm-btn {
    border: 0;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}

.cm-btn-primary {
    background: #2563eb;
    color: #fff;
}

.cm-btn-ghost {
    background: #eef2ff;
    color: #1e3a8a;
}

/* Flechita (se ajusta según placement con data-placement) */
.cm-bubble::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
}

.cm-bubble[data-placement="top"]::after {
    bottom: -6px;
    left: 18px;
}

.cm-bubble[data-placement="bottom"]::after {
    top: -6px;
    left: 18px;
}

.cm-bubble[data-placement="left"]::after {
    right: -6px;
    top: 16px;
}

.cm-bubble[data-placement="right"]::after {
    left: -6px;
    top: 16px;
}

.cm-media {
    margin-top: 6px;
}

.cm-img {
    display: block;
    width: 100%;
    max-width: 250px; /* ajusta si quieres */
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

.cm-caption {
    margin-top: 8px;
    font-size: 12px;
    opacity: .85;
}

.cm-text {
    font-size: 13px;
    line-height: 1.35;
}

/* ===== MODO: imagen sin fondo ===== */
.cm-bubble.cm-has-image {
    background: transparent; /* quita el fondo global */
    box-shadow: none; /* evita sombra duplicada */
    padding: 0; /* el padding lo damos por secciones */
}

/* La flecha debe verse como tarjeta (blanca) aunque el contenedor sea transparente */
.cm-bubble.cm-has-image::after {
    background: #fff; /* flechita blanca */
    box-shadow: 0 6px 16px rgba(0, 0, 0, .20);
}

/* Envolvemos título/media/actions como “tarjetas” separadas */
.cm-bubble.cm-has-image .cm-title,
.cm-bubble.cm-has-image .cm-text,
.cm-bubble.cm-has-image .cm-caption,
.cm-bubble.cm-has-image .cm-actions {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
    padding: 12px;
}

/* Ajustes de separación */
.cm-bubble.cm-has-image .cm-title {
    margin: 0 0 10px;
}

.cm-bubble.cm-has-image .cm-text {
    margin: 10px 0;
}

.cm-bubble.cm-has-image .cm-actions {
    margin-top: 10px;
    justify-content: flex-end;
    background: transparent !important;
    box-shadow: none !important;
}

.cm-bubble.cm-has-image .cm-actions {

}

/* La zona de la imagen queda transparente */


/* Imagen SIN fondo + sin sombra (si quieres) */
.cm-bubble.cm-has-image .cm-img {
    background: transparent !important;
    box-shadow: none; /* quita sombra para que se vea “flotando” */
    border-radius: 0; /* opcional, para respetar transparencia */
    max-width: 200px; /* ajusta */
}

/* ===== Ajustes mobile ===== */
.cm-overlay {
    overscroll-behavior: contain;
}

.cm-bubble {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cm-btn {
    min-height: 44px; /* mejor para touch */
}

@media (max-width: 768px) {
    .cm-bubble {
        width: calc(100vw - 24px);
        max-width: none;
    }

    .cm-bubble.cm-has-image .cm-img {
        max-width: 100%;
        height: auto;
    }

    .cm-highlight {
        border-radius: 10px;
    }
}
.cm-text {
    white-space: normal;
    line-height: 1.5;
}

.cm-typing {
    min-height: 1.2em;
}

.cm-typing-cursor.cm-typing-active::after {
    content: "|";
    display: inline-block;
    margin-left: 2px;
    animation: cmBlinkCursor .8s step-end infinite;
    opacity: 1;
}

@keyframes cmBlinkCursor {
    50% {
        opacity: 0;
    }
}
/* Si quieres mantener bordes redondeados pero sin fondo:
.cm-bubble.cm-has-image .cm-img{ border-radius: 12px; }
*/
@keyframes cmPop {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cmFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes cmPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
    }
}
