/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

:root {
    --primaire: #007bff;
    --secondaire: #6c757d;
    --succes: #28a745;
    --fond: #f8f9fa;
    --bordure: #dee2e6;
    --texte: #212529;
    --alerte: #dc3545;
    --info: #17a2b8;

    /* v2.8 : couleurs de "zone" - chaque onglet principal (et la nav
       magasins qui l'accompagne) garde toujours la même couleur, pour
       qu'elle s'associe psychologiquement à sa fonction avec l'usage. */
    --zone-ajouter: var(--primaire);
    --zone-liste: var(--info);
    --zone-historique: #6f42c1;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--fond);
    color: var(--texte);
    margin: 0;
    padding: 10px; /* Réduit */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 15px 20px; /* Réduit */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* --- COMPACTION DES TITRES --- */
h1, h2, h3 {
    color: var(--primaire);
    border-bottom: 1px solid var(--bordure); /* Ligne plus fine */
    padding-bottom: 8px; /* Réduit */
    margin-bottom: 15px; /* Réduit */
}
h1 {
    text-align: center;
    font-size: 1.8em; /* Réduit */
    margin-top: 0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
h2 {
    font-size: 1.3em; /* Réduit */
}
h3 {
    font-size: 1.1em; /* Réduit */
    border-bottom: none;
    margin-bottom: 10px;
}
/* ----------------------------- */


/* Formulaire (section-ajout) */
#section-ajout {
    margin-bottom: 20px;
}
#form-ajout-article {
    padding: 15px; /* Réduit */
    border: 1px solid var(--bordure);
    border-top: 3px solid var(--zone-ajouter); /* v2.9 : cohérence avec l'onglet actif */
    border-radius: 4px;
}
.form-group {
    margin-bottom: 10px; /* Réduit */
}
.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-weight: 700;
    font-size: 0.9em; /* Réduit */
}
.form-group input, 
.form-group select {
    width: 100%;
    padding: 8px; /* Réduit */
    border: 1px solid var(--bordure);
    border-radius: 4px;
    box-sizing: border-box; 
}
#form-ajout-article button[type="submit"],
#btn-tout-acheter {
    padding: 10px 15px;
    font-size: 1em;
    margin-top: 5px; /* Réduit */
}

.btn-discret {
    background: none;
    border: none;
    color: var(--primaire);
    font-size: 1.5em;
    font-weight: 700;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
.btn-discret:hover {
    background-color: var(--fond);
    border-radius: 50%;
}


/* Bloc "Tous" (Ma liste) */
/* v2.9 : mêmes lignes (case à cocher, ⭐) que la liste d'un magasin précis -
   voir #liste-articles li ci-dessous, dont ce sélecteur reprend la mise en
   page. Seul le nom du magasin, ajouté en fin de ligne, est spécifique. */
#liste-tous-articles { list-style: none; padding: 0; margin: 0; }
#liste-tous-articles li:not(.header-categorie) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid var(--bordure);
}
#liste-tous-articles li:last-child { border-bottom: none; }
.tag-magasin-tous {
    color: var(--secondaire);
    font-style: italic;
    font-weight: 400;
    font-size: 0.85em;
    margin-left: 6px;
}


/* --- NAVIGATION COMPACTÉE --- */
.nav-views {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px; /* Réduit */
    border-bottom: 1px solid var(--bordure); /* Ligne plus fine */
    padding-bottom: 8px; /* Réduit */
}
.nav-views button {
    background: none;
    border: none;
    padding: 8px 12px; /* Réduit */
    font-size: 0.95em; /* Réduit */
    font-weight: 700;
    color: var(--secondaire);
    cursor: pointer;
    border-bottom: 2px solid transparent; /* Ligne plus fine */
    line-height: 1.2;
}
.nav-views button.active {
    color: var(--primaire);
    border-bottom: 2px solid var(--primaire);
}
/* v2.8 : chaque onglet garde la couleur de sa zone une fois actif.
   v2.9 : un fond légèrement teinté (en plus du texte/soulignement) rend la
   distinction bien plus visible qu'un simple changement de couleur de
   texte - couleur-mix() calcule automatiquement le fond à partir de la
   couleur de zone, y compris quand elle est personnalisée dans le menu. */
