/* ─── Ducornet – Liste de courses v8.2.0 ─── */
#dc-app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  min-height: 70vh;
  background: #f7f7f5;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

/* Écrans */
.dc-screen { display: none; flex-direction: column; min-height: 70vh; }
.dc-screen.dc-active { display: flex; }

/* Contexte "app" plein écran (coquille ducornet-app-shell, classe body.daap-body) :
   #dc-app doit remplir tout l'écran avec une hauteur FIXE (pas juste min-height),
   sinon .dc-body (flex:1 + overflow-y:auto) n'a rien à quoi se limiter et ne défile
   jamais — la coquille bloque en plus le scroll de la page entière (overflow:hidden),
   donc le contenu excédentaire devient totalement inaccessible. Sans effet en dehors
   de l'app (page WordPress normale), où #dc-app reste la carte min-height:70vh. */
body.daap-body #dc-app {
  height: 100dvh;
  max-width: 100%;
  border-radius: 0;
  box-shadow: none;
}
body.daap-body .dc-screen {
  height: 100%;
  min-height: 0;
}

/* Topbar */
.dc-topbar {
  background: #1a7a4a;
  color: #fff;
  padding: 14px 16px;
  /* Réserve la zone d'encoche/barre de statut (mode app fullscreen, viewport-fit=cover) :
     0px sur navigateur classique, hauteur réelle de la safe-area dans l'app/PWA */
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.dc-topbar-icon { font-size: 22px; }
.dc-topbar-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  color: #fff;
}
.dc-back {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.dc-stats {
  font-size: 13px;
  opacity: 0.85;
  white-space: nowrap;
}

/* Corps scrollable */
.dc-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* Bouton flottant */
.dc-fab-wrap {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.dc-fab {
  pointer-events: all;
  background: #1a7a4a;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26,122,74,0.4);
}
.dc-fab:hover { background: #155f39; }

/* ── Cartes de liste ── */
.dc-list-card {
  background: #fff;
  border-radius: 10px;
  margin: 8px 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  border: 1px solid #e8e8e6;
}
.dc-list-card:hover { background: #f0f7f3; }
.dc-list-title {
  font-size: 16px; font-weight: 600; color: #1a1a1a;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dc-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dc-list-icon {
  width: 32px; height: 32px;
  background: #e8f5ef;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.dc-list-meta {
  font-size: 13px; color: #888; margin: 0;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dc-list-badge {
  background: #e8f5ef; color: #1a7a4a;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; flex-shrink: 0;
}
.dc-list-del {
  background: none; border: none;
  color: #ccc; font-size: 18px; cursor: pointer;
  padding: 4px; flex-shrink: 0;
}
.dc-list-del:hover { color: #e24b4a; }

/* Bouton nouvelle liste */
.dc-new-list-line {
  margin: 0 12px 10px;
  border: 1.5px dashed #ccc;
  border-radius: 10px;
  padding: 13px;
  text-align: center;
  color: #999;
  cursor: pointer;
  background: none;
  width: calc(100% - 24px);
  font-size: 14px;
}
.dc-new-list-line:hover { border-color: #1a7a4a; color: #1a7a4a; background: #f0f7f3; }

/* ── Lignes produits ── */
.dc-section-header {
  padding: 12px 16px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dc-item-row {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid #f0f0ee;
  gap: 10px;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.dc-item-row.dc-done { opacity: 0.5; }
.dc-item-row.dc-done .dc-item-name { text-decoration: line-through; color: #aaa; }
.dc-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.dc-check.dc-checked { background: #1a7a4a; border-color: #1a7a4a; }
.dc-check.dc-checked::after { content: '✓'; color: #fff; font-size: 14px; }
/* dc-item-emoji supprimé v8 */
.dc-item-name { font-size: 14px; color: #1a1a1a; flex: 1; }
.dc-item-qty {
  font-size: 12px; color: #888;
  background: #f0f0ee;
  padding: 2px 8px; border-radius: 12px; flex-shrink: 0;
}
.dc-item-del {
  background: none; border: none;
  color: #ddd; font-size: 17px;
  cursor: pointer; padding: 4px; flex-shrink: 0;
}
.dc-item-del:hover { color: #e24b4a; }

/* ── Écran ajout ── */
.dc-search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid #e8e8e6;
  background: #fff;
}
.dc-search-wrap input {
  width: 100%;
  padding: 9px 14px;
  font-size: 15px;
  border: 1.5px solid #e0e0de;
  border-radius: 8px;
  background: #f7f7f5;
  color: #1a1a1a;
  outline: none;
  box-sizing: border-box;
}
.dc-search-wrap input:focus { border-color: #1a7a4a; background: #fff; }

.dc-qty-card {
  background: #fff;
  margin: 10px 12px;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e8e8e6;
}
.dc-qty-name { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: #1a1a1a; }
.dc-qty-row { display: flex; align-items: center; gap: 10px; }
.dc-qty-btn {
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1.5px solid #e0e0de;
  background: #f7f7f5;
  font-size: 20px; font-weight: 600;
  cursor: pointer; color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
}
.dc-qty-val { width: 36px; text-align: center; font-size: 20px; font-weight: 600; }
.dc-qty-confirm {
  flex: 1;
  background: #1a7a4a; color: #fff;
  border: none; border-radius: 8px;
  padding: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.dc-qty-confirm:hover { background: #155f39; }

.dc-results-info {
  padding: 7px 16px;
  font-size: 12px; color: #999;
  background: #f7f7f5;
  border-bottom: 1px solid #e8e8e6;
}

/* Ligne de suggestion produit */
.dc-prod-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0ee;
  cursor: pointer;
  gap: 10px;
  background: #fff;
}
.dc-prod-row:hover { background: #f0f7f3; }
.dc-prod-dot {
  width: 9px; height: 9px;
  border-radius: 50%; flex-shrink: 0;
}
.dc-prod-name { font-size: 15px; color: #1a1a1a; flex: 1; }
.dc-prod-freq { font-size: 12px; color: #bbb; flex-shrink: 0; }
.dc-prod-new { color: #1a7a4a; font-size: 15px; flex: 1; }

/* États généraux */
.dc-loading, .dc-empty {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
  font-size: 15px;
}
.dc-error { color: #e24b4a; }

/* Modale confirmation */
.dc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.dc-modal-overlay.dc-show { display: flex; }
.dc-modal {
  background: #fff;
  border-radius: 14px;
  padding: 24px 20px 20px;
  max-width: 300px;
  width: 90%;
  text-align: center;
}
.dc-modal h3 { margin: 0 0 8px; font-size: 17px; }
.dc-modal p { margin: 0 0 18px; color: #666; font-size: 14px; }
.dc-modal-btns { display: flex; gap: 10px; }
.dc-modal-btns button {
  flex: 1; padding: 10px;
  border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.dc-modal-cancel { background: #f0f0ee; color: #1a1a1a; }
.dc-modal-ok { background: #e24b4a; color: #fff; }

/* ─── v2 – Nouveaux styles ─── */

/* Bouton créer toujours visible (séparé visuellement) */
.dc-prod-create-row {
  background: #f0f7f3;
  border-bottom: 2px solid #e0ede7;
}
.dc-prod-create-row:hover { background: #e2f0ea; }

/* En-tête catégorie dans la liste (écran 2) */
.dc-cat-header {
  background: #f7f7f5;
  border-top: 1px solid #e8e8e6;
  color: #333;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 16px 4px;
}
.dc-done-header {
  color: #aaa;
  border-top: 2px solid #e8e8e6;
  margin-top: 6px;
}

/* Modale création de liste */
.dc-modal-name .dc-name-input,
.dc-modal-create .dc-name-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e0e0de;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  color: #1a1a1a;
}
.dc-modal-name .dc-name-input:focus,
.dc-modal-create .dc-name-input:focus {
  border-color: #1a7a4a;
}

/* Modale création produit */
.dc-modal-create {
  text-align: left;
}
.dc-modal-create h3 {
  text-align: center;
}
.dc-create-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.dc-cat-select {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e0e0de;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 18px;
  outline: none;
  background: #f7f7f5;
  color: #1a1a1a;
  appearance: auto;
}
.dc-cat-select:focus { border-color: #1a7a4a; }

/* Bouton confirmer (vert) dans les modales */
.dc-modal-confirm {
  background: #1a7a4a !important;
  color: #fff !important;
}
.dc-modal-confirm:hover { background: #155f39 !important; }

/* ─── v2 – Styles hérités ─── */

.dc-prod-create-row {
  background: #f0f7f3;
  border-top: 2px solid #e0ede7;   /* en bas = bordure au-dessus */
}
.dc-prod-create-row:hover { background: #e2f0ea; }

.dc-cat-header {
  background: #f7f7f5;
  border-top: 1px solid #e8e8e6;
  color: #333;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 16px 4px;
}
.dc-done-header {
  color: #aaa;
  border-top: 2px solid #e8e8e6;
  margin-top: 6px;
}

.dc-modal-name .dc-name-input,
.dc-modal-create .dc-name-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e0e0de;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  color: #1a1a1a;
}
.dc-modal-name .dc-name-input:focus,
.dc-modal-create .dc-name-input:focus { border-color: #1a7a4a; }

.dc-modal-create { text-align: left; }
.dc-modal-create h3 { text-align: center; }
.dc-create-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.dc-cat-select {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e0e0de;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  margin-bottom: 18px;
  outline: none;
  background: #f7f7f5;
  color: #1a1a1a;
  appearance: auto;
}
.dc-cat-select:focus { border-color: #1a7a4a; }

.dc-modal-confirm {
  background: #1a7a4a !important;
  color: #fff !important;
}
.dc-modal-confirm:hover { background: #155f39 !important; }

/* ─── v3 – Gestion catalogue ─── */

/* Bouton discret "Gérer le catalogue" en bas de liste */
.dc-catalogue-btn-wrap {
  padding: 20px 16px 12px;
  text-align: center;
  border-top: 1px solid #f0f0ee;
  margin-top: 4px;
}
.dc-catalogue-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px;
  color: #bbb;
  cursor: pointer;
}
.dc-catalogue-btn:hover { border-color: #999; color: #777; }

/* Barre mode catalogue */
.dc-catalogue-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff3cd;
  border-bottom: 2px solid #f0c040;
  padding: 10px 16px;
}
.dc-catalogue-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #856404;
}
.dc-catalogue-exit-btn {
  background: #1a7a4a;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.dc-catalogue-exit-btn:hover { background: #155f39; }

/* Ligne produit en mode édition (avec bouton supprimer) */
.dc-prod-row-edit { background: #fffef8; }
.dc-prod-del-btn {
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  color: #ddd;
  padding: 4px 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.dc-prod-del-btn:hover { color: #e24b4a; }

/* Modale confirmation catalogue asymétrique */
.dc-modal-catalogue h3 { margin-bottom: 8px; font-size: 17px; }
.dc-modal-catalogue p  { color: #888; font-size: 14px; margin-bottom: 20px; }
.dc-catalogue-confirm-btns {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
/* NON — gros, rouge, très visible */
.dc-catalogue-non {
  flex: 1;
  background: #e24b4a;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.dc-catalogue-non:hover { background: #c0392b; }
/* oui — petit, discret, grisé */
.dc-catalogue-oui {
  background: none;
  border: none;
  color: #bbb;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
}
.dc-catalogue-oui:hover { color: #888; }

/* ── Bouton Créer liste (haut, écran 1) ── */
.dc-lists-new-wrap {
  padding: 10px 12px 2px;
}
.dc-lists-new-btn {
  width: 100%;
  background: #1a7a4a;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.dc-lists-new-btn:hover { background: #155f39; }

/* ── Bouton Ajouter produit (haut, écran 2) ── */
.dc-add-top-wrap {
  padding: 10px 12px 4px;
}
.dc-add-top-btn {
  width: 100%;
  background: #1a7a4a;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.dc-add-top-btn:hover { background: #155f39; }

/* ── Catégorie vide dans catalogue ── */
.dc-cat-empty {
  font-size: 11px;
  color: #bbb;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Bouton changement catégorie dans catalogue ── */
.dc-prod-edit-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
  opacity: 0.7;
}
.dc-prod-edit-btn:hover { opacity: 1; }
