/* ==========================================================================
   notify.css - capa de notificaciones del sistema de gestion
   Toasts (mensajes flash), alertas en linea y dialogo de confirmacion.

   NO hay un solo hex aca: todos los colores se derivan con color-mix() de los
   tokens ya validados de viz.css. Cambiar la paleta en viz.css repinta las
   notificaciones solas, y no obliga a re-correr el validador.
   ========================================================================== */

:root {
    /* Rol de cada tipo de mensaje. `info` es tinta neutra a proposito: los
       tokens de serie son identidad de datos, no estado de la interfaz. */
    --notify-success: var(--viz-good, #0ca30c);
    --notify-warning: var(--viz-warning, #fab219);
    --notify-danger:  var(--viz-critical, #d03b3b);
    --notify-info:    var(--viz-ink-soft, #52514e);

    --notify-radius: 10px;
    --notify-ancho: 24rem;
}

/* ==========================================================================
   1. Pila de toasts
   ========================================================================== */

.notify-stack {
    position: fixed;
    /* Debajo de la navbar fija. --nav-alto lo define chrome.css y cambia
       en movil; el fallback cubre las paginas que no cargan esa capa. */
    top: calc(var(--nav-alto, 56px) + 1rem);
    right: 1rem;
    z-index: 1085;              /* sobre navbar (1030) y overlay (1039) */
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: min(var(--notify-ancho), calc(100vw - 2rem));
    pointer-events: none;       /* la pila no bloquea clics; cada toast si */
}

/* En movil ocupa el ancho util y se ancla arriba del pulgar. */
@media (max-width: 576px) {
    .notify-stack {
        top: calc(56px + 0.5rem);
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
    }
}

/* ==========================================================================
   2. El toast
   ========================================================================== */

.notify {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 0.875rem 0.875rem 1rem;
    overflow: hidden;
    pointer-events: auto;

    background: var(--viz-surface, #fff);
    color: var(--viz-ink, #0b0b0b);
    border: 1px solid var(--viz-grid, #e1e0d9);
    border-left: 4px solid var(--notify-acento);
    border-radius: var(--notify-radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);

    /* Estado de entrada; .notify-visible lo lleva a su lugar. */
    opacity: 0;
    transform: translateX(1.25rem);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.notify-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Salida: se desvanece y colapsa su alto para que la pila se cierre sola. */
.notify-saliendo {
    opacity: 0;
    transform: translateX(1.25rem);
    margin-bottom: calc(-1 * var(--notify-alto, 0px) - 0.625rem);
    transition: opacity 0.18s ease, transform 0.18s ease, margin-bottom 0.18s ease 0.02s;
}

.notify-success { --notify-acento: var(--notify-success); }
.notify-warning { --notify-acento: var(--notify-warning); }
.notify-danger  { --notify-acento: var(--notify-danger); }
.notify-info    { --notify-acento: var(--notify-info); }

/* Icono en una pastilla lavada: identifica el tipo sin depender del color,
   y evita pintar el texto de un color de estado (regla de dashboards-vyl). */
.notify-icono {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    color: var(--notify-acento);
    background: color-mix(in srgb, var(--notify-acento) 14%, var(--viz-surface, #fff));
}

.notify-cuerpo {
    flex: 1 1 auto;
    min-width: 0;
}

.notify-titulo {
    margin: 0 0 0.125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--viz-ink, #0b0b0b);
}

.notify-mensaje {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--viz-ink-soft, #52514e);
    overflow-wrap: anywhere;
}

.notify-cerrar {
    flex: 0 0 auto;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--viz-ink-muted, #898781);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.notify-cerrar:hover,
.notify-cerrar:focus-visible {
    background: color-mix(in srgb, var(--viz-ink, #0b0b0b) 8%, transparent);
    color: var(--viz-ink, #0b0b0b);
}

/* Barra de vida: dice cuanto queda antes de que el toast se vaya solo.
   Se pausa al pasar el mouse o al enfocar (ver notify.js). */
.notify-progreso {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    transform-origin: left center;
    background: var(--notify-acento);
    opacity: 0.45;
    animation: notify-vida linear forwards;
}

.notify[data-pausado="true"] .notify-progreso {
    animation-play-state: paused;
}

@keyframes notify-vida {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ==========================================================================
   3. Alerta en linea
   Para errores atados a un formulario (login, validaciones): se queda quieta
   junto al campo en vez de irse volando como un toast.
   ========================================================================== */

.notify-inline {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid color-mix(in srgb, var(--notify-acento) 35%, var(--viz-grid, #e1e0d9));
    border-left: 4px solid var(--notify-acento);
    border-radius: 8px;
    background: color-mix(in srgb, var(--notify-acento) 8%, var(--viz-surface, #fff));
    color: var(--viz-ink, #0b0b0b);
    font-size: 0.875rem;
    line-height: 1.45;
}

.notify-inline .notify-icono {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.875rem;
    background: transparent;
}

.notify-inline.notify-success { --notify-acento: var(--notify-success); }
.notify-inline.notify-warning { --notify-acento: var(--notify-warning); }
.notify-inline.notify-danger  { --notify-acento: var(--notify-danger); }
.notify-inline.notify-info    { --notify-acento: var(--notify-info); }

/* Sacude una vez al aparecer: el error de login llega tras recargar la pagina
   y sin movimiento se confunde con parte del formulario. */
.notify-inline-anim {
    animation: notify-entrada 0.3s ease both;
}

@keyframes notify-entrada {
    0%   { opacity: 0; transform: translateY(-0.375rem); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   3b. Panel de guia y nota al pie
   Texto de ayuda que vive SIEMPRE en la pagina (que hace este formulario, por
   que el stock no se edita aca). No es un evento: no lleva color de estado ni
   pide accion, asi que recede en vez de gritar. Reemplaza a los `alert-info`
   de Bootstrap, que pintaban de azul intenso un "los campos * son obligatorios".
   ========================================================================== */

.notify-panel {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--viz-grid, #e1e0d9);
    border-radius: 8px;
    background: color-mix(in srgb, var(--viz-ink, #0b0b0b) 3%, var(--viz-surface, #fff));
    color: var(--viz-ink-soft, #52514e);
    font-size: 0.875rem;
    line-height: 1.5;
}

.notify-panel .notify-icono {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    font-size: 0.9375rem;
    background: transparent;
    color: var(--viz-ink-muted, #898781);
}

.notify-panel strong,
.notify-panel .notify-panel-titulo {
    color: var(--viz-ink, #0b0b0b);
    font-weight: 600;
}

.notify-panel .notify-panel-titulo {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.notify-panel ul {
    margin: 0;
    padding-left: 1.125rem;
}

.notify-panel li + li { margin-top: 0.1875rem; }

.notify-panel a {
    color: var(--viz-series-1, #2a78d6);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Un panel que ademas advierte: gana la barra de acento y el icono en color,
   pero conserva el fondo tenue. La urgencia la carga el borde, no un bloque. */
.notify-panel.notify-success,
.notify-panel.notify-warning,
.notify-panel.notify-danger {
    border-left: 3px solid var(--notify-acento);
}

.notify-panel.notify-success .notify-icono,
.notify-panel.notify-warning .notify-icono,
.notify-panel.notify-danger .notify-icono {
    color: var(--notify-acento);
}

/* Nota al pie: una linea de ayuda no necesita caja. */
.notify-nota {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--viz-ink-muted, #898781);
}

.notify-nota .bi { margin-top: 0.0625rem; }

/* ==========================================================================
   4. Dialogo de confirmacion
   Reemplaza a window.confirm() en las acciones destructivas.
   ========================================================================== */

.notify-confirm-fondo {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.notify-confirm-fondo.notify-visible { opacity: 1; }

.notify-confirm {
    width: min(26rem, 100%);
    padding: 1.5rem;
    background: var(--viz-surface, #fff);
    color: var(--viz-ink, #0b0b0b);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
    transform: translateY(0.75rem) scale(0.98);
    transition: transform 0.18s ease;
}

.notify-confirm-fondo.notify-visible .notify-confirm {
    transform: translateY(0) scale(1);
}

.notify-confirm .notify-icono {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.875rem;
    font-size: 1.375rem;
}

.notify-confirm-titulo {
    margin: 0 0 0.375rem;
    font-size: 1.0625rem;
    font-weight: 600;
}

.notify-confirm-texto {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--viz-ink-soft, #52514e);
}

.notify-confirm-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ==========================================================================
   5. Movimiento reducido
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .notify,
    .notify-saliendo,
    .notify-confirm,
    .notify-confirm-fondo {
        transition-duration: 0.01ms;
    }
    .notify-progreso,
    .notify-inline-anim {
        animation: none;
    }
    .notify { transform: none; }
}
