/* ============================================================
   SEMAINE.CSS — Vue semaine partageable
   Mobile-first · Pensé pour screenshot / partage
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #1B4332;
  --green-light: #40916C;
  --bg: #FFFFFF;
  --card-bg: #FAF7F2;
  --border: #E5E0D8;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', system-ui, sans-serif;
  --score-a: #1B4332;
  --score-b: #1E3A5F;
  --score-c: #92400E;
  --risk-low: #16A34A;
  --risk-medium: #CA8A04;
  --risk-high: #DC2626;
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
.semaine-header {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: #fff;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.semaine-logo {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.semaine-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #fff;
}

.semaine-score__letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #52B788;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
}

.semaine-score__info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 1px solid #fff;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.semaine-score__info-icon:hover {
  background: #fff;
  color: var(--green);
  border-color: #fff;
}

.semaine-header-back {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-weight: 700;
  transition: opacity 150ms;
}

.semaine-header-back:hover {
  opacity: 0.8;
}

/* ── Main container ─────────────────────────────────────── */
.semaine-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* ── Date ───────────────────────────────────────────────── */
.semaine-date {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
}

/* ── Day grid ───────────────────────────────────────────── */
.semaine-grid {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-bottom: 1.5rem;
}

.semaine-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  padding: 2rem;
}

/* ── Day card ───────────────────────────────────────────── */
.semaine-day-card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
}

.semaine-day-header {
  background: var(--green);
  color: #fff;
  padding: .45rem .85rem;
}

.semaine-day-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.semaine-day-date {
  font-size: .72rem;
  color: rgba(255,255,255,.7);
  margin-left: .5rem;
}

.semaine-day-meals {
  padding: .25rem 0;
}

/* ── Meal row ───────────────────────────────────────────── */
.semaine-meal-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .35rem .85rem;
  border-bottom: 1px solid var(--border);
}

.semaine-meal-row:last-child {
  border-bottom: none;
}

.semaine-meal-icon {
  font-size: .9rem;
  flex-shrink: 0;
  margin-top: .05rem;
  width: 1.3em;
  text-align: center;
}

.semaine-meal-info { flex: 1; min-width: 0; }

.semaine-meal-type {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .06rem;
}

.semaine-meal-name {
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.35;
}

.semaine-risk-dot {
  flex-shrink: 0;
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  margin-top: .4rem;
  align-self: flex-start;
}

/* ── Footer ─────────────────────────────────────────────── */
.semaine-footer {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  padding: .75rem 0 0;
  border-top: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

/* ── Actions ────────────────────────────────────────────── */
.semaine-actions {
  display: flex;
  gap: .65rem;
  justify-content: center;
  flex-wrap: wrap;
}

.semaine-btn {
  font-family: var(--font-body);
  font-size: .83rem;
  font-weight: 600;
  padding: .5rem 1.1rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 150ms;
}

.semaine-btn:hover { background: var(--card-bg); }

.semaine-btn--share {
  background: var(--green);
  color: #fff;
  border-color: transparent;
}

.semaine-btn--share:hover { background: var(--green-light); }

/* Bouton retour — bordure verte, texte vert, hover inversé */
.semaine-btn--back {
  background: var(--card-bg);
  border-color: var(--green);
  color: var(--green);
  font-weight: 700;
}

.semaine-btn--back:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* ── Error state ────────────────────────────────────────── */
.semaine-error {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  padding: 2.5rem 1rem;
}

/* ── Health Legend ──────────────────────────────────────── */
.health-legend {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  opacity: 0.8;
}

.health-legend__title {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.health-legend__items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  color: var(--text);
}

/* Mobile: Horizontal layout above 640px */
@media (min-width: 640px) {
  .health-legend__items {
    flex-direction: row;
    gap: 1.5rem;
  }
}

/* ── Fiche technique modale ──────────────────────────────── */

.fiche-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}

.fiche-overlay.is-open {
  display: flex;
}

.fiche-modal {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  border-radius: 18px 18px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 1rem 2.5rem;
  position: relative;
}

/* Handle bar */
.fiche-modal::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: .75rem auto .9rem;
}

/* Bouton fermer */
.fiche-close {
  position: absolute;
  top: .6rem;
  right: .85rem;
  background: var(--card-bg);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms;
}

.fiche-close:hover { background: var(--border); }

/* Header */
.fiche-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}

.fiche-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: .1rem;
}

.fiche-header-text { flex: 1; min-width: 0; }

.fiche-meal-type {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .2rem;
}

.fiche-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 .25rem;
  color: var(--text);
}

.fiche-meta {
  font-size: .75rem;
  color: var(--green-light);
  font-weight: 600;
}

/* Sélecteur de profil */
.fiche-profiles {
  display: flex;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

.fiche-profile-btn {
  flex: 1;
  padding: .4rem .5rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 150ms;
}

.fiche-profile-btn.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.fiche-profile-btn:hover:not(.is-active) {
  border-color: var(--green);
  color: var(--green);
}

/* Sections */
.fiche-section { margin-bottom: 1.1rem; }

.fiche-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .6rem;
}

/* Ingrédients */
.fiche-ingredients {
  list-style: none;
}

.fiche-ingredient {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .84rem;
  padding: .32rem 0;
  border-bottom: 1px solid var(--border);
}

.fiche-ingredient:last-child { border-bottom: none; }

.fiche-ingredient-name { color: var(--text); }

.fiche-ingredient-qty {
  font-weight: 700;
  color: var(--green);
  font-size: .79rem;
  white-space: nowrap;
  margin-left: .75rem;
  flex-shrink: 0;
}

/* Étapes */
.fiche-steps {
  list-style: none;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.fiche-step {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  font-size: .84rem;
  line-height: 1.5;
  counter-increment: step-counter;
}

.fiche-step::before {
  content: counter(step-counter);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .08rem;
}

/* Note conseil */
.fiche-note {
  margin-top: 1rem;
  padding: .6rem .85rem;
  background: var(--card-bg);
  border-radius: 8px;
  border-left: 3px solid var(--green-light);
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.fiche-note:empty { display: none; }

/* Lignes de repas cliquables */
.semaine-meal-row--clickable {
  cursor: pointer;
  transition: background 150ms;
  border-radius: 6px;
}

.semaine-meal-row--clickable:hover {
  background: rgba(27, 67, 50, 0.05);
}

.semaine-prep-badge {
  font-size: .62rem;
  color: var(--green-light);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .38rem;
  margin-right: .25rem;
}