.nav-views button.active.onglet-ajouter {
    color: var(--zone-ajouter);
    border-bottom: 3px solid var(--zone-ajouter);
    background-color: color-mix(in srgb, var(--zone-ajouter) 12%, white);
    border-radius: 6px 6px 0 0;
}
.nav-views button.active.onglet-liste {
    color: var(--zone-liste);
    border-bottom: 3px solid var(--zone-liste);
    background-color: color-mix(in srgb, var(--zone-liste) 12%, white);
    border-radius: 6px 6px 0 0;
}
.nav-views button.active.onglet-historique {
    color: var(--zone-historique);
    border-bottom: 3px solid var(--zone-historique);
    background-color: color-mix(in srgb, var(--zone-historique) 12%, white);
    border-radius: 6px 6px 0 0;
}


#nav-magasins {
    display: flex;
    flex-wrap: wrap;
    gap: 6px; /* Réduit */
    margin-bottom: 15px; /* Réduit */
    border: 1px solid var(--bordure); /* Ajout bordure pour encadrer */
    border-top: none; /* Le fait l'en-tête */
    padding: 8px; /* Réduit */
    border-radius: 0 0 4px 4px;
}
/* v2.9 : la nav magasins partagée hérite d'un fond et d'une bordure teintés
   de la couleur de la zone qui l'affiche, en plus de ses boutons actifs. */
#nav-magasins.zone-liste {
    background-color: color-mix(in srgb, var(--zone-liste) 6%, white);
    border-color: var(--zone-liste);
}
#nav-magasins.zone-historique {
    background-color: color-mix(in srgb, var(--zone-historique) 6%, white);
    border-color: var(--zone-historique);
}

#nav-magasins button {
    background: none;
    border: none;
    padding: 6px 10px; /* Réduit */
    font-size: 0.85em; /* Réduit */
    font-weight: 700;
    color: var(--secondaire);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    flex-grow: 1; 
    min-width: fit-content; 
    line-height: 1.3;
}
#nav-magasins button:hover { color: var(--primaire); }
#nav-magasins button.active {
    color: var(--primaire);
    border-bottom: 2px solid var(--primaire);
}
.magasin-a-acheter {
    color: var(--alerte) !important;
    font-weight: 900 !important;
}
#nav-magasins button.active.magasin-a-acheter {
    color: var(--primaire) !important;
}
/* v2.8 : la nav magasins partagée prend la couleur de l'onglet Ma liste ou
   Historique selon lequel l'affiche (voir basculerOnglet() dans app.js) */
#nav-magasins.zone-liste button.active {
    color: var(--zone-liste);
    border-bottom-color: var(--zone-liste);
}
#nav-magasins.zone-liste button.active.magasin-a-acheter {
    color: var(--zone-liste) !important;
}
#nav-magasins.zone-historique button.active {
    color: var(--zone-historique);
    border-bottom-color: var(--zone-historique);
}
#nav-magasins.zone-historique button.active.magasin-a-acheter {
    color: var(--zone-historique) !important;
}
/* --- FIN NAVIGATION COMPACTÉE --- */


/* Liste de courses (compactée) */
#liste-articles { list-style: none; padding: 0; margin: 0; }

.header-categorie {
    background-color: var(--fond);
    color: var(--zone-liste);
    font-weight: 700;
    padding: 8px 10px; /* Réduit */
    margin-top: 10px; /* Réduit */
    border-bottom: 2px solid var(--zone-liste);
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    font-size: 0.9em; /* Réduit */
}
.header-categorie:first-child { margin-top: 0; }

#liste-articles li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px; /* Réduit */
    border-bottom: 1px solid var(--bordure);
}
#liste-articles li:last-child { border-bottom: none; }
.info-article {
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    margin-right: 10px;
}
.nom-article {
    font-size: 1.05em; /* Réduit */
    font-weight: 700;
    word-break: break-word; 
}
.date-ajout {
    font-size: 0.8em;
    color: var(--secondaire);
    margin-top: 2px; /* Réduit */
}
.header-liste {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
    gap: 10px;
    margin-bottom: 10px; /* Réduit */
}
#titre-liste {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    color: var(--zone-liste);
}
#btn-tout-acheter {
    background-color: var(--succes);
    width: auto; 
    white-space: nowrap;
    padding: 8px 12px; /* Réduit */
    font-size: 0.9em; /* Réduit */
}

