/* =====================================================================
 * KS-404-V1 — Friendly 404 page (2026-05-13)
 * Target: body#pagenotfound
 *
 * Convert PS classic's plain "Page not found" into a recovery-focused
 * landing: big number, helpful copy, search box, popular categories,
 * back-to-homepage CTA.
 * ===================================================================== */

body#pagenotfound {
  --ks-primary: #f97316;
  --ks-primary-hover: #ea580c;
  --ks-border: #e2e8f0;
  --ks-border-strong: #cbd5e1;
  --ks-text: #0f172a;
  --ks-text-secondary: #334155;
  --ks-text-muted: #64748b;
  --ks-bg-soft: #f8fafc;
  background: var(--ks-bg-soft);
}

body#pagenotfound #content-wrapper { background: transparent !important; }

body#pagenotfound #main {
  max-width: 720px;
  margin: 40px auto 64px;
  padding: 0 16px;
  text-align: center;
}

body#pagenotfound .page-not-found,
body#pagenotfound .page-content {
  background: #fff !important;
  border: 1px solid var(--ks-border) !important;
  border-radius: 16px !important;
  padding: 40px 24px !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  max-width: 600px !important;
  margin: 0 auto !important;
  text-align: center !important;
}

/* HIDE the redundant <header.page-header><h1>Szukana strona nie...</h1></header>
 * The .page-not-found section below has its own H1 + 404 number, so the
 * top H1 is duplicate noise. */
body#pagenotfound header.page-header,
body#pagenotfound .page-header h1 {
  display: none !important;
}

/* The "404" big number — it's an inline-styled <div> with font-size:120px.
 * Recolor it with the orange gradient via mask. */
body#pagenotfound .page-not-found > div[style*="font-size:120px"],
body#pagenotfound .page-not-found > div:first-child {
  font-size: 96px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: -0.04em !important;
  color: transparent !important;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin: 0 0 16px !important;
}

/* The H1 INSIDE .page-not-found (sub-heading) — restyle from inline */
body#pagenotfound .page-not-found h1,
body#pagenotfound section.page-not-found > h1 {
  display: block !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  color: var(--ks-text) !important;
  letter-spacing: -0.01em !important;
  margin: 0 0 8px !important;
  text-align: center !important;
}

body#pagenotfound .page-content p,
body#pagenotfound .ks-404-message {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ks-text-muted);
  margin: 0 auto 24px;
  max-width: 460px;
}

/* Search bar centered, prominent */
body#pagenotfound .page-content form,
body#pagenotfound #search_widget,
body#pagenotfound .ks-404-search,
body#pagenotfound .page-not-found form {
  max-width: 440px !important;
  margin: 0 auto 28px !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  align-items: stretch !important;
}
/* Inner form wrapper div (inline-styled `display:flex`) */
body#pagenotfound .page-not-found form > div {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  width: 100% !important;
  align-items: stretch !important;
}

body#pagenotfound .page-not-found form input[type="text"],
body#pagenotfound .page-not-found form input[type="search"],
body#pagenotfound .page-content form input[type="text"],
body#pagenotfound .page-content form input[type="search"] {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 48px !important;
  padding: 0 16px !important;
  border: 1.5px solid var(--ks-border-strong) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--ks-text) !important;
  font-size: 15px !important;
  outline: none !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
  box-shadow: none !important;
}
body#pagenotfound input[type="text"]:focus,
body#pagenotfound input[type="search"]:focus {
  border-color: var(--ks-primary) !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16) !important;
}

body#pagenotfound .page-not-found form button[type="submit"],
body#pagenotfound .page-content form button[type="submit"],
body#pagenotfound .btn-search {
  flex: 0 0 auto !important;
  width: auto !important;
  height: 48px !important;
  padding: 0 22px !important;
  background: var(--ks-primary) !important;
  border: 0 !important;
  border-radius: 10px !important;
  color: #fff !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.30);
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap !important;
}
body#pagenotfound button[type="submit"]:hover {
  background: var(--ks-primary-hover) !important;
  transform: translateY(-1px);
}

/* Quick links section (back to home + popular categories) */
body#pagenotfound .ks-404-actions,
body#pagenotfound .page-content > a.btn,
body#pagenotfound .page-content .btn-group {
  display: inline-flex;
  gap: 8px;
  margin-top: 8px;
}
body#pagenotfound a.btn-primary,
body#pagenotfound a.btn.btn-primary {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 20px;
  background: var(--ks-primary) !important;
  border: 0 !important;
  border-radius: 10px !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.30) !important;
  transition: background 0.15s, transform 0.15s !important;
}
body#pagenotfound a.btn-primary:hover {
  background: var(--ks-primary-hover) !important;
  transform: translateY(-1px);
}

/* "Popular categories" suggestion grid */
body#pagenotfound .ks-404-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 28px auto 0;
  max-width: 540px;
}
body#pagenotfound .ks-404-suggestions a {
  padding: 12px 14px;
  background: var(--ks-bg-soft);
  border: 1px solid var(--ks-border);
  border-radius: 10px;
  color: var(--ks-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
body#pagenotfound .ks-404-suggestions a:hover {
  border-color: var(--ks-primary);
  color: var(--ks-primary);
  transform: translateY(-1px);
}

@media (max-width: 575px) {
  body#pagenotfound #main { margin: 20px auto 32px; padding: 0 12px; }
  body#pagenotfound .page-not-found,
  body#pagenotfound .page-content { padding: 32px 20px; }
  body#pagenotfound h1 { font-size: 68px !important; }
  body#pagenotfound .page-content form { flex-direction: column; }
  body#pagenotfound button[type="submit"] { width: 100% !important; }
}
