/*
 * avisos.css — las notificaciones del sistema (2026-10-21, SDD §10.7).
 *
 * Arriba a la derecha, una por tipo de color: éxito, error, atención e
 * información. Filete y círculo del color del aviso, título en versalitas,
 * botón de cerrar y una barra abajo que se vacía durante el tiempo que el aviso
 * está visible (al pasar el ratón por encima se detiene). Fondo de vidrio
 * esmerilado al estilo iOS: translúcido y desenfocado, con su versión clara y
 * su versión oscura. Todo va bajo el prefijo .nx-aviso: no toca nada más.
 */
.nx-avisos {
  position: fixed; top: 1rem; right: 1rem; z-index: 2000;
  display: flex; flex-direction: column; gap: .65rem;
  width: min(25rem, calc(100vw - 2rem));
  pointer-events: none;
}
.nx-aviso {
  --nx-color: #198754;
  --nx-titulo: #146c43;
  position: relative; overflow: hidden; pointer-events: auto;
  display: grid; grid-template-columns: 2rem 1fr; column-gap: .85rem; align-items: start;
  padding: .95rem 2.6rem 1.1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08);
  color: #1f2937;
  font-size: .875rem; line-height: 1.4;
  animation: nx-entra .28s cubic-bezier(.2, .8, .2, 1);
}
.nx-aviso.nx-sale { animation: nx-sale .22s ease-in forwards; }
/* Filete del color del aviso, a la izquierda. */
.nx-aviso::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--nx-color);
}
.nx-aviso-icono {
  width: 2rem; height: 2rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--nx-color);
  background: color-mix(in srgb, var(--nx-color) 14%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--nx-color) 45%, transparent);
}
.nx-aviso-icono svg { width: 1.15rem; height: 1.15rem; display: block; }
.nx-aviso-titulo {
  margin: .05rem 0 .15rem; font-size: .7rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--nx-titulo);
}
.nx-aviso-texto { margin: 0; word-break: break-word; }
.nx-aviso-cerrar {
  position: absolute; top: .55rem; right: .55rem;
  width: 1.75rem; height: 1.75rem; border: 0; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: #6b7280; cursor: pointer;
}
.nx-aviso-cerrar:hover, .nx-aviso-cerrar:focus-visible { background: rgba(0, 0, 0, .07); color: #111827; outline: 0; }
.nx-aviso-cerrar svg { width: .85rem; height: .85rem; display: block; }
/* La barra del tiempo: se vacía mientras el aviso está visible. */
.nx-aviso-tiempo {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--nx-color); transform-origin: left center;
  animation: nx-tiempo linear forwards;
}
.nx-aviso:hover .nx-aviso-tiempo,
.nx-aviso:focus-within .nx-aviso-tiempo { animation-play-state: paused; }

/* Colores por tipo (los de Bootstrap; el título, un tono más oscuro para leerse bien). */
.nx-aviso.nx-exito    { --nx-color: #198754; --nx-titulo: #146c43; }
.nx-aviso.nx-error    { --nx-color: #dc3545; --nx-titulo: #b02a37; }
.nx-aviso.nx-atencion { --nx-color: #f59f00; --nx-titulo: #9a6700; }
.nx-aviso.nx-info     { --nx-color: #0d6efd; --nx-titulo: #0a58ca; }

/* Modo oscuro: el mismo vidrio, oscuro, y los colores un punto más claros. */
html.dark .nx-aviso {
  border-color: rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .70);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  color: #e2e8f0;
}
html.dark .nx-aviso.nx-exito    { --nx-color: #2fb37a; --nx-titulo: #6ee7b7; }
html.dark .nx-aviso.nx-error    { --nx-color: #f0506e; --nx-titulo: #fda4af; }
html.dark .nx-aviso.nx-atencion { --nx-color: #fbbf24; --nx-titulo: #fcd34d; }
html.dark .nx-aviso.nx-info     { --nx-color: #4c9bff; --nx-titulo: #93c5fd; }
html.dark .nx-aviso-cerrar { color: #94a3b8; }
html.dark .nx-aviso-cerrar:hover, html.dark .nx-aviso-cerrar:focus-visible { background: rgba(255, 255, 255, .08); color: #f1f5f9; }

/* Sin desenfoque disponible: fondo casi opaco para que el texto se lea igual. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nx-aviso { background: rgba(255, 255, 255, .97); }
  html.dark .nx-aviso { background: rgba(15, 23, 42, .97); }
}

@keyframes nx-entra { from { opacity: 0; transform: translateX(1.5rem) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes nx-sale  { to { opacity: 0; transform: translateX(1.5rem) scale(.98); } }
@keyframes nx-tiempo { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .nx-aviso, .nx-aviso.nx-sale { animation-duration: .01s; }
}
@media (max-width: 480px) {
  .nx-avisos { top: .5rem; right: .5rem; width: calc(100vw - 1rem); }
}
