/* === RECHERCHE DU SITE ===
   Loupe à droite des onglets du menu principal, panneau de recherche instantanée,
   page de résultats. Voir includes/recherche.php et assets/js/recherche.js. */

.hcp-search-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- Loupe dans le menu (ordinateur) : à droite, alignée sur les onglets --- */
#mainnav .hcp-search {
    float: right;
    position: relative;
    z-index: 600; /* au-dessus des sous-menus (500) */
    text-transform: none;
}
.hcp-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 42px;
    margin: 0;
    padding: 3px 0 0;
    background: #f0f0f0;
    border: none;
    border-bottom: 1px solid #ccc;
    color: black;
    cursor: pointer;
}
.hcp-search-toggle:hover,
.hcp-search-toggle[aria-expanded="true"] {
    color: #c2a661;
}
.hcp-search-toggle:focus-visible {
    outline: 2px solid #c2a661;
    outline-offset: -2px;
}

/* --- Panneau --- */
.hcp-search-panel {
    position: absolute;
    top: 42px;
    right: 0;
    width: 440px;
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    padding: 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-top: 2px solid #c2a661;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    text-transform: none;
    text-align: left;
}
.hcp-search-panel[hidden] {
    display: none;
}

.hcp-search-form,
.hcp-search-page-form {
    display: flex;
    gap: 8px;
    margin: 0;
}
.hcp-search-form input[type="search"],
.hcp-search-page-form input[type="search"] {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font: inherit;
    font-size: 16px; /* évite le zoom automatique sur iPhone */
    color: #222;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}
.hcp-search-form input[type="search"]:focus,
.hcp-search-page-form input[type="search"]:focus {
    outline: none;
    border-color: #c2a661;
    box-shadow: 0 0 0 2px rgba(194, 166, 97, 0.25);
}
.hcp-search-form button,
.hcp-search-page-form button {
    padding: 10px 16px;
    background: #c2a661;
    color: #fff;
    border: none;
    border-radius: 5px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.hcp-search-form button:hover,
.hcp-search-page-form button:hover {
    background: #a88d4c;
}

.hcp-search-status {
    margin: 10px 2px 0;
    font-size: 12px;
    color: #777;
}
.hcp-search-status:empty {
    display: none;
}

.hcp-search-results {
    max-height: min(60vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.hcp-search-results:empty {
    display: none;
}
.hcp-search-results-group {
    margin-top: 12px;
}
.hcp-search-results-label {
    margin: 0 0 4px;
    padding: 0 4px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #999;
}
.hcp-search-results-label span {
    color: #bbb;
}
#mainnav .hcp-search-results a,
.hcp-search-results a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    border-radius: 4px;
    color: #222;
    text-decoration: none;
    line-height: 1.3;
    background: none;
    border-bottom: none;
    text-shadow: none;
}
.hcp-search-results a:hover,
.hcp-search-results a:focus,
.hcp-search-results a.is-active {
    background: #f6f1e4;
    outline: none;
}
.hcp-search-results-thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    background: #f3f3f3;
    overflow: hidden;
}
.hcp-search-results-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.hcp-search-results-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.hcp-search-results-title {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hcp-search-results-title mark {
    background: none;
    color: #a88d4c;
}
.hcp-search-results-meta {
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#mainnav .hcp-search-results a.hcp-search-all,
.hcp-search-results a.hcp-search-all {
    justify-content: center;
    margin-top: 10px;
    padding: 10px;
    border-top: 1px solid #eee;
    border-radius: 0;
    color: #a88d4c;
    font-weight: bold;
}

/* --- Mobile (≤ 500 px) : loupe à droite de la barre « Menu », panneau pleine largeur --- */
@media screen and (max-width: 500px) {
    #mainnav {
        position: relative;
    }
    #mainnav .hcp-search {
        float: none;
        position: static;
    }
    .hcp-search-toggle {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 2;
        width: 52px;
        height: 44px;
        padding: 0;
        background: transparent;
        border-bottom: none;
        border-left: 1px solid #ddd;
    }
    .hcp-search-panel {
        top: 44px;
        left: 0;
        right: 0;
        width: auto;
        max-width: none;
        z-index: 600;
        border-left: none;
        border-right: none;
    }
    .hcp-search-results {
        max-height: 65vh;
    }
}

/* --- Page de résultats --- */
.hcp-search-page .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.hcp-search-page-title {
    margin: 0 0 20px;
    text-align: center;
}
.hcp-search-page .hcp-search-page-form {
    max-width: 640px;
    margin: 0 auto 16px;
}
.hcp-search-page-count {
    text-align: center;
    color: #888;
    margin: 0 0 16px;
}
.hcp-search-page-types {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}
.hcp-search-page-types a {
    padding: 6px 14px;
    border: 1px solid #c2a661;
    border-radius: 20px;
    color: #a88d4c;
    text-decoration: none;
    font-size: 14px;
}
.hcp-search-page-types a:hover {
    background: #c2a661;
    color: #fff;
}
.hcp-search-page-types span {
    opacity: 0.7;
}
.hcp-search-group {
    margin-bottom: 40px;
    scroll-margin-top: 80px;
}
.hcp-search-group h2 {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    font-size: 20px;
}
.hcp-search-group h2 span {
    color: #aaa;
    font-weight: normal;
    font-size: 16px;
}
.hcp-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.hcp-search-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    color: #222;
    text-decoration: none;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.hcp-search-card:hover {
    border-color: #c2a661;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}
.hcp-search-card-thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    background: #f3f3f3;
    overflow: hidden;
}
.hcp-search-card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.hcp-search-card--realisations .hcp-search-card-thumb img,
.hcp-search-card--solutions .hcp-search-card-thumb img {
    object-fit: cover;
}
.hcp-search-card-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.hcp-search-card-title {
    font-weight: bold;
    line-height: 1.3;
}
.hcp-search-card-meta {
    font-size: 13px;
    color: #888;
}
.hcp-search-empty {
    text-align: center;
    color: #555;
}
.hcp-search-empty .etiquette-gold {
    display: inline-block;
    margin: 6px 4px;
}
