/**
 * NepalTechHub Phase 19F — sitewide empty/loading/error/unverified state system.
 * Presentation and accessibility only: no state, price, seller, alert or product mutation.
 */

body.nth-phase19f-states{
  --nth-state-ink:#0f172a;
  --nth-state-muted:#64748b;
  --nth-state-line:#dbe5f1;
  --nth-state-surface:#ffffff;
  --nth-state-soft:#f8fafc;
  --nth-state-blue:#2457e6;
  --nth-state-blue-soft:#eff6ff;
  --nth-state-green:#087a46;
  --nth-state-green-soft:#ecfdf3;
  --nth-state-amber:#92400e;
  --nth-state-amber-soft:#fff8e8;
  --nth-state-amber-line:#f5cf68;
  --nth-state-red:#b42318;
  --nth-state-red-soft:#fff1f0;
  --nth-state-red-line:#f6b7b2;
}

/* Canonical empty/recovery surfaces already emitted by the theme. */
body.nth-phase19f-states .nth-empty,
body.nth-phase19f-states .nth-wl-empty,
body.nth-phase19f-states .nth-pa-empty,
body.nth-phase19f-states .nth-p19f-empty{
  border:1px solid var(--nth-state-line) !important;
  border-radius:20px !important;
  background:linear-gradient(145deg,#fff 0%,#f8fbff 100%) !important;
  box-shadow:0 12px 30px rgba(15,23,42,.055);
  color:var(--nth-state-ink);
  padding:clamp(22px,4vw,38px) !important;
}

body.nth-phase19f-states .nth-empty h1,
body.nth-phase19f-states .nth-empty h2,
body.nth-phase19f-states .nth-wl-empty h1,
body.nth-phase19f-states .nth-wl-empty h2,
body.nth-phase19f-states .nth-pa-empty h1,
body.nth-phase19f-states .nth-pa-empty h2{
  color:var(--nth-state-ink);
  letter-spacing:-.025em;
}

body.nth-phase19f-states .nth-empty p,
body.nth-phase19f-states .nth-wl-empty p,
body.nth-phase19f-states .nth-pa-empty p{
  color:var(--nth-state-muted) !important;
  line-height:1.65;
}

body.nth-phase19f-states .nth-empty a,
body.nth-phase19f-states .nth-wl-empty a,
body.nth-phase19f-states .nth-pa-empty a{
  min-height:44px;
}

/* Tiny “nothing here yet” messages inside otherwise-valid cards/404 sections. */
body.nth-phase19f-states .nth-muted.nth-p19f-empty-inline,
body.nth-phase19f-states .nth-search-empty{
  display:block;
  margin:10px 0;
  padding:13px 15px;
  border:1px dashed var(--nth-state-line);
  border-radius:13px;
  background:var(--nth-state-soft);
  color:var(--nth-state-muted) !important;
  font-weight:650;
  line-height:1.5;
}

/* Unverified / not-listed price states. Never convert these into a green price. */
body.nth-phase19f-states .nth-neo-noprice,
body.nth-phase19f-states .nth-p19f-unverified-inline{
  color:var(--nth-state-amber) !important;
  font-weight:800 !important;
}

body.nth-phase19f-states .nth-price-truth-line.is-pending,
body.nth-phase19f-states .nth-verified-line.is-pending,
body.nth-phase19f-states .nth-p19f-unverified{
  margin:10px 0 !important;
  padding:12px 14px !important;
  border:1px solid var(--nth-state-amber-line) !important;
  border-radius:13px !important;
  background:var(--nth-state-amber-soft) !important;
  color:var(--nth-state-amber) !important;
  font-weight:750 !important;
  line-height:1.55 !important;
}

/* Price-alert “unavailable / needs review” should read as a caution, not a crash. */
body.nth-phase19f-states .nth-pa-status-unavailable,
body.nth-phase19f-states .nth-pa-status-invalid{
  border:1px solid #fed7aa !important;
  background:#fff7ed !important;
  color:#9a3412 !important;
}

/* Shared status feedback. JS adds only classes/ARIA; existing text stays authoritative. */
body.nth-phase19f-states .nth-p19f-message{
  border-radius:12px;
  padding:10px 12px;
  line-height:1.5;
}

body.nth-phase19f-states .nth-p19f-message.nth-p19f-loading{
  border:1px solid #bfdbfe;
  background:var(--nth-state-blue-soft);
  color:#1d4ed8 !important;
}

body.nth-phase19f-states .nth-p19f-message.nth-p19f-error,
body.nth-phase19f-states #nthError.nth-p19f-error,
body.nth-phase19f-states .nth-error.nth-p19f-error{
  border:1px solid var(--nth-state-red-line) !important;
  background:var(--nth-state-red-soft) !important;
  color:var(--nth-state-red) !important;
  box-shadow:none !important;
}

body.nth-phase19f-states .nth-p19f-message.nth-p19f-success{
  border:1px solid #a7e7c9;
  background:var(--nth-state-green-soft);
  color:#166534 !important;
}

body.nth-phase19f-states .nth-p19f-message.nth-p19f-warning{
  border:1px solid var(--nth-state-amber-line);
  background:var(--nth-state-amber-soft);
  color:var(--nth-state-amber) !important;
}

/* Compare has an existing real loader. Give it the same calm state treatment. */
body.nth-phase19f-states #nthLoader,
body.nth-phase19f-states .nth-loader{
  border:1px solid #dbeafe;
  border-radius:18px;
  background:linear-gradient(145deg,#fff,#f5f9ff);
}

body.nth-phase19f-states #nthLoader .nth-spinner,
body.nth-phase19f-states .nth-loader .nth-spinner,
body.nth-phase19f-states .nth-p19f-loading-dot{
  border-color:#dbeafe;
  border-top-color:var(--nth-state-blue);
}

/* Buttons that are genuinely busy remain readable rather than looking broken. */
body.nth-phase19f-states button.nth-p19f-loading,
body.nth-phase19f-states [role="button"].nth-p19f-loading{
  position:relative;
  cursor:progress !important;
  opacity:.78;
}

body.nth-phase19f-states button.nth-p19f-loading::after,
body.nth-phase19f-states [role="button"].nth-p19f-loading::after{
  content:"";
  width:15px;
  height:15px;
  margin-left:9px;
  display:inline-block;
  vertical-align:-2px;
  border:2px solid currentColor;
  border-right-color:transparent;
  border-radius:999px;
  animation:nth-p19f-spin .7s linear infinite;
}

/* Existing 404/search recovery pages should feel intentional, not like a dead end. */
body.nth-phase19f-states.error404 .nth-404-hero{
  border-color:var(--nth-state-line);
  box-shadow:0 18px 44px rgba(15,23,42,.07);
}
body.nth-phase19f-states.error404 .nth-404-code{
  color:var(--nth-state-blue);
}
body.nth-phase19f-states.search-no-results .nth-empty{
  max-width:820px;
  margin-inline:auto;
}

/* Better focus on recovery actions and state controls. */
body.nth-phase19f-states .nth-empty a:focus-visible,
body.nth-phase19f-states .nth-wl-empty a:focus-visible,
body.nth-phase19f-states .nth-pa-empty a:focus-visible,
body.nth-phase19f-states .nth-p19f-message a:focus-visible{
  outline:3px solid rgba(36,87,230,.35);
  outline-offset:3px;
}

/* Prevent long network/server error text or source URLs from causing overflow. */
body.nth-phase19f-states .nth-p19f-message,
body.nth-phase19f-states .nth-empty,
body.nth-phase19f-states .nth-wl-empty,
body.nth-phase19f-states .nth-pa-empty,
body.nth-phase19f-states .nth-price-truth-line.is-pending{
  overflow-wrap:anywhere;
  word-break:normal;
}

/* Progressive loading state used by 19C pagination already; harmonise it globally. */
body.nth-phase19f-states.nth-p19c4-loading .nth-p19c4-load-status{
  color:#1d4ed8;
}

/* Do not animate state affordances for users who request reduced motion. */
@keyframes nth-p19f-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){
  body.nth-phase19f-states button.nth-p19f-loading::after,
  body.nth-phase19f-states [role="button"].nth-p19f-loading::after{
    animation:none;
  }
}

/* Mobile: recovery controls should remain comfortable but compact. */
@media(max-width:600px){
  body.nth-phase19f-states .nth-empty,
  body.nth-phase19f-states .nth-wl-empty,
  body.nth-phase19f-states .nth-pa-empty{
    border-radius:17px !important;
    padding:22px 18px !important;
  }
  body.nth-phase19f-states .nth-empty-links{
    display:grid;
    grid-template-columns:1fr;
    gap:9px;
  }
  body.nth-phase19f-states .nth-empty-links a{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
  }
}
