/* ── Menu module ────────────────────────────────────────────────────────── */

.menu-page {
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.menu-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.menu-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.menu-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Boutons ───────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--color-accent, #6c5ce7);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
  min-height: 44px;
  line-height: 1.4;
}

.btn-primary:hover { opacity: 0.88; }

.btn-primary-sm {
  background: var(--color-accent, #6c5ce7);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-size: 0.82rem;
  min-height: 36px;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text, #333);
  border: 1.5px solid var(--color-border, #ddd);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 0.88rem;
  text-decoration: none;
  display: inline-block;
  min-height: 44px;
  line-height: 1.6;
}

.btn-secondary:hover { background: var(--color-bg-hover, #f0f0f0); }

.btn-danger {
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  min-height: 44px;
}

.btn-danger-outline {
  color: #e74c3c;
  border: 1.5px solid #e74c3c;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  display: inline-block;
  font-size: 0.88rem;
  min-height: 44px;
  line-height: 2;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  min-height: 36px;
  min-width: 36px;
  text-decoration: none;
  color: inherit;
}

.btn-icon-danger {
  background: none;
  border: none;
  cursor: pointer;
  color: #e74c3c;
  font-size: 0.85rem;
  padding: 0.25rem 0.4rem;
  min-height: 36px;
  min-width: 36px;
}

.btn-qty {
  background: var(--color-bg-card, #f8f8f8);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.btn-validate {
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  min-height: 36px;
}

.btn-task {
  background: var(--color-accent, #6c5ce7);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  min-height: 36px;
}

.btn-nav {
  background: var(--color-bg-card, #f8f8f8);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  color: var(--color-text, #333);
  font-size: 0.88rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── Filtres ───────────────────────────────────────────────────────────── */

.menu-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-chip {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  border: 1.5px solid var(--chip-color, var(--color-border, #ddd));
  color: var(--chip-color, var(--color-text, #333));
  text-decoration: none;
  font-size: 0.85rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.filter-chip.active {
  background: var(--chip-color, var(--color-accent, #6c5ce7));
  color: #fff;
}

/* ── Grille de recettes ────────────────────────────────────────────────── */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.recipe-card {
  background: var(--color-bg-card, #fff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 10px;
  padding: 0.85rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: box-shadow 0.15s;
}

.recipe-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.recipe-cat-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  align-self: flex-start;
}

.recipe-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.recipe-meta, .recipe-note-count {
  font-size: 0.78rem;
  color: var(--color-text-muted, #888);
}

/* ── Détail recette ────────────────────────────────────────────────────── */

.recipe-meta-big {
  color: var(--color-text-muted, #888);
  margin: 0.25rem 0 0.75rem;
}

.notes-section {
  background: var(--color-bg-card, #fff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.notes-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.notes-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.note-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
}

.note-fixed { background: var(--color-bg-subtle, #f5f5f5); }
.note-temp { background: #fff9e6; border-left: 3px solid #f0c040; }

.note-content { font-size: 0.9rem; }
.note-linked { font-size: 0.78rem; color: var(--color-text-muted, #888); margin-top: 0.2rem; display: block; }

.note-input-row {
  display: flex;
  gap: 0.5rem;
}

.note-input-row input {
  flex: 1;
  font-size: 1rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
}

.note-add-form { margin-top: 0.5rem; }
.note-delete-form { flex-shrink: 0; }

/* ── Formulaires ───────────────────────────────────────────────────────── */

.menu-form {
  background: var(--color-bg-card, #fff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-muted, #555);
}

.form-group input,
.form-group select,
.form-group textarea {
  font-size: 1rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #333);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.danger-zone {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border, #eee);
}

.confirm-delete-box {
  background: var(--color-bg-card, #fff);
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 400px;
}

/* ── Catégories ────────────────────────────────────────────────────────── */

.cat-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-card, #fff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 8px;
}

.cat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name { flex: 1; font-size: 0.95rem; }

.cat-add-form { margin-top: 1rem; }

/* ── Inventaire ────────────────────────────────────────────────────────── */

.inventory-section {
  margin-bottom: 1.5rem;
}

.inventory-section h2 {
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.inventory-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: var(--color-bg-card, #fff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 8px;
}

.inv-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.inv-name { font-weight: 600; font-size: 0.95rem; }
.inv-recipe-link { font-size: 0.78rem; color: var(--color-accent, #6c5ce7); }
.inv-notes { font-size: 0.78rem; color: var(--color-text-muted, #888); }

.inv-expiry {
  font-size: 0.78rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 20px;
  display: inline-block;
}
.inv-expiry--expired { background: #fee2e2; color: #dc2626; }
.inv-expiry--urgent  { background: #fee2e2; color: #dc2626; }
.inv-expiry--soon    { background: #fef3c7; color: #d97706; }
.inv-expiry--normal  { background: #f3f4f6; color: #6b7280; }

.form-optional { font-size: .8rem; font-weight: 400; color: #9ca3af; }

.inv-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.inv-servings {
  font-weight: 700;
  min-width: 3.5rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ── Planificateur semaine ─────────────────────────────────────────────── */

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.week-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.planner-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  overflow-x: auto;
}

.planner-day {
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 10px;
  padding: 0.6rem;
  background: var(--color-bg-card, #fff);
}

.planner-day--today {
  border-color: var(--color-accent, #6c5ce7);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.15);
}

.planner-day-header {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.25rem;
}

.planner-day-name {
  font-weight: 700;
  font-size: 0.88rem;
  text-transform: capitalize;
}

.planner-day-date {
  font-size: 0.78rem;
  color: var(--color-text-muted, #888);
}

.planner-meal {
  background: var(--color-bg-subtle, #f8f8f8);
  border: 1px solid var(--color-border, #e8e8e8);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.planner-meal--validated {
  opacity: 0.6;
  background: #f0f9f4;
  border-color: #a8d5b5;
}

.planner-meal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.planner-meal-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted, #777);
}

.planner-meal-source { font-size: 1rem; }

.planner-meal-title {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
}

.planner-meal-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted, #888);
}

.planner-meal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.badge-validated {
  color: #27ae60;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge-task-linked {
  font-size: 0.78rem;
  color: var(--color-accent, #6c5ce7);
}

.planner-meal-notes { display: flex; flex-direction: column; gap: 0.2rem; }
.meal-note-tmp { font-size: 0.76rem; color: #b87d00; font-style: italic; }

.meal-note-add summary { list-style: none; cursor: pointer; }
.meal-note-add summary::-webkit-details-marker { display: none; }

.meal-note-form {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.meal-note-form input {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  min-width: 0;
}

.planner-empty {
  font-size: 0.8rem;
  color: var(--color-text-muted, #aaa);
  text-align: center;
  padding: 0.5rem 0;
}

.planner-add-meal {
  margin-top: 0.25rem;
}

.planner-no-recipes {
  font-size: 0.82rem;
  color: #888;
  padding: 0.5rem 0.25rem;
  line-height: 1.5;
}

.planner-no-recipes-link {
  display: inline-block;
  margin-top: 0.3rem;
  color: #6c5ce7;
  font-weight: 600;
  text-decoration: none;
}

.planner-empty-state {
  background: #fff8e1;
  border: 1.5px solid #ffe082;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: #5d4037;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

.planner-empty-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(108,92,231,.3);
  min-height: 44px;
}

.planner-add-meal { margin-top: 0.25rem; }

.planner-add-btn {
  font-size: 0.82rem;
  color: var(--color-accent, #6c5ce7);
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.4rem 0;
  min-height: 36px;
  text-align: left;
}

.planner-add-panel {
  margin-top: 0.35rem;
}

.planner-add-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 0.65rem 0.6rem;
}

.planner-form-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #666;
}

.planner-form-select,
.planner-form-input {
  font-size: 0.92rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  background: #fff;
  color: var(--color-text, #333);
  width: 100%;
  min-height: 40px;
}

/* ── Onglets source du planificateur ──────────────────────────────────── */

.planner-source-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.planner-src-tab {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  min-height: 36px;
}

.planner-src-tab.active {
  background: #6c63ff;
  border-color: #6c63ff;
  color: #fff;
}

.planner-no-recipes {
  font-size: 0.82rem;
  color: #888;
}

/* ── Menu du jour dans le calendrier ──────────────────────────────────── */

.calendar-menu-section {
  margin-top: 1.25rem;
  border-top: 1px solid var(--color-border, #e0e0e0);
  padding-top: 1rem;
}

.calendar-menu-section h3 {
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
}

.calendar-meal-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--color-bg-subtle, #f8f8f8);
  border: 1px solid var(--color-border, #e8e8e8);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
}

.calendar-meal-item.meal-validated {
  opacity: 0.6;
  background: #f0f9f4;
}

.calendar-meal-source { font-size: 1.1rem; flex-shrink: 0; }
.calendar-meal-info { flex: 1; }
.calendar-meal-title { font-weight: 600; }
.calendar-meal-meta { font-size: 0.78rem; color: var(--color-text-muted, #888); }

.calendar-meal-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-shrink: 0;
}

/* ── Utilitaires ───────────────────────────────────────────────────────── */

.empty-state {
  color: var(--color-text-muted, #888);
  text-align: center;
  padding: 2rem 1rem;
}

.empty-state-small {
  color: var(--color-text-muted, #888);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

.text-muted { color: var(--color-text-muted, #888); font-size: 0.88rem; }

/* ── Mobile ────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .planner-week {
    grid-template-columns: repeat(7, minmax(110px, 1fr));
  }

  .recipe-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .menu-header {
    flex-direction: column;
    align-items: stretch;
  }

  .menu-header-actions {
    flex-direction: row;
  }

  .week-nav {
    font-size: 0.88rem;
  }
}
