/* Error pages — hybrid minimal-glass + drone-vernacular copy.
   Reuses tokens from app.css (--bg, --accent, --ease-spring, etc.).
   Loaded only by templates/errors/_base.html. */

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 88px 20px 40px; /* top padding clears the topnav when present */
  position: relative;
  isolation: isolate;
}

/* Starfield canvas sits behind everything when enabled (500/502/503).
   Position fixed so it doesn't add to scroll height. */
.error-starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.65;
}

/* Glass card — same vocabulary as the existing modal/sidebar surfaces */
.error-card {
  width: 100%;
  max-width: 540px;
  background: rgba(18, 21, 29, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  box-shadow: var(--elev-3);
  text-align: left;
  animation: error-card-in 320ms var(--ease-spring) both;
}

@keyframes error-card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Icon + numeric code header */
.error-card__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.error-card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(0, 212, 170, 0.08);
  border: 1px solid rgba(0, 212, 170, 0.25);
  color: var(--accent);
  flex-shrink: 0;
}
.error-card__icon [data-lucide] {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

/* Tint the icon by severity bucket */
.error-card--server .error-card__icon {
  background: rgba(224, 79, 95, 0.08);
  border-color: rgba(224, 79, 95, 0.30);
  color: var(--danger);
}
.error-card--warn .error-card__icon {
  background: rgba(245, 166, 35, 0.08);
  border-color: rgba(245, 166, 35, 0.30);
  color: var(--warn);
}

.error-card__code {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  line-height: 1;
}

.error-card__heading {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.error-card__body {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 24px;
}

.error-card__body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}

.error-card__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.error-card__cta .btn {
  flex: 1 1 auto;
  min-width: 140px;
  text-align: center;
  justify-content: center;
}

.error-card__refid {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
  letter-spacing: 0.04em;
}
.error-card__refid code {
  color: var(--text2);
  font-family: inherit;
}

/* When no topnav (anonymous user), the page should center vertically without
   the 88px top padding offset pulling it down. */
.error-page--bare {
  padding-top: 40px;
}

/* Anonymous error pages: hide the topnav (its links go to authed routes; the
   error-bare-header logo replaces it). */
body.error-anon .topnav,
body.error-anon .confirm-banner {
  display: none !important;
}

/* Anonymous-mode mini header (just the logo, no nav links) */
.error-bare-header {
  position: absolute;
  top: 24px;
  left: 24px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-decoration: none;
}
.error-bare-header:hover { color: var(--accent-hi); }

/* ── Inline form errors (UX enhancement A) ──────────────────────────────── */

.field--error,
.input.field--error,
input.field--error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(224, 79, 95, 0.18) !important;
  outline: none;
}

.field-help {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: -2px;
  margin-bottom: 4px;
  line-height: 1.4;
  font-family: var(--font-body);
}

/* ── Upsell modal (UX enhancement B) ─────────────────────────────────────── */

.upsell-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 13, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.upsell-overlay--open {
  display: flex;
  animation: upsell-fade 220ms var(--ease) both;
}
@keyframes upsell-fade { from { opacity: 0; } to { opacity: 1; } }

.upsell-modal {
  width: 100%;
  max-width: 560px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--elev-3);
  animation: upsell-pop 320ms var(--ease-spring) both;
}
@keyframes upsell-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.upsell-modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.upsell-modal__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(245, 166, 35, 0.10);
  border: 1px solid rgba(245, 166, 35, 0.30);
  color: var(--warn);
  flex-shrink: 0;
}
.upsell-modal__icon [data-lucide] { width: 20px; height: 20px; stroke-width: 2; }

.upsell-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.upsell-modal__desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  margin: 4px 0 18px;
}

.upsell-tier-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.upsell-tier {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.upsell-tier--target {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.upsell-tier__name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text2);
}
.upsell-tier--target .upsell-tier__name { color: var(--accent); }
.upsell-tier__price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.upsell-tier__price small {
  font-size: 12px;
  color: var(--text2);
  font-weight: 400;
}
.upsell-tier__hint {
  font-size: 11px;
  color: var(--text3, var(--text2));
}

.upsell-modal__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.upsell-modal__cta .btn {
  min-width: 130px;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .error-card,
  .upsell-overlay--open,
  .upsell-modal { animation: none; }
}