/* Actions article (compactées) */
.actions-article { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-pas-en-stock {
    background-color: var(--info);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 6px; /* Réduit */
    font-size: 0.75em; /* Réduit */
    font-weight: 700;
    cursor: pointer;
}
.btn-pas-en-stock:hover { background-color: #117a8b; }

/* Checkbox (compactée) */
.checkbox-container { display: flex; align-items: center; cursor: pointer; user-select: none; flex-shrink: 0; }
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark {
    height: 24px; /* Réduit */
    width: 24px; /* Réduit */
    background-color: var(--fond);
    border: 2px solid var(--primaire);
    border-radius: 4px;
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.checkbox-container input:checked ~ .checkmark { background-color: var(--succes); border-color: var(--succes); }
.checkmark:after { content: "✓"; color: white; font-size: 16px; display: none; line-height: 1; } /* Réduit */
.checkbox-container input:checked ~ .checkmark:after { display: block; }


/* Historique (compacté) */
#section-historique h2 {
    color: var(--zone-historique);
    border-bottom-color: var(--zone-historique);
}
#liste-historique { list-style: none; padding: 0; }
#liste-historique li {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--bordure);
    background-color: var(--fond);
    opacity: 0.9;
    font-style: italic;
    gap: 10px;
}
.historique-info { flex-grow: 1; }
.historique-nom-article { font-style: normal; font-size: 0.95em; } /* Réduit */
.historique-details {
    font-size: 0.8em; /* Réduit */
    color: var(--texte);
    text-align: left;
    margin-left: 0;
    margin-top: 4px; /* Réduit */
    font-style: normal;
    width: 100%;
}
.historique-details span { color: var(--secondaire); margin-left: 8px; }
/* v2.9.4 : ce bouton renvoie l'article vers l'onglet Ajouter (et non plus
   vers Historique/suppression comme son ancien libellé "+ Liste" pouvait
   le laisser penser) - il reprend donc la couleur de zone "Ajouter",
   personnalisable par l'utilisateur (Menu > Personnalisation), au lieu du
   rouge d'alerte utilisé jusqu'ici. */
.btn-annuler-achat {
    background-color: var(--zone-ajouter);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.8em;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-annuler-achat:hover { background-color: color-mix(in srgb, var(--zone-ajouter) 80%, black); }


/* Modal (compacté) */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); display: flex;
    align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: white; padding: 20px 25px; /* Réduit */
    border-radius: 8px; width: 90%; max-width: 500px; position: relative;
}
.modal-content p { font-size: 0.9em; color: var(--secondaire); margin-top: -10px; margin-bottom: 15px; }
.modal-content .form-group { margin-bottom: 10px; }
.modal-content button[type="submit"] {
    padding: 10px; /* Réduit */
    font-size: 1em; /* Réduit */
}
.btn-close {
    position: absolute; top: 8px; right: 12px; /* Ajusté */
    font-size: 1.8em; /* Réduit */
}


