/* ====================================
   CONTAINER PRINCIPAL
   ==================================== */

.coelho-product-search-wrapper {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 15px;
}

/* ====================================
   BARRE DE RECHERCHE
   ==================================== */

.coelho-search-bar {
    position: relative;
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.coelho-search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s;
}

.coelho-search-input:focus {
    outline: none;
    border-color: #2271b1;
}

.coelho-search-btn {
    padding: 12px 30px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.3s;
}

.coelho-search-btn:hover {
    background: #135e96;
}

/* ====================================
   AUTOCOMPLÉTION
   ==================================== */

.coelho-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px; /* Largeur du bouton de recherche */
    background: white;
    border: 2px solid #2271b1;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.coelho-autocomplete.active {
    max-height: 400px;
    opacity: 1;
}

.autocomplete-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

/* Scrollbar personnalisée */
.autocomplete-list::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.autocomplete-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.autocomplete-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Items */
.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #f0f7ff;
}

/* Image produit */
.item-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Contenu */
.item-content {
    flex: 1;
    min-width: 0; /* Pour le text-overflow */
}

.item-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-title strong {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

.item-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.item-sku {
    font-family: monospace;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}

.item-category {
    color: #2271b1;
}

/* Stock */
.item-stock {
    flex-shrink: 0;
    font-size: 20px;
    margin-left: 10px;
}

/* Animation entrée */
@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.coelho-autocomplete.active .autocomplete-list {
    animation: slideDown 0.3s ease;
}

/* ====================================
   FILTRES DE STOCK
   ==================================== */

.coelho-stock-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: #333;
}

.stock-filter {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.stock-filter:hover {
    background: #e0e0e0;
}

.stock-filter.active {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

/* ====================================
   LOADING
   ==================================== */

.coelho-loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================================
   COMPTEUR RÉSULTATS
   ==================================== */

.coelho-results-count {
    margin-bottom: 1rem;
    font-size: 14px;
    color: #666;
}

/* ====================================
   TABLE PRODUITS
   ==================================== */

.coelho-products-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.coelho-products-table thead {
    background: #2271b1;
    color: white;
}

.coelho-products-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.coelho-products-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.coelho-products-table tbody tr:hover {
    background: #f9f9f9;
}

/* ====================================
   COLONNES SPÉCIFIQUES
   ==================================== */

.product-name {
    font-weight: 500;
    color: #333;
}

.product-docs {
    text-align: center;
}

.doc-link {
    display: inline-block;
    margin: 0 5px;
    font-size: 20px;
    color: #666;
    transition: color 0.3s;
}

.doc-link:hover {
    color: #2271b1;
}

.product-stock {
    text-align: center;
    font-size: 24px;
}

.product-action {
    text-align: center;
}

/* ====================================
   FORMULAIRE AJOUT PANIER
   ==================================== */

.coelho-add-to-cart {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.qty-input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.btn-add-cart,
.btn-read {
    padding: 8px 16px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}

.btn-add-cart:hover,
.btn-read:hover {
    background: #135e96;
}

.btn-read {
    background: #666;
}

.btn-read:hover {
    background: #444;
}

.out-of-stock-notice {
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.no-docs {
    color: #ccc;
}

/* ====================================
   PAGINATION
   ==================================== */

.coelho-pagination {
    margin-top: 2rem;
}

.coelho-pagination-nav {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover {
    background: #f0f0f0;
}

.page-btn.active {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

/* ====================================
   MESSAGES
   ==================================== */

.no-results,
.error {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 16px;
}

.error {
    color: #d63638;
}

/* ====================================
   RESPONSIVE
   ==================================== */

@media (max-width: 768px) {
    .coelho-autocomplete {
        right: 0; /* Pleine largeur sur mobile */
    }
    
    .autocomplete-item {
        padding: 10px;
    }
    
    .item-image {
        width: 40px;
        height: 40px;
    }
    
    .item-title {
        font-size: 14px;
    }
    
    .item-meta {
        font-size: 11px;
    }
    
    .coelho-products-table {
        font-size: 14px;
    }
    
    .coelho-products-table th,
    .coelho-products-table td {
        padding: 10px 8px;
    }
    
    .coelho-search-bar {
        flex-direction: column;
    }
    
    .qty-input {
        width: 50px;
    }
}

/* Focus visible pour accessibilité */
.autocomplete-item:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}
