/* ==========================================================================
   Velosport Search - Module de recherche performant
   ========================================================================== */

/* --- Wrapper principal --- */
.velosport-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    z-index: 1000;
}

/* --- Formulaire de recherche --- */
#velosport-search-form {
    width: 100%;
    margin: 0;
    padding: 0;
}

.velosport-search-inner {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #333;
    border-radius: 50px;
    padding: 0 20px;
    height: 46px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.velosport-search-inner:focus-within {
    border-color: #999;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* --- Icône loupe --- */
.velosport-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    margin-right: 10px;
    flex-shrink: 0;
}

.velosport-search-icon svg {
    width: 18px;
    height: 18px;
}

/* --- Input de recherche --- */
#velosport-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #333;
    font-family: inherit;
    padding: 0;
    height: 100%;
    line-height: normal;
}

#velosport-search-input::placeholder {
    color: #aaa;
    font-size: 14px;
}

#velosport-search-input:focus {
    outline: none;
    box-shadow: none;
}

/* --- Bouton clear (croix) --- */
.velosport-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.velosport-search-clear:hover {
    color: #333;
}

/* ==========================================================================
   Dropdown des résultats
   ========================================================================== */

.velosport-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
    max-height: 480px;
    overflow-y: auto;
    z-index: 1001;
    border: 1px solid #eee;
}

/* --- Scrollbar custom --- */
.velosport-search-results::-webkit-scrollbar {
    width: 6px;
}

.velosport-search-results::-webkit-scrollbar-track {
    background: transparent;
}

.velosport-search-results::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* --- Loading spinner --- */
.velosport-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 10px;
    color: #888;
    font-size: 13px;
}

.velosport-search-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #c10000;
    border-radius: 50%;
    animation: velosport-spin 0.6s linear infinite;
}

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

/* --- Titres de section --- */
.velosport-search-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #999;
    padding: 14px 18px 8px;
    border-bottom: 1px solid #f5f5f5;
}

/* --- Listes --- */
.velosport-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* --- Catégories --- */
.velosport-search-categories ul li a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    gap: 8px;
}

.velosport-search-categories ul li a:hover {
    background: #f8f8f8;
}

.velosport-search-categories ul li a::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #c10000;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Produits --- */
.velosport-search-products ul li a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s;
    gap: 14px;
}

.velosport-search-products ul li a:hover {
    background: #f8f8f8;
}

/* Image produit */
.velosport-search-product-img {
    width: 55px;
    height: 55px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.velosport-search-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Infos produit */
.velosport-search-product-info {
    flex: 1;
    min-width: 0;
}

.velosport-search-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.velosport-search-product-category {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* Prix */
.velosport-search-product-price {
    text-align: right;
    flex-shrink: 0;
}

.velosport-search-product-price .current-price {
    font-size: 15px;
    font-weight: 700;
    color: #222;
}

.velosport-search-product-price .old-price {
    font-size: 12px;
    color: #bbb;
    text-decoration: line-through;
    margin-right: 4px;
}

.velosport-search-product-price.has-reduction .current-price {
    color: #c10000;
}

/* --- Aucun résultat --- */
.velosport-search-no-results {
    padding: 30px 18px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* --- Voir tous les résultats --- */
.velosport-search-see-all {
    border-top: 1px solid #f0f0f0;
    text-align: center;
    padding: 12px 18px;
}

.velosport-search-see-all a {
    color: #c10000;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.velosport-search-see-all a:hover {
    color: #8b0000;
    text-decoration: underline;
}

/* --- Highlight du terme recherché --- */
.velosport-search-highlight {
    background: #fff3cd;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: inherit;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {
    .velosport-search-wrapper {
        max-width: 100%;
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .velosport-search-inner {
        height: 42px;
        padding: 0 16px;
    }

    #velosport-search-input {
        font-size: 13px;
    }

    #velosport-search-input::placeholder {
        font-size: 13px;
    }

    .velosport-search-results {
        border-radius: 8px;
        max-height: 380px;
    }

    .velosport-search-product-img {
        width: 45px;
        height: 45px;
    }

    .velosport-search-product-name {
        font-size: 13px;
    }

    .velosport-search-product-price .current-price {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .velosport-search-inner {
        height: 40px;
        border-radius: 25px;
        padding: 0 14px;
    }

    .velosport-search-products ul li a {
        padding: 8px 14px;
        gap: 10px;
    }

    .velosport-search-product-img {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }
}
