/* ══════════════════════════════════════════════
   LA_SmartSearch — Dropdown autocomplete styles
   Compatible with Warehouse 4.8.x theme
   ══════════════════════════════════════════════ */

/* ── Dropdown container ── */
.ss-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Loader / Spinner ── */
.ss-loader {
    text-align: center;
    padding: 20px;
}

.ss-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #eee;
    border-top-color: #333;
    border-radius: 50%;
    animation: ss-spin 0.7s linear infinite;
}

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

/* ── Empty state ── */
.ss-empty {
    padding: 15px 20px;
    text-align: center;
    color: #999;
    font-size: 0.9em;
}

/* ── Fallback message ── */
.ss-fallback-msg {
    padding: 8px 15px;
    background: #fff8e1;
    color: #856404;
    font-size: 0.82em;
    border-bottom: 1px solid #f0e0b0;
}

/* ── "Did you mean?" ── */
.ss-fuzzy-msg {
    padding: 8px 15px;
    background: #f0f4ff;
    color: #555;
    font-size: 0.82em;
    font-style: italic;
    border-bottom: 1px solid #d8e2f0;
}

.ss-fuzzy-link {
    color: #072242;
    font-weight: 600;
    text-decoration: underline;
    font-style: normal;
}

.ss-fuzzy-link:hover {
    color: #000;
}

/* ── Recent searches ── */
.ss-recent-icon {
    color: #bbb;
    margin-right: 4px;
    font-size: 0.85em;
}

.ss-recent-item a {
    color: #555;
    font-size: 0.9em;
}

/* ── Section headers ── */
.ss-section {
    border-bottom: 1px solid #f0f0f0;
}

.ss-section:last-of-type {
    border-bottom: none;
}

.ss-section-title {
    padding: 8px 15px 4px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    font-weight: 600;
}

/* ── Items (shared) ── */
.ss-item {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ss-item a {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    text-decoration: none;
    color: inherit;
}

.ss-item:hover,
.ss-item.ss-active {
    background: #f5f5f5;
}

/* ── Product item ── */
.ss-product-img {
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    margin-right: 12px;
    overflow: hidden;
    border-radius: 3px;
    background: #fafafa;
}

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

.ss-product-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.ss-product-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.ss-product-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.ss-product-name b {
    color: #000;
    font-weight: 700;
}

.ss-product-price {
    flex-shrink: 0;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
}

.ss-product-meta {
    margin-top: 2px;
    font-size: 0.78em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ss-product-ref {
    color: #999;
    font-family: monospace;
}

.ss-product-stock {
    font-size: 0.82em;
    padding: 1px 6px;
    border-radius: 3px;
}

.ss-stock-in_stock {
    color: #27ae60;
    background: #eafaf1;
}

.ss-stock-on_order {
    color: #f39c12;
    background: #fef9e7;
}

.ss-stock-out_of_stock {
    color: #e74c3c;
    background: #fdedec;
}

/* ── Category item ── */
.ss-category a {
    padding: 6px 15px;
}

.ss-cat-name {
    font-size: 0.9em;
    color: #333;
}

.ss-cat-name b {
    font-weight: 700;
}

.ss-cat-count {
    font-size: 0.8em;
    color: #999;
    margin-left: 6px;
}

/* ── CMS item ── */
.ss-cms a {
    padding: 6px 15px;
    font-size: 0.9em;
    color: #555;
}

.ss-cms a b {
    color: #333;
    font-weight: 700;
}

/* ── See all results link ── */
.ss-see-all {
    border-top: 1px solid #eee;
}

.ss-see-all a {
    display: block;
    padding: 10px 15px;
    text-align: center;
    font-size: 0.85em;
    color: #333;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.ss-see-all a:hover {
    background: #f5f5f5;
    color: #000;
}

/* ══════════════════════════════════════════════
   Full page search results — Style Norelem
   (mirrored from warehousechild custom.css carousel)
   ══════════════════════════════════════════════ */

.ss-results-summary {
    margin-bottom: 20px;
    color: #555;
}

/* ── Sections catégories / CMS sur la page résultats ── */
.ss-page-section {
    margin-bottom: 20px;
}

.ss-page-section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.ss-page-section-title i {
    margin-right: 6px;
}

.ss-page-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ss-page-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.ss-page-tag-cat {
    background: #f0f4ff;
    color: #072242;
    border: 1px solid #d8e2f0;
}

.ss-page-tag-cat:hover {
    background: #dce6f5;
    border-color: #b0c4de;
}

.ss-page-tag-count {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.ss-page-tag-cms {
    background: #f5f5f5;
    color: #555;
    border: 1px solid #e0e0e0;
}

.ss-page-tag-cms:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

/* --- Grid layout : rangées de hauteur égale --- */
#ss-results {
    display: flex;
    flex-wrap: wrap;
}

#ss-results .js-product-miniature-wrapper,
#ss-results .product-carousel {
    display: flex;
    padding: 4px 6px;
    margin-bottom: 12px;
}

/* --- Carte --- */
#ss-results .product-miniature {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden !important;
    position: relative !important;
}

