/* ══════════════════════════════════════════════════════════════
   MKCTV Network Status Toasts
   Same pure glassmorphism as the admin login — rgba(255,255,255,0.08)
   Slides up from bottom, compact pill, centered
   ══════════════════════════════════════════════════════════════ */

/* ── Wrapper — positions the toast at bottom center ─────────── */
.ns-wrap {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 48px));
  z-index: 9800;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 380px;

  /* Slide state */
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
  opacity: 0;
}

/* Visible state — JS adds this class */
.ns-wrap.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Exit state — JS adds this to dismiss */
.ns-wrap.is-exiting {
  transform: translateX(-50%) translateY(calc(100% + 48px));
  opacity: 0;
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

/* ── Toast pill ─────────────────────────────────────────────── */
.ns-toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 999px; /* Full pill shape */

  /* Pure glass — same system as login card and sheet */
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);

  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 16px 50px rgba(0, 0, 0, 0.45);
}

/* ── Icon ───────────────────────────────────────────────────── */
.ns-icon-wrap {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ns-svg {
  width: 36px;
  height: 36px;
  overflow: visible;
}

/* ── Circle — draws when .is-visible added ──────────────────── */
.ns-circle {
  fill: none;
  stroke-linecap: round;
  transform-origin: center;
  transform: rotate(-90deg); /* Start at top, draw clockwise */
}

.ns-circle--red {
  stroke: rgba(255, 69, 58, 0.75);
}
.ns-circle--green {
  stroke: rgba(48, 209, 88, 0.7);
}

/* X lines */
.ns-x-line {
  stroke: #ff453a;
  filter: drop-shadow(0 0 5px rgba(255, 69, 58, 0.5));
}

/* Tick */
.ns-tick {
  fill: none;
  stroke: #30d158;
  filter: drop-shadow(0 0 6px rgba(48, 209, 88, 0.55));
}

/* ── Draw animations — triggered when .is-animating added ───── */
.ns-wrap.is-animating .ns-circle {
  animation: nsDrawCircle 0.45s ease-out 0.12s both;
}

/* Offline: X draws line 1 then line 2 */
.ns-wrap.is-animating .ns-x-line--1 {
  animation: nsDrawLine 0.3s ease-out 0.48s both;
}
.ns-wrap.is-animating .ns-x-line--2 {
  animation: nsDrawLine 0.3s ease-out 0.64s both;
}

/* Online: tick draws after circle */
.ns-wrap.is-animating .ns-tick {
  animation: nsDrawLine 0.36s ease-out 0.48s both;
}

@keyframes nsDrawCircle {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes nsDrawLine {
  to {
    stroke-dashoffset: 0;
  }
}

/* ── Text ───────────────────────────────────────────────────── */
.ns-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ns-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(245, 249, 255, 0.95);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.ns-sub {
  font-size: 11px;
  font-weight: 500;
  color: rgba(245, 249, 255, 0.45);
  white-space: nowrap;
}

/* Colour accents on title per toast type */
#nsOffline .ns-title {
  color: rgba(255, 100, 90, 0.95);
}
#nsOnline .ns-title {
  color: rgba(60, 220, 100, 0.95);
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .ns-wrap {
    bottom: 20px;
    max-width: calc(100% - 24px);
  }
  .ns-toast {
    padding: 12px 16px;
    gap: 12px;
  }
  .ns-title {
    font-size: 12px;
  }
  .ns-sub {
    display: none;
  }
}

/* ── Respect reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ns-wrap,
  .ns-wrap.is-visible,
  .ns-wrap.is-exiting {
    transition-duration: 0.001ms;
  }
  .ns-wrap.is-animating .ns-circle,
  .ns-wrap.is-animating .ns-x-line--1,
  .ns-wrap.is-animating .ns-x-line--2,
  .ns-wrap.is-animating .ns-tick {
    animation-duration: 0.001ms;
  }
}
