/* HouseHub — Courses (liste de courses) */
.groceries-layout {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

.groceries-hero {
  padding: 1.25rem 0 1rem;
}
.groceries-hero h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text-main);
}
.groceries-hero p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Encart ajout — plus visible, aligné sur les cartes HouseHub */
.groceries-add-card {
  margin-bottom: 1.35rem;
  border-radius: 14px;
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.groceries-add-card-inner {
  padding: 1.15rem 1.25rem 1.25rem;
}

.groceries-quick-add {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}
.groceries-quick-add .groceries-add-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 1.05rem;
  border-radius: 10px;
  line-height: 1.35;
}
.groceries-add-submit {
  flex-shrink: 0;
  padding: 14px 22px !important;
  font-size: 1rem !important;
  border-radius: 10px !important;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .groceries-quick-add {
    flex-direction: column;
  }
  .groceries-add-submit {
    width: 100%;
    justify-content: center;
  }
}

/* Actions secondaires — même famille que pf-btn du reste du site */
.groceries-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.15rem;
}
.groceries-toolbar-btn {
  padding: 10px 18px !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
}
.groceries-toolbar-btn--danger {
  color: var(--danger) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  background: var(--bg-panel) !important;
}
.groceries-toolbar-btn--danger:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: var(--danger) !important;
}
.groceries-toolbar-btn--outline {
  border: 1px dashed var(--border-strong) !important;
  background: transparent !important;
  color: var(--text-muted) !important;
}
.groceries-toolbar-btn--outline:hover {
  background: var(--bg-page) !important;
  color: var(--text-main) !important;
  border-color: var(--text-muted) !important;
}

.groceries-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
}
.groceries-section-title:first-of-type {
  margin-top: 0;
}

.groceries-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.groceries-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.groceries-row:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.groceries-row.in-cart {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08) 0%, var(--bg-panel) 48%);
  border-color: rgba(34, 197, 94, 0.28);
}
.groceries-row.in-cart:hover {
  border-color: rgba(34, 197, 94, 0.45);
}
.groceries-row.in-cart .groceries-label {
  text-decoration: line-through;
  color: var(--text-muted);
}

.groceries-check {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  border: 2px solid var(--border-light);
  background: var(--bg-page);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.groceries-check:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}
.groceries-check:active {
  transform: scale(0.96);
}
/* Produit validé / dans le caddie — vert franc */
.groceries-check.checked {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
  border-color: #15803d;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28), 0 2px 6px rgba(22, 163, 74, 0.35);
}
.groceries-check.checked:hover {
  background: linear-gradient(145deg, #4ade80 0%, #22c55e 100%);
  border-color: #166534;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 0 3px 10px rgba(22, 163, 74, 0.4);
}
.groceries-check.checked::after {
  content: '✓';
}

.groceries-label {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.35;
  word-break: break-word;
}

.groceries-row-actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
  align-items: center;
}

.groceries-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.groceries-empty .groceries-empty-icon {
  font-size: 2.75rem;
  opacity: 0.35;
  margin-bottom: 0.75rem;
}

.groceries-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.groceries-toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  min-width: 200px;
  color: var(--text-main);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-left: 4px solid var(--primary);
}
.groceries-toast.error {
  border-left-color: var(--danger);
}

[data-theme='dark'] .groceries-add-card {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}
[data-theme='dark'] .groceries-row {
  background: var(--bg-panel);
  border-color: var(--border-light);
}
[data-theme='dark'] .groceries-row:hover {
  border-color: #484f58;
}
[data-theme='dark'] .groceries-row.in-cart {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.12) 0%, var(--bg-panel) 50%);
  border-color: rgba(34, 197, 94, 0.35);
}
[data-theme='dark'] .groceries-check {
  border-color: #484f58;
  background: var(--bg-page);
}
[data-theme='dark'] .groceries-check:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--primary);
}
[data-theme='dark'] .groceries-check.checked {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22), 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Historique produits */
.groceries-history-card {
  margin-top: 1.75rem;
  padding: 1.15rem 1.2rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}
.groceries-history-h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text-main);
}
.groceries-history-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
  line-height: 1.45;
}
.groceries-history-settings-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.groceries-history-settings-link:hover {
  text-decoration: underline;
}
.groceries-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.groceries-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem 0.45rem 0.55rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  text-align: left;
  max-width: 100%;
}
.groceries-history-chip:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.12);
}
.groceries-history-chip-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-on-primary, #fff);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.groceries-history-empty {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

[data-theme='dark'] .groceries-history-card {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}
[data-theme='dark'] .groceries-history-chip {
  background: var(--bg-page);
  border-color: var(--border-light);
}
[data-theme='dark'] .groceries-history-chip:hover {
  background: rgba(59, 130, 246, 0.1);
}
