<%- include('partials/public-header') %>

<style>
  *, *::before, *::after {
    box-sizing: border-box;
  }

  #main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(12px, 3vw, 24px) 64px;
    width: 100%;
    min-height: calc(100vh - var(--header-h, 56px) - 180px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
  }

  .error-container {
    position: relative;
    padding: clamp(30px, 6vw, 60px) 16px clamp(40px, 6vw, 70px);
    text-align: center;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
  }

  .ambient-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(550px, 90vw);
    height: 300px;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.22) 0%, rgba(239, 68, 68, 0.12) 40%, transparent 70%);
    filter: blur(60px);
    z-index: -1;
    pointer-events: none;
  }
  [data-theme="light"] .ambient-glow {
    background: radial-gradient(ellipse at center, rgba(67, 56, 202, 0.12) 0%, rgba(239, 68, 68, 0.06) 40%, transparent 70%);
  }

  .error-code {
    font-size: clamp(5rem, 16vw, 9rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #6366f1 0%, #ef4444 60%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    user-select: none;
  }

  .error-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border-radius: 30px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 16px;
  }
  .error-badge .pulse-dot-red {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
  }

  .error-container h1 {
    font-size: clamp(1.45rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 0 auto 12px;
    color: var(--text);
  }

  .error-container p {
    color: var(--text-muted);
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    line-height: 1.6;
    margin: 0 auto 28px;
    max-width: 520px;
  }

  /* Search Box on 404 */
  .error-search-box {
    max-width: 480px;
    margin: 0 auto 28px;
    position: relative;
  }
  .search-inner {
    position: relative;
    display: flex;
    align-items: center;
  }
  .search-inner svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
  }
  .error-search-input {
    width: 100%;
    height: 46px;
    padding: 0 16px 0 42px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    outline: none;
    box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
  }
  .error-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
  }

  /* Action Buttons */
  .error-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
  }

  .btn-action-404 {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.18s ease;
  }
  .btn-action-404:hover {
    border-color: var(--primary);
    background: var(--surface);
    transform: translateY(-2px);
  }
  .btn-action-404.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
  }
  .btn-action-404.btn-primary:hover {
    background: var(--primary-hover);
  }

  /* Quick Category Chips */
  .quick-links-title {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
  }
  .quick-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .chip-link {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
  }
  .chip-link:hover {
    border-color: var(--primary);
    color: var(--text);
    background: var(--surface-hover);
  }
</style>

<main id="main-content">

  <div class="error-container">
    <div class="ambient-glow" aria-hidden="true"></div>

    <div class="error-badge">
      <span class="pulse-dot-red"></span>
      <span>404 Error &bull; Page Not Found</span>
    </div>

    <div class="error-code">404</div>
    
    <h1>Oops! Tool or Page Missing</h1>
    <p>The online utility or page you are looking for might have been moved, renamed, or is temporarily offline.</p>

    <!-- Instant Search Bar -->
    <div class="error-search-box">
      <form action="/" method="GET" class="search-inner">
        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
        <input 
          type="search" 
          name="q" 
          class="error-search-input" 
          placeholder="Search 50+ free online tools..." 
          aria-label="Search tools"
          autocomplete="off"
        >
      </form>
    </div>

    <!-- Navigation Buttons -->
    <div class="error-actions">
      <a href="/" class="btn-action-404 btn-primary">
        <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
        <span>Back to Homepage</span>
      </a>
      <a href="/#categories" class="btn-action-404">
        <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
        <span>Explore Categories</span>
      </a>
    </div>

    <!-- Quick Category Shortcuts -->
    <div>
      <div class="quick-links-title">Popular Categories</div>
      <div class="quick-chips">
        <a href="/category/developer" class="chip-link">Developer Tools</a>
        <a href="/category/text" class="chip-link">Text Utilities</a>
        <a href="/category/security" class="chip-link">Security & Crypto</a>
        <a href="/category/image" class="chip-link">Image Tools</a>
        <a href="/category/utility" class="chip-link">Web Utilities</a>
      </div>
    </div>

  </div>

</main>

<%- include('partials/public-footer') %>