/* search.css */

/* --- CONFIGURATION GLOBALE --- */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: transparent; /* Fond transparent pour se fondre dans la page parente */
    margin: 0;
    padding: 0;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh; /* Force la hauteur pour le centrage */
    transition: all 0.5s ease;
    overflow-x: hidden;
}

/* --- LE CONTENEUR DE RECHERCHE (Animation) --- */
.search-container {
    width: 90%;
    max-width: 700px;
    padding: 20px;
    text-align: center;
    
    /* Positionnement INITIAL : Centré verticalement */
    position: absolute;
    top: 40%; 
    left: 50%;
    transform: translate(-50%, -50%); /* Centrage parfait */
    
    z-index: 100;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    backdrop-filter: blur(5px); /* Petit effet de flou moderne */
}

/* --- ÉTAT ACTIVÉ (Quand la recherche est lancée) --- */
body.search-active .search-container {
    top: 20px; /* Remonte en haut */
    transform: translate(-50%, 0); /* Annule le centrage vertical */
    background: transparent; /* Enlève le fond blanc du conteneur */
    backdrop-filter: none;
    padding: 10px;
}

/* --- INPUTS ET BOUTONS --- */
input[type="text"] {
    width: 60%;
    padding: 12px 20px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    outline: none;
    transition: 0.3s;
}

input[type="text"]:focus {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

button {
    padding: 12px 20px;
    font-size: 14px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    margin: 5px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, background-color 0.2s;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

/* Boutons flèches plus discrets */
#prev-verse, #next-verse {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    width: 40px;
    padding: 12px 0;
}

/* --- ZONE DE RÉSULTATS --- */
#results-container {
    width: 100%;
    max-width: 800px;
    margin-top: 100px; /* Espace pour la barre remontée */
    padding-bottom: 50px;
    opacity: 0; /* Caché au départ */
    transition: opacity 0.5s ease 0.3s; /* Apparaît avec un délai */
}

body.search-active #results-container {
    opacity: 1;
}

/* --- CARTES DE RÉSULTATS (Générées par le JS) --- */
.version-result {
    background: white;
    border-radius: 12px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 5px solid #3498db;
    transition: transform 0.2s ease;
}

.version-result:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.version-result h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.version-result p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #2c3e50;
    margin: 0;
}

.error {
    color: #e74c3c;
    background: #fdf0ed;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #fadbd8;
}

.loading {
    text-align: center;
    font-style: italic;
    color: #7f8c8d;
    margin-top: 20px;
}

/* --- CORRECTIF MOBILE (À placer à la fin de search.css) --- */
@media screen and (max-width: 768px) {

    /* 1. On augmente l'espace au-dessus des résultats sur mobile */
    body.search-active #results-container {
        margin-top: 240px; /* On pousse plus bas car la barre est plus haute */
        padding-top: 20px;
    }

    /* 2. On garde le fond blanc de la barre de recherche sur mobile */
    /* Sinon on voit le texte défiler derrière, ce qui n'est pas pro */
    body.search-active .search-container {
        background: #fff;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1); /* Petite ombre pour séparer */
        top: 0;
        padding-top: 15px;
        border-radius: 0 0 15px 15px; /* Arrondi seulement en bas */
    }

    /* 3. On organise mieux les boutons pour qu'ils prennent moins de place */
    .search-container {
        display: flex;
        flex-wrap: wrap; /* Permet aux éléments de passer à la ligne proprement */
        justify-content: center;
        gap: 10px;
    }

    /* Le champ de recherche prend toute la largeur */
    input[type="text"] {
        width: 100% !important; 
        order: 1; /* On force l'ordre : input en premier */
        margin-bottom: 5px;
    }

    /* Les flèches de navigation */
    #prev-verse, #next-verse {
        width: 45px;
        order: 2; /* Les flèches en deuxième ligne */
        flex-grow: 0;
    }

    /* Le bouton comparer */
    #search-button {
        width: auto;
        flex-grow: 1; /* Il prend la place restante */
        order: 2; /* Sur la même ligne que les flèches */
        font-size: 13px; /* Texte un peu plus petit pour tenir */
        padding: 12px 10px;
        margin: 0;
    }
}