/* UK Coin Hunt — Header polish (additive)
 * Layered on top of the existing header without changing its layout.
 * Adds: sticky-on-scroll + shadow, cart/wishlist count badges, softer
 * icon hovers, slightly tighter vertical rhythm. */

:root {
    --hdp-gold:      #cfa362;
    --hdp-gold-dark: #b88d4f;
}

/* --- Sticky header --- *
 * The theme's <body> has overflow:auto which makes CSS `position: sticky`
 * unreliable (Chrome scrolls the <html> element instead), so we use a
 * fixed-positioned header plus a body spacer that matches its height. */
body > header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #ffffff;
    transition: box-shadow .25s ease;
}
body.dark-mode > header { background: #1e1e1e; }

body.admin-bar > header { top: 32px; }
@media (max-width: 782px) {
    body.admin-bar > header { top: 46px; }
}

/* Spacer keeps the hero from tucking under the fixed header. JS sets the
   exact height on load + resize so it stays pixel-perfect. (The admin-bar
   offset is already baked in by html's margin-top, so we don't add it here.) */
body::before {
    content: "";
    display: block;
    height: var(--hdp-header-h, 200px);
    flex-shrink: 0;
    background: transparent;
}

body.hdr-stuck > header {
    box-shadow: 0 4px 16px rgba(28, 28, 30, 0.08);
}
body.dark-mode.hdr-stuck > header {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* -------- Shrink on scroll --------
 * Uses GPU-friendly properties (transform, opacity, max-height) with short
 * durations so the shrink lands instantly rather than crawling. */
body > header .logo-container {
    transform-origin: center left;
    transition: transform .18s ease;
    will-change: transform;
}
body.hdr-stuck > header .logo-container {
    transform: scale(0.7);
}
body > header #mobile-header-detection {
    transition: padding .18s ease;
}
body.hdr-stuck > header #mobile-header-detection {
    padding-top: 4px;
    padding-bottom: 4px;
}
/* Collapse the bottom row (category bar + nav + review stars) on scroll.
 * Target the 2nd .row inside header (the nav/categories row) without
 * using :has() — which can trigger repaint storms on some browsers. */
body > header .container > .row:nth-of-type(2) {
    transition: max-height .18s ease, opacity .14s ease;
}
body.hdr-stuck > header .container > .row:nth-of-type(2) {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Tighten vertical padding a touch (keeps layout identical) */
body > header .container > .row {
    margin-top: 0;
    margin-bottom: 0;
}

/* --- Current-page indicator in the main nav ---
 * WordPress decorates the active <li> with several different classes
 * depending on the page type (page, archive, category, etc.), so we cover
 * all of them for consistent highlighting. */
body > header .main-menu-bar .menu li.current-menu-item > a,
body > header .main-menu-bar .menu li.current-menu-parent > a,
body > header .main-menu-bar .menu li.current-menu-ancestor > a,
body > header .main-menu-bar .menu li.current_page_item > a,
body > header .main-menu-bar .menu li.current_page_parent > a,
body > header .main-menu-bar .menu li.current_page_ancestor > a,
body > header #sidebar-menu .menu li.current-menu-item > a,
body > header #sidebar-menu .menu li.current_page_item > a {
    color: var(--hdp-gold-dark);
    font-weight: 600;
    position: relative;
}

/* A subtle gold underline anchored just below the text so the indicator
 * doesn't shift the menu layout. */
body > header .main-menu-bar .menu li.current-menu-item > a::after,
body > header .main-menu-bar .menu li.current-menu-parent > a::after,
body > header .main-menu-bar .menu li.current-menu-ancestor > a::after,
body > header .main-menu-bar .menu li.current_page_item > a::after,
body > header .main-menu-bar .menu li.current_page_parent > a::after,
body > header .main-menu-bar .menu li.current_page_ancestor > a::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -2px;
    height: 2px;
    background: var(--hdp-gold);
    border-radius: 1px;
}

body.dark-mode > header .main-menu-bar .menu li.current-menu-item > a,
body.dark-mode > header .main-menu-bar .menu li.current-menu-parent > a,
body.dark-mode > header .main-menu-bar .menu li.current-menu-ancestor > a,
body.dark-mode > header .main-menu-bar .menu li.current_page_item > a,
body.dark-mode > header .main-menu-bar .menu li.current_page_parent > a,
body.dark-mode > header .main-menu-bar .menu li.current_page_ancestor > a {
    color: var(--hdp-gold);
}

