/* ============================================================
   Recherche : autocomplétion (toutes les pages) et page de résultats (search.php).
   ============================================================ */

/* ---------- Autocomplétion ---------- */
.pfq-form { position: relative; }
.pfq-box {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    max-height: min(70vh, 560px);
    overflow-y: auto;
    overscroll-behavior: contain;
    text-align: left;
}
/* Dans la bulle de l'en-tête : la liste s'ajoute sous le champ, dans la bulle. */
.nav-search-popup { width: 480px; }
.nav-search-form.pfq-form { flex-wrap: wrap; }
.nav-search-popup .pfq-box {
    position: static;
    flex: 1 0 100%;
    margin-top: 4px;
    border: 0;
    border-top: 1px solid var(--border-light);
    border-radius: 0;
    box-shadow: none;
    max-height: min(68vh, 540px);
}
.pfq-list { list-style: none; margin: 0; padding: 6px 0; }
.pfq-group {
    padding: 10px 14px 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-light);
}
.pfq-dym {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--ink-mid);
    background: var(--yellow-bg);
}
.pfq-opt a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    color: var(--ink);
    text-decoration: none;
}
.pfq-opt.is-active a { background: var(--blue-bg); }
.pfq-fig {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: var(--r-xs);
    background: var(--cream);
    overflow: hidden;
}
.pfq-fig img { width: 100%; height: 100%; object-fit: cover; }
.pfq-k-pokemon .pfq-fig img,
.pfq-k-go .pfq-fig img,
.pfq-k-extension .pfq-fig img,
.pfq-k-game .pfq-fig img,
.pfq-k-season .pfq-fig img { object-fit: contain; }
.pfq-k-pokemon .pfq-fig img { image-rendering: pixelated; }
.pfq-fig::after { font-size: 16px; line-height: 1; }
.pfq-fig--hub::after   { content: "🧭"; }
.pfq-fig--guide::after { content: "📘"; }
.pfq-fig--dex::after   { content: "📖"; }
.pfq-fig--anime::after { content: "📺"; }
.pfq-fig--news::after  { content: "📰"; }
.pfq-fig--tcg::after   { content: "🃏"; }
.pfq-fig--other::after { content: "📄"; }
.pfq-fig--pokemon::after, .pfq-fig--go::after { content: "⚪"; }
.pfq-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.pfq-l {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pfq-l mark { background: none; color: inherit; font-weight: 800; text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 2px; }
.pfq-s {
    font-size: 12px;
    color: var(--ink-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pfq-types { flex: none; display: flex; gap: 4px; }
.pfq-types .type-badge { padding: 2px 7px; font-size: 9.5px; }
.pfq-all { border-top: 1px solid var(--border-light); margin-top: 6px; }
.pfq-all a { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--blue); }

@media (max-width: 600px) {
    .nav-search-popup { width: auto; left: 8px; right: 8px; max-width: none; }
    .pfq-types { display: none; }
}

/* ---------- Page de résultats ---------- */
.pfq-page { padding-bottom: 64px; }
.pfq-page .search-form { max-width: 720px; }
.pfq-page .search-input { font-size: 16px; padding: 13px 20px; }
.pfq-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 22px 0 6px;
}
.pfq-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-full);
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--ink-mid);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.pfq-tab span { color: var(--ink-light); font-weight: 500; font-variant-numeric: tabular-nums; }
.pfq-tab:hover { border-color: var(--ink); color: var(--ink); }
.pfq-tab.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pfq-tab.is-active span { color: var(--yellow); }

.pfq-dym-banner {
    margin: 18px 0 0;
    padding: 12px 16px;
    border-radius: var(--r-sm);
    background: var(--yellow-bg);
    font-size: 14px;
}

.pfq-section { margin-top: 36px; }
.pfq-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.pfq-section-head h2 { margin: 0; font-size: 20px; text-wrap: balance; }
.pfq-more { font-size: 13px; font-weight: 600; color: var(--blue); white-space: nowrap; }

/* Meilleur résultat */
.pfq-best {
    margin-top: 26px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 22px;
    align-items: center;
    padding: 20px 24px;
    border-radius: var(--r-lg);
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.pfq-best-fig { width: 140px; height: 140px; display: grid; place-items: center; }
.pfq-best-fig img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pfq-best-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-light); }
.pfq-best h2 { margin: 4px 0 6px; font-size: 28px; line-height: 1.15; }
.pfq-best h2 a { color: var(--ink); text-decoration: none; }
.pfq-best-sub { color: var(--ink-mid); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pfq-best-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pfq-best-links a {
    padding: 7px 14px;
    border-radius: var(--r-full);
    background: var(--cream);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.pfq-best-links a:first-child { background: var(--ink); color: var(--white); }
.pfq-best-links a:hover { background: var(--yellow); color: var(--ink); }

/* Grille de Pokémon */
.pfq-mons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
}
.pfq-mon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px 14px;
    border-radius: var(--r-md);
    background: var(--white);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--ink);
    text-align: center;
    transition: transform .15s, box-shadow .15s;
}
.pfq-mon:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pfq-mon img { width: 96px; height: 96px; image-rendering: pixelated; }
.pfq-mon-num { font-size: 11px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.pfq-mon-name { font-weight: 700; font-size: 14px; }
.pfq-mon .pfq-types { justify-content: center; flex-wrap: wrap; }

/* Grille de cartes */
.pfq-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.pfq-card { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.pfq-card-img {
    aspect-ratio: 63 / 88;
    border-radius: 8px;
    overflow: hidden;
    background: var(--cream);
    max-width: 100%;
}
.pfq-card-img img { width: 100%; height: 100%; object-fit: cover; }
.pfq-card b { font-size: 13px; line-height: 1.25; }
.pfq-card small { font-size: 11.5px; color: var(--ink-light); line-height: 1.3; }

/* Liste générique */
.pfq-rows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
}
.pfq-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--white);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}
.pfq-row:hover { border-color: var(--ink); }
.pfq-row .pfq-fig { width: 64px; height: 52px; }
.pfq-row-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.pfq-row-txt b { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pfq-row-txt small { font-size: 12px; color: var(--ink-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfq-badge {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.pfq-empty { padding: 40px 0 10px; color: var(--ink-mid); }
.pfq-empty h2 { font-size: 20px; }
.pfq-pager { display: flex; gap: 8px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.pfq-pager a, .pfq-pager span {
    min-width: 38px;
    padding: 8px 12px;
    border-radius: var(--r-full);
    border: 1.5px solid var(--border);
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.pfq-pager span { background: var(--ink); color: var(--white); border-color: var(--ink); }

@media (max-width: 640px) {
    .pfq-best { grid-template-columns: 88px 1fr; padding: 16px; gap: 14px; }
    .pfq-best-fig { width: 88px; height: 88px; }
    .pfq-best h2 { font-size: 22px; }
    .pfq-rows { grid-template-columns: 1fr; }
    .pfq-mons { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
    .pfq-mon img { width: 72px; height: 72px; }
    .pfq-cards { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
