:root {
  /* Palette vibrante & appétissante */
  --bg: #fff8f0;
  --bg-soft: #fff1e3;
  --card: #ffffff;
  --primary: #ff6b35;        /* orange corail vif */
  --primary-dark: #e04e1f;
  --accent: #ffb703;         /* jaune doré */
  --accent-soft: #fff1cf;
  --text: #2d1b12;
  --muted: #9a7b64;
  --border: #f3dcc7;

  /* Couleurs par repas (vives et différenciées) */
  --breakfast: #ffb703;      /* jaune soleil */
  --breakfast-bg: #fff4d6;
  --lunch: #e63946;          /* rouge tomate */
  --lunch-bg: #ffe4e6;
  --dinner: #2a9d8f;         /* vert émeraude */
  --dinner-bg: #dcf2ee;

  --shadow: 0 10px 30px rgba(230, 90, 40, 0.14);
  --shadow-sm: 0 4px 14px rgba(230, 90, 40, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Kufi Arabic", "Noto Sans Arabic", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  font-size: 17px;
  line-height: 1.55;
}
body { padding-bottom: env(safe-area-inset-bottom); }
html[dir="rtl"] body {
  font-family: "Noto Kufi Arabic", "Noto Sans Arabic", -apple-system, sans-serif;
}
.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* ÉCRAN DE LANGUE                                                     */
/* ------------------------------------------------------------------ */
.lang-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(255,183,3,.45), transparent 60%),
    linear-gradient(160deg, #ff6b35 0%, #e04e1f 45%, #ff9a3d 100%);
}
.lang-card {
  background: #fff; border-radius: 30px; padding: 44px 30px;
  text-align: center; width: 100%; max-width: 390px;
  box-shadow: 0 24px 60px rgba(180, 60, 10, 0.32);
}
.lang-emoji { font-size: 68px; line-height: 1; margin-bottom: 10px; }
.lang-title { font-size: 36px; font-weight: 800; color: var(--primary); margin-bottom: 2px; }
.lang-sub { font-size: 18px; color: var(--muted); margin-bottom: 28px; }
.lang-prompt { font-size: 16px; color: var(--text); margin-bottom: 18px; font-weight: 600; }
.lang-buttons { display: flex; flex-direction: column; gap: 12px; }
.lang-btn {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 17px; font-size: 20px; font-weight: 700;
  border: 2px solid var(--border); border-radius: 16px;
  background: #fff; color: var(--text); cursor: pointer; transition: all .18s ease;
}
.lang-btn:hover { border-color: var(--accent); background: var(--bg-soft); }
.lang-btn:active { transform: scale(.98); }
.lang-flag { font-size: 28px; }

