/* SDTech Search Autocomplete Styles */

.sdtech-search-container {
    position: relative;
    width: 100%;
    max-width: 600px; /* Largeur augmentée */
    margin: 0 auto;
}

.sdtech-search-form {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sdtech-search-form:focus-within {
    border-color: #007cba;
    box-shadow: 0 2px 20px rgba(0, 124, 186, 0.2);
}

.sdtech-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 8px;
    font-size: 16px;
    color: #333;
    background: transparent;
}

.sdtech-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.sdtech-search-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #007cba;
    transition: color 0.3s ease;
}

.sdtech-search-button:hover {
    color: #005a87;
}

.sdtech-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: none; /* Bordure supprimée */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 450px; /* Hauteur augmentée */
    overflow-y: auto;
    display: none;
    margin-top: 8px;
    min-width: 400px; /* Largeur minimum pour les résultats */
}

.sdtech-search-results.show {
    display: block;
}

.sdtech-search-result-item {
    display: flex;
    align-items: center;
    padding: 14px 18px; /* Padding augmenté */
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    color: #333;
}

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

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

.sdtech-search-result-image {
    width: 60px; /* Taille augmentée */
    height: 60px; /* Taille augmentée */
    object-fit: cover;
    margin: 8px 20px 0 0; /* Margin-top ajouté + espace à droite */
    flex-shrink: 0;
}

.sdtech-search-result-content {
    flex: 1;
    min-width: 0;
}

.sdtech-search-result-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin: 8px 0 4px 0; /* Margin-top ajouté */
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sdtech-search-result-price {
    font-size: 13px;
    color: #007cba;
    font-weight: 600;
    margin: 2px 0;
}

.sdtech-search-result-description {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sdtech-search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.sdtech-search-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.sdtech-search-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: sdtech-search-spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* Modal Styles */
.sdtech-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.sdtech-search-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.sdtech-search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.sdtech-search-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.sdtech-search-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.sdtech-search-modal-close:hover {
    background-color: #f0f0f0;
}

.sdtech-search-modal-body {
    padding: 24px;
}

.sdtech-search-modal .sdtech-search-results {
    position: static;
    box-shadow: none;
    border: 1px solid #e0e0e0;
    margin-top: 16px;
    max-height: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sdtech-search-container {
        max-width: 100%;
    }
    
    .sdtech-search-form {
        padding: 6px 12px;
    }
    
    .sdtech-search-input {
        padding: 10px 6px;
        font-size: 14px;
    }
    
    .sdtech-search-result-item {
        padding: 10px 12px;
    }
    
    .sdtech-search-result-image {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
    
    .sdtech-search-result-title {
        font-size: 13px;
    }
    
    .sdtech-search-result-price {
        font-size: 12px;
    }
    
    .sdtech-search-result-description {
        font-size: 11px;
    }
    
    .sdtech-search-modal {
        padding-top: 50px;
    }
    
    .sdtech-search-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .sdtech-search-modal-header {
        padding: 16px 20px;
    }
    
    .sdtech-search-modal-body {
        padding: 20px;
    }
}

/* Focus and accessibility improvements */
.sdtech-search-result-item:focus {
    outline: none;
    background-color: #f8f9fa;
}

.sdtech-search-input:focus {
    outline: none;
}

.sdtech-search-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 4px;
}

.sdtech-search-modal-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Highlight matched text (will be added via JS) */
.sdtech-search-highlight {
    background-color: #f38230;
    font-weight: 600;
    padding: 0 2px;
}

/* Custom scrollbar for results */
.sdtech-search-results::-webkit-scrollbar {
    width: 6px;
}

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

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

.sdtech-search-results::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}