/* Styles pour le composant de recherche d'articles */

/* Conteneur principal */
[data-controller="article-search"] {
    position: relative;
}

/* Conteneur des résultats */
.article-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 300px;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 9999 !important;
    margin-top: 2px;
}

/* S'assurer que le dropdown est visible même dans un tableau */
.article-search-results:not(.d-none) {
    display: block !important;
}

/* CRITICAL: Désactiver overflow sur table-responsive pour permettre au dropdown de sortir */
.table-responsive {
    overflow: visible !important;
}

/* Item de résultat */
.article-search-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.15s ease;
}

.article-search-item:hover {
    background-color: #f8f9fa;
}

.article-search-item:last-child {
    border-bottom: none;
}

/* Nom de l'article */
.article-search-item-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #212529;
}

/* Métadonnées (référence, stock, prix) */
.article-search-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

/* Message "Aucun résultat" */
.article-search-no-results,
.article-search-loading,
.article-search-error {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
}

.article-search-no-results i,
.article-search-error i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.article-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Article sélectionné */
.selected-article-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
    background-color: #e7f5ff;
    border: 1px solid #74c0fc;
    border-radius: 0.375rem;
}

.selected-article-name {
    flex: 1;
    font-weight: 500;
    color: #1971c2;
}

.btn-clear-selection {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #1971c2;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.btn-clear-selection:hover {
    opacity: 1;
}

/* Animation flash pour le montant */
.line-amount-display {
    display: inline-block;
    color: #0d6efd;
}

.line-amount-display.flash {
    animation: flash-amount 0.5s ease;
}

@keyframes flash-amount {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: #fff3cd;
    }
}

/* Responsive */
@media (max-width: 576px) {
    .article-search-results {
        max-height: 200px;
    }

    .article-search-item {
        padding: 0.5rem 0.75rem;
    }

    .article-search-item-meta {
        flex-wrap: wrap;
    }
}