/* ======================================= */
/* MEDIA QUERY (COMPACTION MAXIMALE)     */
/* ======================================= */
@media (max-width: 600px) {
    body {
        padding: 5px; /* Réduit */
    }
    .container {
        padding: 10px; /* Réduit */
    }

    h1 {
        font-size: 1.5em; /* Réduit */
        padding-bottom: 8px; /* Réduit */
        margin-bottom: 10px; /* Réduit */
    }
    h2 {
        font-size: 1.2em; /* Réduit */
        padding-bottom: 5px; /* Réduit */
        margin-bottom: 10px; /* Réduit */
    }
    
    /* Navigations super-compactes */
    .nav-views {
        margin-bottom: 10px; /* Réduit */
        padding-bottom: 5px; /* Réduit */
        gap: 5px;
    }
    .nav-views button {
        padding: 8px 10px; /* Réduit */
        font-size: 0.9em; /* Réduit */
    }
    
    /* Nav magasins compactée */
    #nav-magasins {
        gap: 4px; /* Réduit */
        margin-bottom: 10px; /* Réduit */
        padding: 6px; /* Réduit */
    }
    #nav-magasins button {
        padding: 5px 6px; /* Réduit */
        font-size: 0.8em; /* Réduit */
        line-height: 1.2;
    }

    /* En-tête de liste */
    .header-liste {
        flex-direction: column;
        align-items: stretch;
    }
    #titre-liste {
        text-align: center;
        margin-bottom: 10px;
    }
    #btn-tout-acheter {
        width: 100%;
        padding: 10px; /* Augmenté pour être une cible tactile facile */
        font-size: 1em;
    }

    /* Historique : bouton annuler en pleine largeur */
    #liste-historique li {
        flex-wrap: wrap; 
    }
    .historique-info {
        flex-basis: 100%;
        margin-bottom: 10px;
    }
    .btn-annuler-achat {
        flex-basis: 100%;
        text-align: center;
    }
}

/* Bouton de gestion */
#btn-gerer-magasins {
    background: none;
    border: 1px solid var(--info);
    color: var(--info);
    padding: 5px 10px;
    font-size: 0.8em;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
}

/* Modale de gestion */
.liste-gestion {
    list-style: none;
    padding: 0 6px 0 0; /* espace pour ne pas coller les icônes à la scrollbar */
    margin: 0 0 15px 0;
    max-height: 250px;
    overflow-y: auto;
}
.liste-gestion li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bordure);
}
.liste-gestion li:last-child {
    border-bottom: none;
}
.magasin-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    margin-left: 8px;
    padding: 0;
}
.btn-edit { color: var(--info); }
.btn-delete { color: var(--alerte); }

/* Favicons (Logos) */
.magasin-favicon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 6px;
    object-fit: contain;
}

/* --- Boutons de sélection de magasin (Formulaire ajout) --- */
.magasins-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

/* v2.3 : "Général" sur sa propre ligne, magasins précis juste en dessous */
#selector-magasins-ajout {
    flex-direction: column;
    gap: 8px;
}
.ligne-selecteur-generaux,
.ligne-selecteur-magasins {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sous-label-selecteur {
    font-size: 0.75em;
    color: var(--secondaire);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 10px 0 4px 0;
}
.sous-label-selecteur:first-child {
    margin-top: 0;
}

.btn-magasin-select {
    background-color: var(--fond);
    border: 1px solid var(--bordure);
    color: var(--texte);
    padding: 8px 15px;
    border-radius: 20px; /* Effet pilule */
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-magasin-select:hover {
    border-color: var(--primaire);
}

.btn-magasin-select.active {
    background-color: var(--primaire);
    color: white;
    border-color: var(--primaire);
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
}

/* On force le logo à s'afficher correctement sur fond bleu quand actif */
.btn-magasin-select.active .magasin-favicon {
    background-color: white;
}

/* Style pour le bouton Aide */
.btn-aide {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--fond);
    color: var(--primaire);
    border: 1px solid var(--primaire);
    border-radius: 50%;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-aide:hover {
    background-color: var(--primaire);
    color: white;
    transform: scale(1.1);
}
/* =======================================================================
   AJOUTS v2.0
   ======================================================================= */

/* --- Badge prénom (header) --- */
.btn-prenom-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primaire);
    color: white;
    border: none;
    font-weight: 700;
    font-size: 0.9em;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Options avancées du formulaire d'ajout (quantité / note / urgent) --- */
.options-toggle {
    background: none;
    border: none;
    color: var(--primaire);
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0 10px 0;
    text-align: left;
    display: block;
}
.options-avancees {
    border-left: 3px solid var(--fond);
    padding-left: 10px;
    margin-bottom: 10px;
}

/* --- Favoris ("ajout rapide") --- */
#favoris-strip-wrapper {
    margin-bottom: 15px;
}
.label-favoris {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--secondaire);
    font-size: 0.9em;
}
.btn-favori-pill {
    border-style: dashed;
}
.btn-favori {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 2px 4px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.6;
}
.btn-favori:hover {
    opacity: 1;
}

