body {
    font-family: 'Roboto', sans-serif; /* Police moderne */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px; /* Un peu plus d'espace */
    background-color: #f8f9fa; /* Fond légèrement différent */
    color: #343a40; /* Texte un peu plus doux */
    min-height: 100vh;
    box-sizing: border-box;
}

header {
    margin-bottom: 25px;
    text-align: center;
}

h1 {
    color: #0056b3; /* Gardons le bleu distinctif */
    font-weight: 700; /* Police en gras */
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}


button {
    padding: 12px 25px; /* Bouton légèrement plus grand */
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px; /* Coins plus arrondis */
    margin-bottom: 30px; /* Plus d'espace en dessous */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Ombre légère */
}

button:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

#result {
    margin-top: 20px;
    padding: 20px; /* Plus de padding interne */
    background-color: white;
    border-radius: 12px; /* Plus arrondi */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); /* Ombre plus prononcée */
    text-align: center;
    width: 90%;
    max-width: 400px; /* Largeur max pour le contenu */
    margin-bottom: 30px; /* Espace avant la légende */
    box-sizing: border-box;
}

#status {
    font-style: italic;
    color: #6c757d; /* Gris plus doux */
    margin-bottom: 15px; /* Espace même quand le reste est caché */
    min-height: 1.2em; /* Evite le saut quand le texte change */
}

#aqi-display {
    margin-top: 0; /* L'espacement est géré par #status */
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.5s, opacity 0.5s linear; /* Transition délai */
    max-height: 0; /* Aide à cacher complètement */
    overflow: hidden; /* Cache le contenu pendant la transition */
}

#aqi-display.visible {
    visibility: visible;
    opacity: 1;
    max-height: 500px; /* Assez grand pour le contenu */
    transition: visibility 0s linear, opacity 0.5s linear, max-height 0.5s ease-in-out;
}

/* Styles pour l'image remplaçant la boîte de couleur */
#aqi-image {
    display: block; /* Permet le margin auto */
    width: 120px; /* Taille de l'image */
    height: 120px;
    margin: 10px auto 15px auto; /* Centre l'image */
    object-fit: contain; /* S'assure que l'image entière est visible */
    border-radius: 50%; /* Image ronde ? Ou enlever pour garder carré/rect */
    background-color: #eee; /* Fond léger si l'image a de la transparence */
     border: 1px solid #eee;
}

/* Plus besoin des classes .aqi-* ici */

#aqi-value {
    font-size: 2em; /* Valeur AQI plus grande */
    font-weight: 700;
    margin-bottom: 5px;
    color: #212529; /* Noir presque complet */
}

#aqi-level {
    font-size: 1.3em;
    font-weight: 700; /* Niveau en gras aussi */
    margin-bottom: 10px;
    color: #495057; /* Gris foncé */
}

#location-info {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 15px;
}

/* Styles pour la légende */
#legend {
    margin-top: 20px; /* Remonte un peu */
    padding: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 90%;
    max-width: 500px; /* Légende un peu plus large */
    text-align: left;
    border: 1px solid #e9ecef;
}

#legend h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: #343a40;
    font-weight: 700;
}

#legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#legend li {
    margin-bottom: 12px; /* Plus d'espace entre items */
    display: flex;
    align-items: flex-start; /* Alignement haut si texte sur plusieurs lignes */
    font-size: 0.95em;
    line-height: 1.5; /* Meilleure lisibilité */
    color: #495057;
}

/* Pastille de couleur dans la légende */
.legend-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px; /* Carré arrondi */
    margin-right: 12px; /* Espace avant le texte */
    flex-shrink: 0; /* Empêche la pastille de rétrécir */
    margin-top: 1px; /* Petit ajustement vertical */
}

/* Classes de couleur pour les pastilles (réutilisent les définitions) */
.aqi-good { background-color: #009966; }
.aqi-moderate { background-color: #ffde33; }
.aqi-unhealthy-sensitive { background-color: #ff9933; }
.aqi-unhealthy { background-color: #cc0033; }
.aqi-very-unhealthy { background-color: #660099; }
.aqi-hazardous { background-color: #7e0023; }
.aqi-nodata { background-color: #cccccc; }


footer {
    margin-top: auto; /* Pousse le footer en bas */
    padding-top: 30px;
    padding-bottom: 15px;
    font-size: 0.85em;
    color: #6c757d;
    text-align: center;
    width: 100%;
}

footer a {
    color: #0056b3;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}
