/*
 * Toasts de Coudibot (estilo C1 · tarjeta blanca con ícono flotante)
 * Un solo lugar para todos los avisos: mensajes de Django y llamadas desde JS.
 * Uso desde JS:  coudiToast.success('Guardado')  ·  coudiToast('error', 'No se pudo guardar')
 * Ver static/js/coudi-toast.js
 */

.ctoast-pila {
    position: fixed;
    top: 36px; /* deja espacio al ícono, que sobresale por arriba de la tarjeta */
    right: 20px;
    z-index: 1100; /* encima de los modales de Bootstrap (1055) */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 30px;
    width: 380px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.ctoast {
    --c: #0382f8;      /* color del ícono y la barra */
    --tx: #0261c4;     /* color del título (más oscuro para leerse sobre blanco) */
    --soft: #eff6ff;   /* círculo decorativo */
    position: relative;
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 14px 40px 18px 74px;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .05);
    font-family: "Noto Sans", sans-serif;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(110%) scale(.95);
    transition: opacity .35s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.ctoast.show { opacity: 1; transform: none; }

/* Círculo suave decorativo en la esquina inferior izquierda */
.ctoast-deco { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; pointer-events: none; }
.ctoast-deco::before {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    left: -30px;
    bottom: -44px;
    border-radius: 50%;
    background: var(--soft);
}

/* Ícono flotante: círculo sólido con anillo y resplandor del color del tipo */
.ctoast-ico {
    position: absolute;
    left: 16px;
    top: -16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 21px;
    color: #fff;
    background: var(--c);
    box-shadow:
        0 0 0 5px color-mix(in srgb, var(--c) 28%, transparent),
        0 0 20px color-mix(in srgb, var(--c) 55%, transparent);
}
.ctoast-ico .ti-info-small { font-size: 34px; }

.ctoast-txt { position: relative; flex: 1; min-width: 0; }
.ctoast-tit { font-weight: 700; font-size: 14px; line-height: 1.3; color: var(--tx); }
.ctoast-sub { font-weight: 600; color: #0f172a; }  /* va dentro de .ctoast-msg, antes del motivo */
.ctoast-msg { font-size: 13px; line-height: 1.45; margin-top: 2px; color: #475569; overflow-wrap: anywhere; white-space: pre-line; }
/* Respaldo para mensajes muy largos: máximo ~5 líneas, el resto con scroll dentro del toast */
.ctoast-msg { max-height: 7.3em; overflow-y: auto; }
.ctoast-msg a { color: var(--tx); text-decoration: underline; }

.ctoast-x {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: #64748b;
    opacity: .7;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 15px;
}
.ctoast-x:hover { opacity: 1; background: #f1f5f9; }

/* Barra de tiempo: al vaciarse se cierra el toast; se pausa con el mouse encima */
.ctoast-bar {
    position: absolute;
    left: 12px;
    bottom: 5px;
    height: 3px;
    width: calc(100% - 24px);
    border-radius: 3px;
    background: var(--c);
    opacity: .45;
    transform-origin: left;
    animation: ctoast-tiempo var(--dur, 4s) linear forwards;
}
.ctoast:hover .ctoast-bar { animation-play-state: paused; }
@keyframes ctoast-tiempo { to { transform: scaleX(0); } }

/* Colores por tipo (paleta del panel; info = azul de marca) */
.ctoast.success { --c: #22c55e; --tx: #15803d; --soft: #f0fdf4; }
.ctoast.error   { --c: #ef4444; --tx: #dc2626; --soft: #fef2f2; }
.ctoast.warning { --c: #f59e0b; --tx: #b45309; --soft: #fffbeb; }
.ctoast.info    { --c: #0382f8; --tx: #0261c4; --soft: #eff6ff; }

@media (max-width: 480px) {
    .ctoast-pila { top: 28px; left: 16px; right: 16px; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ctoast { transition: opacity .2s ease; transform: none; }
}
