/**
 * Full-screen "Connection Lost" overlay styles.
 * Rendered by <NetworkErrorOverlay /> when the browser goes offline or
 * when an API call fails with a network error (no HTTP response).
 *
 * All classes are namespaced `.ne-*` so they never collide with the
 * app's existing styles. Loaded globally by AppLayout + MainLayout.
 */

/* ---------- Backdrop that covers the whole viewport ------------------ */
.ne-overlay {
  /* Fixed to viewport so the overlay is visible over ANY page state
     (sidebar, modals, etc.). Highest z-index of the app to stay on top
     of every existing modal / drawer / floating chat. */
  position: fixed;
  inset: 0;
  z-index: 2147483000; /* Just below max — above every UI layer */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Soft light-gray backdrop with a subtle blur so the design mirrors
     the reference (light gray canvas behind the white card, no harsh
     black scrim). backdrop-filter is a progressive enhancement. */
  background: rgba(240, 240, 244, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: ne-fade-in 180ms ease-out;
}

@keyframes ne-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- White card that holds the whole thing ------------------- */
.ne-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 28px;
  padding: 40px 32px 32px;
  text-align: center;
  /* Soft, layered shadow to give the card a lifted feel without
     looking heavy. Matches the "premium SaaS" tone from design specs. */
  box-shadow:
    0 1px 3px rgba(15, 0, 105, 0.05),
    0 12px 40px -8px rgba(15, 0, 105, 0.18);
  animation: ne-pop-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1.05);
}

@keyframes ne-pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Illustration slot at the top of the card ----------------- */
.ne-illustration {
  /* Wide rectangle sized to display the sad-girl-plus-bird scene at a
     comfortable size. No background — the illustration is already on
     a transparent canvas and looks best floating directly on the white
     card. Height auto with a max keeps it from becoming huge on tall
     source images. */
  width: 220px;
  height: 220px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ne-illustration img {
  width: 100%;
  height: 100%;
  /* `contain` guarantees we never crop the character's head off on
     illustrations of different aspect ratios. */
  object-fit: contain;
}

/* ---------- Orange "CONNECTION LOST" pill badge --------------------- */
.ne-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  /* Warm orange background + darker orange text = clearly a "warning /
     status" chip without being alarming red. */
  background: #ffe4d1;
  color: #b8481f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.ne-badge svg {
  flex-shrink: 0;
}

/* ---------- Heading ------------------------------------------------- */
.ne-heading {
  /* Uses the design spec's dark navy for headings. */
  color: #1a1a2e;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
  /* Slight letter tightening for the display feel. */
  letter-spacing: -0.01em;
}

/* ---------- Subtitle ------------------------------------------------ */
.ne-subtitle {
  color: #4a4a68;
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 28px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Primary action button (Try again) ----------------------- */
.ne-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 999px;
  /* Brand deep-green, matches the sidebar accent and CTA sections
     from specs/design/specs.md. */
  background: #0e503f;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
  /* Subtle green glow to make the CTA feel tactile. */
  box-shadow: 0 4px 16px -4px rgba(14, 80, 63, 0.4);
}

.ne-button:hover {
  background: #0a3b2e;
  transform: translateY(-1px);
}

.ne-button:active {
  transform: translateY(0);
}

.ne-button svg {
  flex-shrink: 0;
}

/* While a retry is in flight, disable interactions and dim slightly
   so the button clearly reads as "already working on it". */
.ne-button--loading {
  pointer-events: none;
  opacity: 0.85;
}

/* Utility spin animation used on the Loader icon between click and
   the actual page reload. Scoped to the .ne-spin class so we don't
   collide with the app's other animations. */
.ne-spin {
  animation: ne-rotate 700ms linear infinite;
}

@keyframes ne-rotate {
  to { transform: rotate(360deg); }
}

/* ---------- Footer note --------------------------------------------- */
.ne-footer {
  margin: 20px 0 0;
  color: #8888a4;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Responsive tweaks --------------------------------------- */
@media (max-width: 480px) {
  .ne-card {
    padding: 32px 24px 24px;
    border-radius: 24px;
  }
  .ne-illustration {
    width: 180px;
    height: 180px;
  }
  .ne-heading {
    font-size: 22px;
  }
  .ne-subtitle {
    font-size: 14px;
  }
  /* backdrop-filter is expensive on mobile GPUs (esp. Safari). The
     backdrop is already opaque enough (rgba .92) that dropping the
     blur has no visible impact. */
  .ne-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Respect users who don't want motion — kill the pop-in animation. */
@media (prefers-reduced-motion: reduce) {
  .ne-overlay,
  .ne-card,
  .ne-spin {
    animation: none !important;
  }
  .ne-button:hover {
    transform: none;
  }
}
