/* Burbuja de mensajes (Components/Shared/BurbujaMensajes.razor).
   Todo va con prefijo msj- para no chocar con nada de la plataforma. */

.msj-raiz {
    --msj-cyan: #00C8FF;
    --msj-cyan-osc: #00A6D6;
    --msj-morado: #50007D;
    --msj-morado-claro: #F4ECF9;
    --msj-texto: #2B2B2B;
    --msj-suave: #6B6B76;
    --msj-borde: #E6E3EA;
    --msj-fondo: #F5F5F5;
    position: fixed;
    right: 20px;
    bottom: 48px; /* por encima del pie fijo de 32px */
    z-index: 990;  /* por debajo de los diálogos de Syncfusion */
    font-family: var(--fd-font, 'Outfit', system-ui, sans-serif);
    color: var(--msj-texto);
}

.msj-svg { width: 22px; height: 22px; display: block; }

/* ── Botón flotante ─────────────────────────────────────────────── */
.msj-boton {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--msj-cyan);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 120, 160, .35), 0 2px 4px rgba(0, 0, 0, .12);
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.msj-boton .msj-svg { width: 28px; height: 28px; }
.msj-boton:hover { background: var(--msj-cyan-osc); transform: translateY(-2px); }
.msj-boton:focus-visible { outline: 3px solid var(--msj-morado); outline-offset: 3px; }
.msj-boton-abierto .msj-svg { width: 24px; height: 24px; }

.msj-contador {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #E5484D;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    border: 2px solid #fff;
    box-sizing: border-box;
}

.msj-pulso { animation: msj-latido 1.2s ease-out 2; }
@keyframes msj-latido {
    0%   { box-shadow: 0 0 0 0 rgba(0, 200, 255, .65), 0 6px 18px rgba(0, 120, 160, .35); }
    100% { box-shadow: 0 0 0 18px rgba(0, 200, 255, 0), 0 6px 18px rgba(0, 120, 160, .35); }
}