/* Sidebar / mobile drawer — same idea but as a left gold rail */
body > header #sidebar-menu .menu li.current-menu-item > a,
body > header #sidebar-menu .menu li.current-menu-parent > a,
body > header #sidebar-menu .menu li.current_page_item > a {
    border-left: 3px solid var(--hdp-gold);
    padding-left: 12px;
    color: var(--hdp-gold-dark);
    font-weight: 600;
}

/* --- Icon hover polish (applies to the existing .icon-btn buttons) --- */
body > header .icon-btn {
    transition: color .2s ease, background-color .2s ease;
    border-radius: 50%;
}
/* Reset native <button> styling for the burger toggle so it looks identical
   to the previous <div class="menu-toggle">. */
body > header button.menu-toggle {
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    line-height: 1;
}
body > header .icon-btn:hover {
    color: var(--hdp-gold-dark);
    background-color: rgba(207, 163, 98, 0.08);
}
body.dark-mode > header .icon-btn:hover {
    color: var(--hdp-gold);
    background-color: rgba(207, 163, 98, 0.12);
}

/* --- Cart + wishlist badge --- */
body > header #open-side-cart-btn,
body > header .icon-btn.has-count,
body > header .btn-group > button.has-count {
    position: relative;
}

.hdp-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hdp-gold);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    box-shadow: 0 0 0 2px #ffffff;
    letter-spacing: 0;
    pointer-events: none;
    transform-origin: center;
    transition: transform .2s ease;
}
body.dark-mode .hdp-count {
    box-shadow: 0 0 0 2px #2c2c2c;
}
.hdp-count.is-bumped {
    animation: hdp-bump .35s cubic-bezier(.4, 1.3, .4, 1);
}
.hdp-count[data-count="0"],
.hdp-count:empty {
    display: none;
}

@keyframes hdp-bump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Cart icon sits a touch tighter so the badge has room */
body > header #open-side-cart-btn .bi-bag {
    font-size: 1.4rem !important;
}

/* -------- Search bar redesign --------
 * Soft pill, hairline border, gold submit circle. Keeps the existing markup
 * (.search-bar-ajax > form > .input-group > input + button) intact. */
body > header .search-bar-ajax .search-form {
    margin: 0;
}
body > header .search-bar-ajax .input-group {
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    padding: 0 6px 0 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(207, 163, 98, 0.25);
    border-radius: 999px;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
    box-shadow: none;
}
body > header .search-bar-ajax .input-group:focus-within {
    border-color: var(--hdp-gold);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(207, 163, 98, 0.10);
}

body > header .search-bar-ajax .search-field,
body > header .search-bar-ajax input[type="search"] {
    flex: 1;
    min-width: 0;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 14px;
    color: #1c1c1e !important;
    line-height: 1.2;
}
body > header .search-bar-ajax .search-field::placeholder {
    color: #8a8078;
    font-weight: 400;
    opacity: 1;
}

body > header .search-bar-ajax .input-group > button[type="submit"],
body > header .search-bar-ajax button.btn-outline-secondary {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hdp-gold) !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
    box-shadow: none !important;
}
body > header .search-bar-ajax .input-group > button[type="submit"]:hover,
body > header .search-bar-ajax button.btn-outline-secondary:hover {
    background: var(--hdp-gold-dark) !important;
    color: #ffffff !important;
    transform: scale(1.04);
}
body > header .search-bar-ajax .input-group > button[type="submit"] i {
    font-size: 14px;
    line-height: 1;
}

/* AJAX suggestions dropdown polish */
body > header .search-bar-ajax .ajax-search-results {
    border: 1px solid rgba(28, 28, 30, 0.08) !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(28, 28, 30, 0.14) !important;
    margin-top: 8px;
    padding: 6px !important;
    background: #ffffff !important;
    max-height: 420px !important;
    overflow-y: auto !important;
}

body > header .search-bar-ajax .search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