/* --- Badges article : attribution, urgence, quantité, note --- */
.badge-initiale {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--secondaire);
    color: white;
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
}
.badge-urgent {
    font-size: 0.9em;
}
.quantite-article {
    color: var(--secondaire);
    font-weight: 400;
    font-size: 0.9em;
}
.note-article {
    font-size: 0.85em;
    color: var(--secondaire);
    font-style: italic;
    margin-top: 2px;
}

/* --- Fallback favicon magasin --- */
.magasin-favicon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 12px;
    vertical-align: middle;
    margin-right: 6px;
}

/* --- Toasts (remplace la majorité des alert()) --- */
#toast-container {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}
.toast {
    background-color: var(--texte);
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast.visible {
    opacity: 1;
    transform: translateY(0);
}
.toast-success { background-color: var(--succes); }
.toast-error { background-color: var(--alerte); }
.toast-warning { background-color: #b8860b; }
.toast-info { background-color: var(--texte); }

/* --- Menu (modale consolidée) --- */
.menu-groupe {
    margin-bottom: 18px;
}
.menu-groupe:last-child {
    margin-bottom: 0;
}
.menu-groupe-titre {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondaire);
    margin: 0 0 8px 0;
    font-weight: 700;
}
.menu-groupe-note {
    font-size: 0.8em;
    color: var(--secondaire);
    margin: 0 0 10px 0;
}
.reglages-couleurs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ligne-couleur {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.9em;
    color: var(--texte);
    cursor: pointer;
}
.ligne-couleur input[type="color"] {
    width: 44px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--bordure);
    border-radius: 6px;
    cursor: pointer;
    background: none;
}
.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.menu-actions button,
.menu-link {
    display: block;
    width: 100%;
    text-align: left;
    background-color: var(--fond);
    border: 1px solid var(--bordure);
    color: var(--texte);
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}
.menu-actions button:hover,
.menu-link:hover {
    border-color: var(--primaire);
    color: var(--primaire);
}
.menu-btn-danger {
    color: var(--alerte) !important;
    border-color: var(--alerte) !important;
}
.menu-btn-danger:hover {
    background-color: var(--alerte) !important;
    color: white !important;
}

/* --- Plan / quota --- */
.info-plan {
    background-color: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9em;
    margin-bottom: 5px;
    line-height: 1.5;
}
#btn-upgrade-plan {
    display: block;
    width: 100%;
    margin-top: 8px;
    background-color: var(--succes);
    padding: 8px;
    font-size: 0.9em;
}

/* =======================================================================
   AJOUTS v2.1
   ======================================================================= */

/* --- En-tête : bouton déconnexion visible + robustesse responsive --- */
.header-app {
    flex-wrap: wrap;
}
.header-app h1 {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}
.btn-menu {
    background-color: var(--fond);
    border: 1px solid var(--bordure);
    color: var(--secondaire);
    border-radius: 20px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 0.85em;
    cursor: pointer;
    white-space: nowrap;
}
.btn-menu:hover {
    border-color: var(--secondaire);
    background-color: #eceeef;
}

