/**
 * Starter Search – Base styles
 *
 * Hiérarchie des classes CSS :
 *
 *  .starter-search                  → conteneur racine
 *    .starter-search__input-wrapper → wrapper du champ + boutons
 *    .starter-search__input         → <input> de recherche
 *    .starter-search__loader        → icône loader (spin)
 *    .starter-search__button        → bouton loupe
 *    .starter-search__results       → <ul> dropdown résultats
 *    .starter-search__result-item   → <li> un résultat
 *    .starter-search__result-thumb  → miniature / placeholder
 *    .starter-search__result-text   → wrapper titre + badge
 *    .starter-search__result-title  → titre du post
 *    .starter-search__result-badge  → badge type de post
 *    .starter-search__empty         → message "aucun résultat"
 */

/* ------------------------------------------------------------------ */
/*  Conteneur racine                                                   */
/* ------------------------------------------------------------------ */
.starter-search {
    position: relative;
    width: 100%;
}

/* ------------------------------------------------------------------ */
/*  Input                                                              */
/* ------------------------------------------------------------------ */
.starter-search__input {
    height: 40px;
    border-radius: 9999px;
    border: 2px solid #3b82f6;
    background: #fff;
    padding: 0 3rem 0 1.25rem;
    font-size: 0.95rem;
    color: #111827;
    width: 100%;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.starter-search__input::placeholder {
    color: #9ca3af;
}

.starter-search__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.starter-search__button {
    position: absolute;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    line-height: 1;
}

.starter-search__loader {
    position: absolute;
    right: 3rem;
    display: flex;
    align-items: center;
    color: #9ca3af;
}

.starter-search__loader.hidden {
    display: none;
}

/* ------------------------------------------------------------------ */
/*  Dropdown résultats                                                 */
/* ------------------------------------------------------------------ */
.starter-search__results,
.starter-search__empty {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 360px;
    list-style: none;
    padding: 6px 0;
}

.starter-search__results {
    max-height: 340px;
    overflow-y: auto;
}

.starter-search__empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.starter-search__results.hidden,
.starter-search__empty.hidden {
    display: none;
}

/* ------------------------------------------------------------------ */
/*  Items résultats                                                    */
/* ------------------------------------------------------------------ */
.starter-search__result-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 16px !important;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    transition: background-color 0.15s;
    text-decoration: none;
}

.starter-search__result-item:hover {
    background-color: #f9fafb;
}

.starter-search__result-thumb {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    flex-shrink: 0 !important;
    border-radius: 8px;
    object-fit: cover !important;
}

span.starter-search__result-thumb {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #f3f4f6;
    color: #9ca3af;
}

.starter-search__result-text {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden;
}

.starter-search__result-title {
    font-weight: 600 !important;
    color: #111827 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    font-size: 0.9rem;
}

.starter-search__result-badge {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
    display: block;
    text-transform: capitalize;
}

/* Highlighted item (keyboard nav) */
.starter-search__result-item--active {
    background-color: #f3f4f6 !important;
}

/* Arrow */
.starter-search__result-arrow {
    margin-left: auto;
    flex-shrink: 0;
    color: #d1d5db;
}


/* ------------------------------------------------------------------ */
/*  Spin animation (Tailwind's animate-spin needs the keyframes)       */
/* ------------------------------------------------------------------ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 0.7s linear infinite;
}

/* ------------------------------------------------------------------ */
/*  Scrollbar discret pour la liste de résultats                       */
/* ------------------------------------------------------------------ */
.starter-search__results {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.starter-search__results::-webkit-scrollbar {
    width: 6px;
}

.starter-search__results::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

/* ------------------------------------------------------------------ */
/*  Reset du style natif du champ search (cross-browser)               */
/* ------------------------------------------------------------------ */
.starter-search__input::-webkit-search-cancel-button,
.starter-search__input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

/* ------------------------------------------------------------------ */
/*  Focus-visible pour l'accessibilité clavier                         */
/* ------------------------------------------------------------------ */
.starter-search__button:focus-visible {
    outline: 2px solid #6b7280;
    outline-offset: 2px;
}