/* ------------------------------------------------------------------ */
/* TOPBAR + TABS                                                       */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top));
  background: linear-gradient(135deg, #e04e1f, #ff6b35);
  color: #fff; box-shadow: 0 2px 16px rgba(200, 60, 15, 0.3);
}
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-emoji { font-size: 28px; }
.topbar-name { font-size: 20px; font-weight: 800; }
.topbar-sub { font-size: 13px; opacity: .9; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle, .install-btn {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  font-size: 18px; width: 44px; height: 44px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.install-btn { width: auto; padding: 0 15px; border-radius: 999px; font-size: 15px; font-weight: 700; gap: 6px; background: #fff; color: var(--primary); }
.lang-toggle:active, .install-btn:active { transform: scale(.95); }

.tabs {
  display: flex; gap: 8px; padding: 12px 18px;
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 72px; z-index: 9;
}
.tab {
  flex: 1; padding: 12px; border: none; border-radius: 13px;
  background: var(--bg-soft); color: var(--muted);
  font-size: 16px; font-weight: 700; cursor: pointer; transition: all .18s ease;
}
.tab.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ */
/* VUE DU JOUR                                                         */
/* ------------------------------------------------------------------ */
.view { padding: 16px 16px 30px; }
.view { display: none; }
.view.active { display: block; }

.date-chip {
  display: inline-block; background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 18px; font-size: 15px; font-weight: 700;
  color: var(--primary); margin-bottom: 16px; box-shadow: var(--shadow-sm);
}

.meal-tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.meal-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 13px 6px; border: 2px solid var(--border); border-radius: 16px;
  background: #fff; cursor: pointer; font-weight: 700; color: var(--muted);
  transition: all .18s ease; font-size: 15px;
}
.meal-tab .meal-emoji { font-size: 26px; }
.meal-tab.active { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.meal-tab[data-meal="breakfast"].active { border-color: var(--breakfast); background: var(--breakfast-bg); color: #a06b00; }
.meal-tab[data-meal="lunch"].active { border-color: var(--lunch); background: var(--lunch-bg); color: var(--lunch); }
.meal-tab[data-meal="dinner"].active { border-color: var(--dinner); background: var(--dinner-bg); color: var(--dinner); }

/* ------------------------------------------------------------------ */
/* CARTE RECETTE                                                       */
/* ------------------------------------------------------------------ */
.recipe-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 4px;
}
.recipe-hero { color: #fff; padding: 24px 20px; }
.recipe-hero.breakfast { background: linear-gradient(135deg, #ffb703, #f59000); }
.recipe-hero.lunch { background: linear-gradient(135deg, #e63946, #c81e2e); }
.recipe-hero.dinner { background: linear-gradient(135deg, #2a9d8f, #17756a); }
.recipe-cat {
  display: inline-block; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; background: rgba(255,255,255,.24);
  border-radius: 999px; padding: 4px 13px; margin-bottom: 12px;
}
.recipe-title { font-size: 24px; font-weight: 800; line-height: 1.3; }
.recipe-meta { display: flex; gap: 16px; margin-top: 13px; font-size: 15px; flex-wrap: wrap; }
.recipe-meta span { display: flex; align-items: center; gap: 6px; }

.recipe-body { padding: 22px 20px; }
.section-title {
  font-size: 17px; font-weight: 800; color: var(--primary);
  margin: 4px 0 12px; display: flex; align-items: center; gap: 8px;
}
.ingredient-list { list-style: none; margin-bottom: 24px; }
.ingredient-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px dashed var(--border); font-size: 16px;
}
.ingredient-qty {
  font-weight: 800; color: var(--primary-dark); white-space: nowrap;
  background: var(--accent-soft); border-radius: 9px; padding: 4px 11px; font-size: 14px;
}

.steps-list { list-style: none; counter-reset: step; }
.steps-list li {
  counter-increment: step; position: relative;
  padding: 13px 12px 13px 54px; margin-bottom: 10px;
  background: var(--bg-soft); border-radius: 13px; font-size: 16px;
}
.steps-list li::before {
  content: counter(step); position: absolute; left: 12px; top: 13px;
  width: 30px; height: 30px; background: var(--accent); color: #5c3a00;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
html[dir="rtl"] .steps-list li { padding: 13px 54px 13px 12px; }
html[dir="rtl"] .steps-list li::before { left: auto; right: 12px; }

/* ------------------------------------------------------------------ */
/* VUE PLANNING                                                        */
/* ------------------------------------------------------------------ */
.planning-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.nav-arrow {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: #fff; color: var(--primary); font-size: 27px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.nav-arrow:active { background: var(--bg-soft); }
.month-label { font-size: 20px; font-weight: 800; color: var(--text); }

.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.weekdays div {
  text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 0;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-cell {
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  border-radius: 13px; background: #fff; border: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
  position: relative; transition: all .15s ease;
}
.day-cell.empty { background: transparent; border: none; cursor: default; }
.day-cell.today { border: 2px solid var(--accent); color: var(--primary); font-weight: 800; }
.day-cell.selected { background: var(--primary); color: #fff; }
.day-cell.has-recipe::after {
  content: ''; position: absolute; bottom: 5px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent);
}

.day-detail {
  margin-top: 18px; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; font-size: 15px;
  color: var(--muted); text-align: center;
}

/* ------------------------------------------------------------------ */
/* BANDEAU INSTALL (prompt natif)                                      */
/* ------------------------------------------------------------------ */
.install-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; padding-bottom: calc(14px + env(safe-area-inset-bottom));
  background: #fff; box-shadow: 0 -6px 24px rgba(0,0,0,0.16);
  border-top: 2px solid var(--accent);
}
.install-banner .ib-icon { font-size: 30px; }
.install-banner .ib-text { flex: 1; font-size: 15px; font-weight: 700; color: var(--text); }
.install-banner .ib-sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.install-banner button {
  border: none; border-radius: 12px; padding: 12px 18px;
  font-size: 15px; font-weight: 800; cursor: pointer;
}
.install-banner .ib-yes { background: var(--primary); color: #fff; }
.install-banner .ib-no { background: var(--bg-soft); color: var(--muted); }