/* --- Priorité : sélecteur à côté du champ Article --- */
.ligne-article-priorite {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.ligne-article-priorite input[type="text"] {
    flex: 1 1 160px;
    width: auto;
}
.priorite-groupe {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.mini-label-priorite {
    font-size: 0.65em;
    color: var(--secondaire);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.priorite-selector {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.btn-priorite {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--bordure);
    background: #fff;
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.55;
    transition: all 0.15s ease;
}
.btn-priorite:hover {
    opacity: 0.85;
}
.btn-priorite.active {
    opacity: 1;
    transform: scale(1.1);
}
.btn-priorite-aujourd_hui.active { border-color: var(--alerte); background-color: #fdecea; }
.btn-priorite-demain.active { border-color: #e07b00; background-color: #fff2e0; }
.btn-priorite-avant_we.active { border-color: #b8860b; background-color: #fff9e0; }

.priorite-label {
    display: block;
    font-size: 0.8em;
    color: var(--secondaire);
    margin-top: 4px;
    min-height: 1.2em;
}

/* --- Alerte de doublon en direct (formulaire d'ajout) --- */
.alerte-doublon {
    margin: 6px 0 0 0;
    padding: 6px 10px;
    background-color: #fff9e0;
    border: 1px solid #b8860b;
    border-radius: 4px;
    color: #7a5c00;
    font-size: 0.85em;
    font-weight: 700;
}
.liste-alerte-doublon {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
    font-weight: 400;
    max-height: 140px;
    overflow-y: auto;
}
.liste-alerte-doublon li {
    padding: 2px 0;
}
.liste-alerte-doublon .reste-alerte-doublon {
    font-style: italic;
    opacity: 0.8;
}

.badge-priorite {
    font-size: 0.95em;
}

/* --- Tri de "Ma liste > Tous" --- */
.tri-apercu {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tri-apercu button {
    background: var(--fond);
    border: 1px solid var(--bordure);
    color: var(--secondaire);
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 0.8em;
    font-weight: 700;
    cursor: pointer;
}
.tri-apercu button.active {
    background-color: var(--zone-liste);
    color: white;
    border-color: var(--zone-liste);
}

/* --- Type de magasin (badge dans "Gérer les magasins") --- */
.badge-type-magasin {
    display: inline-block;
    font-size: 0.75em;
    color: var(--secondaire);
    background-color: var(--fond);
    border-radius: 10px;
    padding: 2px 8px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Édition complète d'un magasin (en ligne dans la liste de gestion) --- */
.li-edition-magasin {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
    background-color: var(--fond);
    border-radius: 6px;
    padding: 12px !important;
}
.form-edition-magasin .form-group {
    margin-bottom: 8px;
}
.form-edition-magasin input,
.form-edition-magasin select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--bordure);
    border-radius: 4px;
    box-sizing: border-box;
}
.edition-magasin-actions {
    display: flex;
    gap: 8px;
}
.edition-magasin-actions button {
    flex: 1;
    padding: 8px;
    font-size: 0.9em;
}
.edition-magasin-actions button[type="submit"] {
    background-color: var(--succes);
}
.btn-annuler-edition {
    background-color: var(--fond) !important;
    color: var(--secondaire) !important;
    border: 1px solid var(--bordure) !important;
}

/* --- "Tous" dans la nav magasins (historique) : distinction visuelle légère --- */
#nav-magasins button[data-id="tous"] {
    font-style: italic;
}

/* =======================================================================
   RESPONSIVE (point 11) - tablette et grand écran, en complément du
   @media (max-width: 600px) déjà présent plus haut.
   ======================================================================= */

/* Grand écran : un peu plus de largeur pour ne pas se sentir à l'étroit,
   sans devenir un mur de texte illisible. */
@media (min-width: 901px) {
    .container {
        max-width: 900px;
    }
    .admin-container { max-width: 900px; }
}

/* Tablette : ajustements intermédiaires */
@media (min-width: 601px) and (max-width: 900px) {
    .container {
        padding: 18px 24px;
    }
    .ligne-article-priorite input[type="text"] {
        flex: 1 1 220px;
    }
}

/* Mobile étroit : la sélection de priorité et le tri passent en pleine
   largeur pour rester faciles à toucher */
@media (max-width: 600px) {
    .header-app {
        gap: 8px;
    }
    .ligne-article-priorite input[type="text"] {
        flex: 1 1 130px;
    }
    .btn-priorite {
        width: 36px;
        height: 36px;
        font-size: 1.15em;
    }
    .tri-apercu {
        width: 100%;
    }
    .tri-apercu button {
        flex: 1;
        text-align: center;
    }
}

/* Cible tactile confortable sur tout écran tactile (téléphone/tablette),
   indépendamment de la largeur d'écran. */
@media (hover: none) and (pointer: coarse) {
    .btn-favori, .btn-pas-en-stock, .checkmark {
        min-width: 32px;
        min-height: 32px;
    }
}
