/**
 * Search Engine - CSS Front-end
 * Style du formulaire de recherche
 */

/* Conteneur principal */
.search-engine-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Formulaire */
.search-engine-form {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

/* Champs de formulaire */
.se-field {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.se-field-inner {
    position: relative;
    display: flex;
    align-items: center;
}

/* Inputs */
.se-input {
    width: 100%;
    padding: 12px 40px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fff;
    -webkit-appearance: none; /* Retirer les styles par défaut iOS */
    -moz-appearance: none;
    appearance: none;
}

/* Fix spécifique pour les selects sur iOS */
.se-select-type {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="gray" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    padding-right: 40px;
}

.se-input:focus {
    outline: none;
    border-color: #bf1677;
    box-shadow: 0 0 0 3px rgba(191, 22, 119, 0.1);
}

.se-input::placeholder {
    color: #999;
}

/* Icônes */
.se-icon {
    width: 20px;
    height: 20px;
    fill: #666;
}

.se-icon-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    stroke: #666;
    stroke-width: 2;
    fill: none;
}

/* Bouton clear */
.se-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.se-clear:hover {
    opacity: 1;
}

.se-clear .se-icon {
    width: 16px;
    height: 16px;
}

/* Séparateur */
.se-separator {
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

/* Bouton de recherche */
.se-submit {
    padding: 12px 30px;
    background: #bf1677;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.se-submit:hover {
    background: #9a1260;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(191, 22, 119, 0.3);
}

.se-submit:active {
    transform: translateY(0);
}

/* Suggestions d'autocomplétion */
.se-suggestions {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.se-suggestions-inner {
    padding: 5px 0;
}

.se-suggestion-item {
    padding: 22px 29px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.se-suggestion-item:hover,
.se-suggestion-item.active {
    background: #fce8f3;
}

.se-suggestion-label {
    font-size: 15px;
    color: #333;
}

.se-suggestion-count {
    font-size: 13px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
}

.se-suggestion-loading {
    padding: 15px;
    text-align: center;
    color: #999;
}

.se-suggestion-empty {
    padding: 15px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .search-engine-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .se-field {
        width: 100%;
        min-width: auto;
    }
    
    .se-separator {
        display: none;
    }
    
    .se-submit {
        width: 100%;
    }
    
    /* Réduire le padding des suggestions sur mobile */
    .se-suggestion-item {
        padding: 12px 15px;
    }
}

@media (max-width: 700px) {
    .search-engine-wrapper {
        padding: 10px;
    }
    
    .search-engine-form {
        padding: 10px;
    }
    
    .se-input {
        font-size: 16px !important; /* Minimum 16px pour éviter le zoom automatique sur iOS */
        padding: 14px 40px 14px 45px !important;
        color: black;
        -webkit-appearance: none; /* Retirer les styles par défaut iOS */
        -moz-appearance: none;
        appearance: none;
        border-radius: 6px; /* Réaffirmer le border-radius pour iOS */
    }


    /* Select spécifique pour iOS */
    .se-select-type {
        font-size: 16px !important;
        padding: 14px 40px 14px 45px !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url('data:image/svg+xml;utf8,<svg fill="gray" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
        background-repeat: no-repeat;
        background-position: right 10px center;
        background-size: 20px;
    }
    
    .se-submit {
        padding: 14px 20px;
        font-size: 16px;
        -webkit-appearance: none;
    }
    
    /* Réduire encore plus le padding des suggestions sur petit écran */
    .se-suggestion-item {
        padding: 10px 12px;
        font-size: 14px;
    }
}
