/* Besearch Lite - CSS Optimisé */

#besearch-lite-container {
    position: relative;
    width: 100%;
}

#besearch-lite-container.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.besearch-lite-header {
    position: sticky;
    top: 0;
    z-index: 1001;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 20px;
}

.besearch-lite-header-top {
    display: none;
}

#besearch-lite-container.active .besearch-lite-header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto 15px auto;
    width: 100%;
}

.besearch-lite-logo {
    flex-shrink: 0;
    width: auto;
    display: none; /* Caché par défaut (mobile) */
}

/* Logo visible uniquement sur desktop */
@media (min-width: 769px) {
    .besearch-lite-logo {
        display: block;
        transform: translateY(-10px);
    }
}

.besearch-lite-logo img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.besearch-lite-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: none;
}

.besearch-lite-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    outline: none;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.besearch-lite-input:focus {
    background: white;
    box-shadow: 0 0 0 2px #e5e7eb;
}

.besearch-lite-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: #000000;
    padding: 0;
}

.besearch-lite-close svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.besearch-lite-close:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.besearch-lite-results {
    display: none;
}

#besearch-lite-container.active .besearch-lite-results {
    display: block;
    padding: 30px 20px;
    background: white;
    flex: 1;
    overflow-y: auto;
}

.besearch-lite-results.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.besearch-lite-stats {
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    font-weight: 400;
    max-width: 1200px;
    margin: 0 auto;
}

.besearch-lite-loader {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.besearch-lite-loader.hidden {
    display: none;
}

.besearch-lite-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.besearch-lite-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Responsive pour afficher le maximum de produits */
@media (min-width: 1920px) {
    .besearch-lite-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1440px) and (max-width: 1919px) {
    .besearch-lite-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }
}

@media (min-width: 1024px) and (max-width: 1439px) {
    .besearch-lite-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

.besearch-lite-product {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.besearch-lite-product:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.besearch-lite-product-image {
    width: 100%;
    height: 240px;
    object-fit: contain;
    background: #fff;
    padding: 15px;
}

.besearch-lite-product-content {
    padding: 12px 16px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.besearch-lite-product-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.besearch-lite-product-price {
    font-size: 16px;
    font-weight: 600;
    color: #3b82f6;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.besearch-lite-product-arrow {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.besearch-lite-product:hover .besearch-lite-product-arrow {
    background: #2563eb;
    transform: translateX(4px);
}

.besearch-lite-product-sale {
    display: flex;
    align-items: center;
    gap: 8px;
}

.besearch-lite-product-regular {
    font-size: 14px;
    color: #9ca3af;
    text-decoration: line-through;
}

.besearch-lite-product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.besearch-lite-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.besearch-lite-no-results.hidden {
    display: none;
}

.besearch-lite-no-results svg {
    margin-bottom: 20px;
    color: #d1d5db;
}

.besearch-lite-no-results p {
    font-size: 18px;
    margin: 0;
    color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
    #besearch-lite-container.active .besearch-lite-header-top {
        gap: 12px;
        justify-content: flex-end; /* Searchbar à gauche, bouton X à droite */
    }

    /* Pas de logo sur mobile */
    .besearch-lite-logo {
        display: none !important;
    }

    .besearch-lite-search-wrapper {
        max-width: none;
        flex: 1;
    }

    .besearch-lite-input {
        padding: 12px 16px;
        font-size: 14px;
    }

    .besearch-lite-close {
        width: 36px;
        height: 36px;
    }

    .besearch-lite-close svg {
        width: 20px;
        height: 20px;
    }

    .besearch-lite-results {
        padding: 20px 10px;
    }
    
    .besearch-lite-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 10px;
    }
    
    .besearch-lite-product-image {
        height: 160px;
        padding: 10px;
    }
    
    .besearch-lite-product-content {
        padding: 10px 12px 12px 12px;
    }
    
    .besearch-lite-product-title {
        font-size: 13px;
        line-height: 1.2;
    }
    
    .besearch-lite-product-price {
        font-size: 14px;
    }
    
    .besearch-lite-product-arrow {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #besearch-lite-container.active .besearch-lite-header-top {
        gap: 8px;
    }

    /* Pas de logo sur mobile */
    .besearch-lite-logo {
        display: none !important;
    }

    .besearch-lite-input {
        padding: 10px 12px;
        font-size: 13px;
    }

    .besearch-lite-close {
        width: 32px;
        height: 32px;
    }

    .besearch-lite-close svg {
        width: 18px;
        height: 18px;
    }

    .besearch-lite-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0 8px;
    }
    
    .besearch-lite-product-image {
        height: 140px;
        padding: 8px;
    }
    
    .besearch-lite-product-content {
        padding: 8px 10px 10px 10px;
    }
    
    .besearch-lite-product-title {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .besearch-lite-product-price {
        font-size: 13px;
    }
    
    .besearch-lite-product-arrow {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
    
    .besearch-lite-product-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}
