/*
 * Popin de recherche produit, mobile uniquement.
 *
 * La grille reutilise le markup WooCommerce du catalogue (ul.products / li.product) : seules la
 * mise en colonnes et les actions inutiles dans une popin sont surchargees, le reste du style
 * vient du theme.
 *
 * La position haute est posee en javascript (variable --mcs-msearch-top) pour laisser visible le
 * bandeau .mcs-ticker-wrap tant qu'il est a l'ecran.
 */

.mcs-msearch {
    --mcs-msearch-accent: #620d12;
    display: none;
    position: fixed;
    top: var(--mcs-msearch-top, 0px);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 999999;
    background: #fff;
    flex-direction: column;
    font-size: 16px;
}

.mcs-msearch.is-open {
    display: flex;
}

html.mcs-msearch-open,
html.mcs-msearch-open body {
    overflow: hidden;
}

/* Barre de recherche */

.mcs-msearch__bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
}

.mcs-msearch__form {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    height: 48px;
    padding: 0 18px;
    border: 1px solid #111;
    border-radius: 999px;
}

.mcs-msearch__loupe {
    flex: 0 0 auto;
    display: block;
    width: 20px;
    height: 20px;
    color: #111;
}

.mcs-msearch__loupe svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.mcs-msearch__input,
.mcs-msearch__input:focus {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    color: #111;
}

.mcs-msearch__input::-webkit-search-cancel-button {
    display: none;
}

/* Petite croix de reset du champ, a l'interieur de la pilule. */
.mcs-msearch .mcs-msearch__clear {
    flex: 0 0 auto;
    display: block;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #111;
    cursor: pointer;
}

/* Croix ronde noire de fermeture, a la hauteur du champ. */
.mcs-msearch .mcs-msearch__close {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-height: 0;
    margin: 0;
    padding: 13px;
    border: 0;
    border-radius: 50%;
    background: #111;
    box-shadow: none;
    color: #fff;
    cursor: pointer;
}

.mcs-msearch__clear svg,
.mcs-msearch__close svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Corps */

.mcs-msearch__body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 16px 48px;
}

.mcs-msearch__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #111;
}

.mcs-msearch__suggestions {
    margin-bottom: 32px;
}

.mcs-msearch__suggestions-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.mcs-msearch__suggestions-list li + li {
    margin-top: 0px;
}

.mcs-msearch .mcs-msearch__suggestion {
    display: inline-block;
    max-width: 100%;
    height: auto;
    min-height: 0;
    margin: 0 0 0 -6px;
    padding: 3px 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: #111;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Etat de selection de la suggestion : bordeaux MCS au lieu du surlignage par defaut. */
.mcs-msearch .mcs-msearch__suggestion:hover,
.mcs-msearch .mcs-msearch__suggestion:focus,
.mcs-msearch .mcs-msearch__suggestion:active {
    background: var(--mcs-msearch-accent);
    color: #fff;
}

.mcs-msearch__suggestion::selection {
    background: var(--mcs-msearch-accent);
    color: #fff;
}

.mcs-msearch__suggestion::-moz-selection {
    background: var(--mcs-msearch-accent);
    color: #fff;
}

.mcs-msearch__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.mcs-msearch .mcs-msearch__all {
    flex: 0 0 auto;
    padding: 14px 24px;
    border-radius: 999px;
    background: #111;
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.mcs-msearch__message {
    margin: 24px 0 0;
    font-size: 15px;
    color: #666;
}

/* Grille produits */

.mcs-msearch__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 12px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
}

.mcs-msearch__grid::before,
.mcs-msearch__grid::after {
    display: none !important;
}

.mcs-msearch__grid > li.product {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
}

.mcs-msearch__grid img {
    display: block;
    width: 100%;
    height: auto;
}

.mcs-msearch__grid .woocommerce-loop-product__title {
    margin: 10px 0 4px;
    padding: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.3;
}

/*
 * Le prix reprend le bordeaux MCS. La feuille WooCommerce impose son vert avec un selecteur a
 * quatre classes (.woocommerce ... ul.products li.product .price), d'ou une specificite
 * superieure ici en plus du !important.
 */
.mcs-msearch ul.products.mcs-msearch__grid li.product .price,
.mcs-msearch ul.products.mcs-msearch__grid li.product .price * {
    color: var(--mcs-msearch-accent, #620d12) !important;
}

.mcs-msearch__grid .price {
    display: block;
    font-size: 14px;
}

.mcs-msearch ul.products.mcs-msearch__grid li.product .price del,
.mcs-msearch ul.products.mcs-msearch__grid li.product .price del * {
    opacity: 0.5;
}

/*
 * Une popin de recherche n'a pas a porter les actions du catalogue : bouton d'ajout au panier
 * ("Choix des options") et bouton comparateur de jet-compare-wishlist.
 */
.mcs-msearch__grid .button,
.mcs-msearch__grid .add_to_cart_button,
.mcs-msearch__grid .jet-compare-button__container,
.mcs-msearch__grid .jet-wishlist-button__container,
.mcs-msearch__grid .compare,
.mcs-msearch__grid .yith-wcwl-add-to-wishlist,
.mcs-msearch__grid .wvs-archive-variation-wrapper {
    display: none !important;
}

/*
 * Chargement : le spinner est place juste au-dessus de la liste et les resultats precedents
 * restent affiches en attendant la reponse, simplement estompes.
 */
.mcs-msearch__spinner {
    width: 24px;
    height: 24px;
    margin: -5px auto 15px;
    border: 2px solid #e5e5e5;
    border-top-color: var(--mcs-msearch-accent);
    border-radius: 50%;
    animation: mcs-msearch-spin 0.7s linear infinite;
}

.mcs-msearch.is-loading .mcs-msearch__results {
    opacity: 0.4;
}

@keyframes mcs-msearch-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Garde-fou : au-dela du breakpoint mobile d'Elementor, l'input JetSearch du header reste seul. */
@media (min-width: 768px) {
    .mcs-msearch {
        display: none !important;
    }
}
