/* --- Style Général --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
}

/* --- Header --- */
header {
    background-color: #007bff;
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* --- Contenu Principal & Formulaire --- */
main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

form, section {
    background: white;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

h2 {
    margin-top: 0;
    color: #007bff;
    border-bottom: 2px solid #f4f4f9;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

input[type="text"], input[type="file"] {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Important pour que le padding n'ajoute pas de largeur */
    font-size: 1rem;
}

button {
    width: 100%;
    padding: 0.9rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

/* --- Affichage des Données Sauvegardées --- */
#items-container {
    display: grid;
    /* Crée une grille responsive qui ajuste le nombre de colonnes */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.item {
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden; /* Pour que l'image ne dépasse pas les coins arrondis */
    text-align: center;
}

.item img {
    width: 100%;
    height: 120px;
    object-fit: cover; /* Assure que l'image couvre l'espace sans se déformer */
    display: block;
}

.item p {
    margin: 0;
    padding: 0.8rem;
    background-color: #fafafa;
    font-weight: 500;
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sync-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#sync-button {
    cursor: pointer;
    border: none;
    float: right;
}