body > header .search-bar-ajax .search-result-item {
    display: block;
    margin: 0;
    padding: 0;
    border: none !important;
    border-radius: 8px;
    overflow: hidden;
    background: transparent !important;
}
body > header .search-bar-ajax .search-result-item + .search-result-item {
    margin-top: 2px;
}
body > header .search-bar-ajax .search-result-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    color: #1c1c1e;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color .15s ease, color .15s ease;
}
body > header .search-bar-ajax .search-result-item a:hover {
    background: #faf4e8;
    color: #1c1c1e;
}
body > header .search-bar-ajax .search-result-image {
    flex: 0 0 auto;
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    border-radius: 6px;
    object-fit: contain;
    background: #f4efe6;
    display: inline-block;
}
body > header .search-bar-ajax .sp-img-placeholder {
    background: linear-gradient(135deg, #f4efe6, #e8dfcd);
}
body > header .search-bar-ajax .search-result-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
body > header .search-bar-ajax .search-result-title {
    font-weight: 500;
    font-size: 13.5px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: inherit;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}
body > header .search-bar-ajax .search-result-price {
    font-size: 12px;
    color: #b88d4f;
    font-weight: 600;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}
/* Nuke any inherited hover/focus boxes from other stylesheets */
body > header .search-bar-ajax .search-result-item a,
body > header .search-bar-ajax .search-result-item a:hover,
body > header .search-bar-ajax .search-result-item a:focus,
body > header .search-bar-ajax .search-result-item a *,
body > header .search-bar-ajax .search-result-item a *:hover {
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
}
body > header .search-bar-ajax .search-result-body,
body > header .search-bar-ajax .search-result-body * {
    background: transparent !important;
}
body > header .search-bar-ajax .search-result-arrow {
    flex: 0 0 auto;
    color: #b88d4f;
    font-size: 14px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s ease, transform .15s ease;
}
body > header .search-bar-ajax .search-result-item a:hover .search-result-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Skeleton rows while we wait for the API */
body > header .search-bar-ajax .sp-skeleton {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
}
body > header .search-bar-ajax .sp-skel-img {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0ebe2 25%, #f7f2e8 50%, #f0ebe2 75%);
    background-size: 200% 100%;
    animation: sp-shimmer 1.2s linear infinite;
    flex: 0 0 auto;
}
body > header .search-bar-ajax .sp-skel-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
body > header .search-bar-ajax .sp-skel-line {
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0ebe2 25%, #f7f2e8 50%, #f0ebe2 75%);
    background-size: 200% 100%;
    animation: sp-shimmer 1.2s linear infinite;
}
body > header .search-bar-ajax .sp-skel-line.sp-short { width: 60%; }

@keyframes sp-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* No results / error card */
body > header .search-bar-ajax .sp-empty {
    padding: 18px 14px;
    list-style: none;
    text-align: center;
    display: block;
}
body > header .search-bar-ajax .sp-empty span {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 4px;
}
body > header .search-bar-ajax .sp-empty small {
    font-size: 12px;
    color: #6b6258;
}
body > header .search-bar-ajax .end-of-search-message {
    text-align: center;
    font-size: 12px;
    color: #6b6258;
    padding: 10px;
    list-style: none;
    border-top: 1px dashed rgba(28,28,30,0.06);
    margin-top: 4px;
}

/* Infinite-scroll loader — subtle gold spinner */
body > header .search-bar-ajax .infinite-scroll-loader {
    padding: 10px !important;
}
body > header .search-bar-ajax .infinite-scroll-loader .loader {
    border: 2px solid rgba(207, 163, 98, 0.25) !important;
    border-top-color: var(--hdp-gold) !important;
    width: 22px !important;
    height: 22px !important;
}

/* Dark mode */
body.dark-mode > header .search-bar-ajax .ajax-search-results {
    background: #2a2a2a !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
}
body.dark-mode > header .search-bar-ajax .search-result-item a { color: #f2eadd; }
body.dark-mode > header .search-bar-ajax .search-result-item a:hover { background: rgba(255,255,255,0.05); }
body.dark-mode > header .search-bar-ajax .search-result-image { background: #3a3a3a; }
body.dark-mode > header .search-bar-ajax .sp-empty span { color: #f2eadd; }
body.dark-mode > header .search-bar-ajax .sp-empty small { color: #b8aea0; }
body.dark-mode > header .search-bar-ajax .end-of-search-message { color: #b8aea0; border-top-color: rgba(255,255,255,0.08); }
body.dark-mode > header .search-bar-ajax .sp-skel-img,
body.dark-mode > header .search-bar-ajax .sp-skel-line {
    background: linear-gradient(90deg, #323232 25%, #3a3a3a 50%, #323232 75%);
    background-size: 200% 100%;
}

/* Dark-mode search */
body.dark-mode > header .search-bar-ajax .input-group {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(207, 163, 98, 0.30);
}
body.dark-mode > header .search-bar-ajax .input-group:focus-within {
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--hdp-gold);
    box-shadow: 0 0 0 4px rgba(207, 163, 98, 0.14);
}
body.dark-mode > header .search-bar-ajax .search-field,
body.dark-mode > header .search-bar-ajax input[type="search"] {
    color: #f2eadd !important;
}
body.dark-mode > header .search-bar-ajax .search-field::placeholder {
    color: #b8aea0;
}
body.dark-mode > header .search-bar-ajax .ajax-search-results {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.08);
}
