/**
 * Lightweight AJAX Search - CSS ultra-léger
 * Optimisé pour l'accessibilité et les seniors
 * Taille minimale, performances maximales
 */

/* === CONTENEUR PRINCIPAL === */
.las-search-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* === FORMULAIRE === */
.las-search-form {
    position: relative;
    width: 100%;
}

/* === WRAPPER DE RECHERCHE === */
.las-search-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
    width: 100%;
}

/* === CHAMP DE SAISIE === */
.las-search-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 18px; /* Grande taille pour seniors */
    line-height: 1.4;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.las-search-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.las-search-input::placeholder {
    color: #999;
    opacity: 1;
}

/* === BOUTON DE RECHERCHE === */
.las-search-button {
    padding: 16px 24px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.las-search-button:hover {
    background: #0052a3;
}

.las-search-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
}

.las-search-button svg {
    width: 24px;
    height: 24px;
}

/* === CONTENEUR DES RÉSULTATS === */
.las-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.las-search-results.las-results-visible {
    display: block;
}

/* === LISTE DES RÉSULTATS === */
.las-results-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* === ITEM DE RÉSULTAT === */
.las-result-item {
    border-bottom: 1px solid #eee;
}

.las-result-item:last-child {
    border-bottom: none;
}

.las-result-link {
    display: flex;
    gap: 16px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.las-result-link:hover,
.las-result-link:focus {
    background: #f5f5f5;
    outline: none;
}

/* === IMAGE DU PRODUIT === */
.las-result-image-wrapper {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border-radius: 6px;
    overflow: hidden;
}

.las-result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.las-result-no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

/* === CONTENU DU RÉSULTAT === */
.las-result-content {
    flex: 1;
    min-width: 0;
}

.las-result-title {
    margin: 0 0 8px 0;
    font-size: 18px; /* Grande taille pour seniors */
    font-weight: 600;
    line-height: 1.3;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.las-result-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.las-result-price {
    font-size: 17px; /* Grande taille pour seniors */
    font-weight: 700;
    color: #0066cc;
}

.las-result-stock {
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.las-result-stock.in-stock {
    background: #d4edda;
    color: #155724;
}

.las-result-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

/* === LOADER === */
.las-loader {
    padding: 24px;
    text-align: center;
    font-size: 16px;
    color: #666;
}

/* === AUCUN RÉSULTAT === */
.las-no-results {
    padding: 24px;
    text-align: center;
    font-size: 16px;
    color: #666;
}

/* === ERREUR === */
.las-error {
    padding: 24px;
    text-align: center;
    font-size: 16px;
    color: #c00;
    background: #ffe6e6;
    border-radius: 6px;
    margin: 8px;
}

/* === RESPONSIVE - TABLETTES === */
@media (max-width: 768px) {
    .las-search-input {
        font-size: 16px;
        padding: 14px 16px;
    }

    .las-search-button {
        padding: 14px 20px;
        min-width: 56px;
    }

    .las-result-title {
        font-size: 16px;
    }

    .las-result-price {
        font-size: 16px;
    }

    .las-result-image-wrapper {
        width: 70px;
        height: 70px;
    }
}

/* === RESPONSIVE - MOBILES === */
@media (max-width: 480px) {
    .las-search-wrapper {
        gap: 6px;
    }

    .las-search-input {
        font-size: 16px; /* Minimum 16px pour éviter le zoom sur iOS */
        padding: 12px 14px;
    }

    .las-search-button {
        padding: 12px 16px;
        min-width: 52px;
    }

    .las-search-button svg {
        width: 20px;
        height: 20px;
    }

    .las-result-link {
        gap: 12px;
        padding: 12px;
    }

    .las-result-image-wrapper {
        width: 60px;
        height: 60px;
    }

    .las-result-title {
        font-size: 15px;
    }

    .las-result-price {
        font-size: 15px;
    }

    .las-result-stock {
        font-size: 13px;
        padding: 3px 8px;
    }

    .las-search-results {
        max-height: 400px;
    }
}

/* === ACCESSIBILITÉ === */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* Améliorer le contraste pour les modes à fort contraste */
@media (prefers-contrast: high) {
    .las-search-input {
        border-width: 3px;
    }

    .las-search-button {
        border: 2px solid #000;
    }

    .las-result-link:hover,
    .las-result-link:focus {
        outline: 2px solid #000;
    }
}

/* === SCROLLBAR PERSONNALISÉE (OPTIONNEL) === */
.las-search-results::-webkit-scrollbar {
    width: 10px;
}

.las-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.las-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.las-search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