/* ── Panel ─────────────────────────────────────────────────────── */
.msj-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 380px;
    height: min(600px, calc(100vh - 150px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(40, 0, 70, .22), 0 2px 8px rgba(0, 0, 0, .08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: msj-entrar .18s ease-out;
}
@keyframes msj-entrar {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.msj-cab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 16px;
    background: var(--msj-morado);
    color: #fff;
    flex: 0 0 auto;
}
.msj-cab-texto { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.msj-cab-texto b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msj-cab-texto small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msj-icono-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: inherit;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.msj-cab .msj-icono-btn:hover { background: rgba(255, 255, 255, .14); }
.msj-icono-btn:disabled { opacity: .4; cursor: default; }

.msj-aviso-lectura {
    margin: 10px 12px 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: #FFF6E0;
    color: #6B4A00;
    font-size: 12.5px;
}

.msj-buscar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 12px 6px;
    padding: 0 12px;
    height: 40px;
    border-radius: 12px;
    background: var(--msj-fondo);
    color: var(--msj-suave);
}
.msj-buscar .msj-svg { width: 18px; height: 18px; }
.msj-buscar input {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    outline: none;
    font: inherit;
    font-size: 14px;
    color: var(--msj-texto);
    min-width: 0;
}

.msj-varios {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 12px 6px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px dashed #C9B3D8;
    background: var(--msj-morado-claro);
    color: var(--msj-morado);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.msj-varios .msj-svg { width: 18px; height: 18px; }
.msj-varios:hover { background: #EBDDF4; }

/* ── Lista de contactos ────────────────────────────────────────── */
.msj-lista { flex: 1 1 auto; overflow-y: auto; padding: 0 6px 10px; }

.msj-grupo {
    position: sticky;
    top: 0;
    margin: 0;
    padding: 10px 10px 6px;
    background: #fff;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--msj-suave);
    z-index: 1;
}
.msj-grupo span { margin-left: 4px; font-weight: 500; opacity: .7; }

.msj-contacto {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.msj-contacto:hover { background: var(--msj-fondo); }
.msj-contacto:focus-visible { outline: 2px solid var(--msj-cyan); outline-offset: -2px; }

.msj-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 600;
    background: #EEE;
    color: #555;
}
.msj-avatar-cab { width: 34px; height: 34px; font-size: 13px; }
.msj-av-0 { background: #DDF6FF; color: #00698A; } /* mis estudiantes */
.msj-av-1 { background: #FFF0D4; color: #8A5800; } /* mis tutorados */
.msj-av-2 { background: #F0E3F8; color: #50007D; } /* mis analistas */
.msj-av-3 { background: #ECE8FA; color: #4E3A9E; } /* analistas y tutores */
.msj-av-4 { background: #E1F4E8; color: #1D7343; } /* coordinación */

.msj-contacto-texto { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msj-fila1, .msj-fila2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.msj-fila1 b { flex: 1 1 auto; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msj-fila1 time { flex: 0 0 auto; font-size: 11.5px; color: var(--msj-suave); }
.msj-ultimo, .msj-relacion {
    flex: 1 1 auto;
    font-size: 12.5px;
    color: var(--msj-suave);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msj-sin-leer .msj-fila1 b, .msj-sin-leer .msj-ultimo { font-weight: 700; color: var(--msj-texto); }
.msj-sin-leer .msj-fila1 time { color: var(--msj-cyan-osc); font-weight: 600; }
.msj-pill {
    flex: 0 0 auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--msj-cyan);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-sizing: border-box;
}

.msj-vacio { padding: 28px 18px; text-align: center; font-size: 13.5px; color: var(--msj-suave); }
.msj-vacio-chat { margin: auto 0; }
.msj-enlace { border: none; background: none; color: var(--msj-morado); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ── Conversación ──────────────────────────────────────────────── */
.msj-mensajes {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 12px 8px;
    background: var(--msj-fondo);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msj-dia { display: flex; justify-content: center; margin: 10px 0 6px; }
.msj-dia span {
    padding: 3px 10px;
    border-radius: 10px;
    background: #fff;
    color: var(--msj-suave);
    font-size: 11.5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.msj-dia span::first-letter { text-transform: uppercase; }

.msj-burbuja-msj {
    max-width: 80%;
    padding: 8px 12px 6px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.msj-burbuja-msj p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msj-mio { align-self: flex-end; background: var(--msj-morado); color: #fff; border-bottom-right-radius: 6px; }
.msj-suyo { align-self: flex-start; background: #fff; color: var(--msj-texto); border-bottom-left-radius: 6px; }

.msj-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 11px;
    opacity: .75;
    white-space: nowrap;
}
.msj-check { font-weight: 700; letter-spacing: -2px; }
.msj-visto { color: var(--msj-cyan); opacity: 1; }
.msj-mio .msj-meta { color: rgba(255, 255, 255, .85); }

.msj-etiqueta-aviso {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    opacity: .85;
}
.msj-etiqueta-aviso .msj-svg { width: 14px; height: 14px; }

.msj-imagen { display: block; margin: 2px 0 6px; }
.msj-imagen img { display: block; max-width: 100%; max-height: 240px; border-radius: 10px; }

/* ── Redactar ──────────────────────────────────────────────────── */
.msj-redactar { flex: 0 0 auto; padding: 8px 10px 10px; border-top: 1px solid var(--msj-borde); background: #fff; }
.msj-redactar-fila { display: flex; align-items: flex-end; gap: 6px; }
.msj-redactar textarea {
    flex: 1 1 auto;
    min-width: 0;
    resize: none;
    border: 1px solid var(--msj-borde);
    border-radius: 18px;
    padding: 9px 14px;
    font: inherit;
    font-size: 14px;
    line-height: 1.35;
    max-height: 140px;
    outline: none;
    background: #fff;
    color: var(--msj-texto);
}
.msj-redactar textarea:focus { border-color: var(--msj-cyan); box-shadow: 0 0 0 3px rgba(0, 200, 255, .18); }

.msj-adjuntar { position: relative; color: var(--msj-suave); overflow: hidden; }
.msj-adjuntar:hover { background: var(--msj-fondo); color: var(--msj-morado); }
.msj-archivo { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.msj-enviar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--msj-cyan);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.msj-enviar .msj-svg { width: 20px; height: 20px; }
.msj-enviar:hover:not(:disabled) { background: var(--msj-cyan-osc); }
.msj-enviar:disabled { background: #CFEFFA; cursor: default; }

.msj-adjunto { position: relative; display: inline-block; margin: 0 0 8px 44px; }
.msj-adjunto img { display: block; max-height: 90px; border-radius: 10px; border: 1px solid var(--msj-borde); }
.msj-quitar {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #444;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
}
.msj-quitar .msj-svg { width: 14px; height: 14px; }

.msj-error { margin: 0 0 6px; font-size: 12.5px; color: #C62828; }

/* ── Mensaje a varios ──────────────────────────────────────────── */
.msj-difusion { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msj-paso { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--msj-suave); }
.msj-grupos-difusion { display: flex; flex-wrap: wrap; gap: 8px; }
.msj-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--msj-borde);
    background: #fff;
    color: var(--msj-texto);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.msj-chip span { font-size: 11.5px; padding: 0 6px; border-radius: 8px; background: var(--msj-fondo); color: var(--msj-suave); }
.msj-chip:hover:not(:disabled) { border-color: var(--msj-cyan); }
.msj-chip-activo { border-color: var(--msj-morado); background: var(--msj-morado); color: #fff; }
.msj-chip-activo span { background: rgba(255, 255, 255, .2); color: #fff; }

.msj-texto-difusion {
    resize: vertical;
    min-height: 110px;
    border: 1px solid var(--msj-borde);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    outline: none;
}
.msj-texto-difusion:focus { border-color: var(--msj-cyan); box-shadow: 0 0 0 3px rgba(0, 200, 255, .18); }
.msj-progreso { font-size: 13px; color: var(--msj-morado); }
.msj-enviar-varios {
    align-self: flex-end;
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    background: var(--msj-cyan);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.msj-enviar-varios:hover:not(:disabled) { background: var(--msj-cyan-osc); }
.msj-enviar-varios:disabled { background: #CFEFFA; cursor: default; }

/* ── Celular: el panel ocupa la pantalla ───────────────────────── */
@media (max-width: 560px) {
    .msj-raiz { right: 14px; bottom: 44px; }
    .msj-panel {
        position: fixed;
        inset: 8px 8px 112px 8px;
        width: auto;
        height: auto;
        border-radius: 16px;
    }
    .msj-burbuja-msj { max-width: 88%; }
}