#ss-results .product-miniature:hover {
    box-shadow: none !important;
}

/* --- Zone image : carré plein bord --- */
#ss-results .thumbnail-container {
    position: relative;
    border-bottom: 1px solid #e0e0e0;
}

#ss-results .thumbnail-container .product-thumbnail {
    display: block;
}

#ss-results .thumbnail-container .product-thumbnail img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    padding: 0;
}

/* Séparateur image / description style Norelem */
#ss-results .thumbnail-container::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ccc 50%, transparent);
    margin: 0;
}

/* --- Zone description --- */
#ss-results .product-description {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
    position: relative;
    background: linear-gradient(to bottom, #f5f5f5, #ffffff);
    text-align: center;
}

/* Masquer ce qui ne sert pas */
#ss-results .product-category-name,
#ss-results .product-brand,
#ss-results .product-description-short {
    display: none;
}

/* Référence (badge vert) */
#ss-results .product-reference {
    margin-bottom: 6px;
}

#ss-results .product-reference a {
    display: inline-block;
    background: #2e7600;
    color: #fff !important;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 3px;
    text-decoration: none;
    letter-spacing: 0.04em;
}

/* Titre — pousse le prix en bas */
#ss-results .product-title {
    font-size: 0.82rem;
    line-height: 1.4;
    margin: 0;
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#ss-results .product-title a {
    color: #333;
    text-decoration: none;
}

/* --- Bloc prix : toujours en bas --- */
#ss-results .product-price-and-shipping {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #efefef;
    text-align: center;
}

#ss-results .product-price {
    font-size: 1rem;
    font-weight: 700;
    color: #222;
}

/* --- Barre "Voir le produit" style Norelem --- */
#ss-results .product-miniature .product-add-cart {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: absolute !important;
    top: 100%;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    transition: top 0.3s ease-in-out;
    background: #072242;
    z-index: 10;
}

#ss-results .product-miniature:hover .product-add-cart {
    top: 0;
}

#ss-results .product-add-cart .btn-product-list {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    height: 100%;
    padding: 14px 0;
    background: transparent !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    cursor: pointer;
}

#ss-results .product-add-cart .btn-product-list::after {
    content: none;
}

#ss-results .product-add-cart .bag-icon,
#ss-results .product-add-cart .spinner-icon {
    display: none !important;
}

/* Masquer les boutons fonctionnels sur l'image (œil + wishlist) */
#ss-results .product-functional-buttons {
    display: none !important;
}

/* Wishlist dans la barre bleue */
#ss-results .product-add-cart .btn-iqitwishlist-add {
    color: #fff !important;
    font-size: 1.3rem;
    padding: 14px 14px 14px 0;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
}

/* Masquer les déclinaisons/variants qui cassent la mise en page */
#ss-results .products-variants {
    display: none !important;
}

/* Forcer hauteur uniforme des cartes */
#ss-results .js-product-miniature-wrapper {
    display: flex;
}

#ss-results .product-miniature {
    width: 100%;
}

/* Badge référence en haut à droite de l'image */
#ss-results .product-reference-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #072242;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    z-index: 2;
}

/* ── Mobile: dropdown inside the Bootstrap dropdown of mobile header ── */
#search-widget-mobile .ss-dropdown {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Mobile responsive ── */
@media (max-width: 767px) {
    .ss-dropdown {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 65vh;
        border-radius: 12px 12px 0 0;
        border: none;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    /* Larger tap targets — min 44px (Apple HIG) */
    .ss-item a {
        padding: 12px 14px;
        min-height: 44px;
    }

    .ss-product-img {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
    }

    .ss-product-name {
        font-size: 0.92em;
        white-space: normal;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .ss-product-header {
        flex-wrap: wrap;
        gap: 4px;
    }

    .ss-product-price {
        font-size: 0.88em;
    }

    .ss-category a {
        padding: 12px 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .ss-cms a {
        padding: 12px 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .ss-section-title {
        padding: 10px 14px 4px;
    }

    .ss-see-all a {
        padding: 14px;
        font-size: 0.9em;
    }

    .ss-empty {
        padding: 20px 14px;
    }
}

/* ══════════════════════════════════════════════
   V2 — Faceted navigation styles
   ══════════════════════════════════════════════ */

.ss-facets-container {
    font-size: 0.9rem;
}

/* ── Facet group ── */
.ss-facet-group {
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #fff;
}

.ss-facet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
}

.ss-facet-header:hover {
    background: #fafafa;
}

.ss-facet-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ss-facet-toggle {
    font-size: 1.1rem;
    color: #999;
    line-height: 1;
}

.ss-facet-body {
    padding: 0 14px 12px;
}

/* ── Search within group ── */
.ss-facet-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.82rem;
    margin-bottom: 8px;
    outline: none;
}

.ss-facet-search:focus {
    border-color: #072242;
}

/* ── Checkbox / Radio list ── */
.ss-facet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
}

.ss-facet-item {
    padding: 3px 0;
}

.ss-facet-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #444;
    margin: 0;
}

.ss-facet-item.ss-selected label {
    font-weight: 600;
    color: #072242;
}

.ss-facet-item input[type="checkbox"],
.ss-facet-item input[type="radio"] {
    flex-shrink: 0;
    margin: 0;
}

.ss-facet-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-facet-count {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #999;
}

/* ── Color swatches ── */
.ss-facet-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ss-color-swatch {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ss-color-swatch input {
    display: none;
}

.ss-color-box {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ddd;
    transition: border-color 0.15s;
}

.ss-color-swatch:hover .ss-color-box,
.ss-color-swatch.ss-selected .ss-color-box {
    border-color: #072242;
    box-shadow: 0 0 0 2px #072242;
}

/* ── Price slider ── */
.ss-price-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.ss-price-inputs input[type="number"] {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.85rem;
    text-align: center;
}

.ss-price-slider input[type="range"] {
    width: 100%;
    margin: 2px 0;
}

/* ── Link style facets ── */
.ss-facet-link {
    color: #444;
    text-decoration: none;
    padding: 2px 0;
    display: inline-block;
}

.ss-facet-link:hover,
.ss-facet-link.ss-selected {
    color: #072242;
    font-weight: 600;
}

/* ── Active filters bar ── */
.ss-active-filters {
    padding: 10px 0;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.ss-active-filters-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    margin-right: 4px;
}

.ss-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #f0f4ff;
    color: #072242;
    border: 1px solid #d8e2f0;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.ss-active-tag:hover {
    background: #dce6f5;
}

.ss-clear-all {
    font-size: 0.8rem;
    color: #999;
    text-decoration: underline;
    margin-left: 8px;
}

.ss-clear-all:hover {
    color: #333;
}

/* ── Loading state ── */
.ss-loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ── Mobile: facets as collapsible drawer ── */
@media (max-width: 991px) {
    .ss-facets-container {
        margin-bottom: 15px;
    }

    .ss-facet-list {
        max-height: 200px;
    }
}
