/* ═══════════════════════════════════════════
   NosResto — feuille de style mobile-first
   ═══════════════════════════════════════════ */

:root {
  --primary: #e8543f;
  --primary-dark: #c9432f;
  --primary-soft: #fdeae6;
  --bg: #faf6f1;
  --card: #ffffff;
  --text: #2b2320;
  --muted: #8c7f78;
  --border: #eee4dc;
  --good: #2fa36b;
  --meh: #e7a530;
  --bad: #d94f43;
  --shadow: 0 4px 18px rgba(43, 35, 32, .10);
  --radius: 18px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1715;
    --card: #2a2320;
    --text: #f3ece7;
    --muted: #a99c94;
    --border: #3a322d;
    --primary-soft: #47281f;
    --shadow: 0 4px 18px rgba(0, 0, 0, .4);
  }
}

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

html, body {
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ─────────── En-tête ─────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: linear-gradient(135deg, var(--primary) 0%, #f0774f 100%);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 500;
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-emoji { font-size: 30px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.2)); }
.brand h1 { font-size: 20px; font-weight: 900; letter-spacing: .3px; line-height: 1.1; }
.brand-sub { font-size: 11px; opacity: .9; font-weight: 600; }

.me-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 5px 12px 5px 5px;
}

/* ─────────── Avatars ─────────── */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
  border: 2px solid #fff;
}

.avatar.c-matthieu { background: #3b82f6; color: #fff; }
.avatar.c-bruno    { background: #f59e0b; color: #fff; }
.avatar.c-delphine { background: #ec4899; color: #fff; }
.avatar.c-antoine  { background: #10b981; color: #fff; }

/* ─────────── Vues ─────────── */

main { flex: 1; position: relative; overflow: hidden; }

.view {
  position: absolute;
  inset: 0;
  display: none;
}
.view.active { display: block; }

#map { height: 100%; width: 100%; background: #dfe8ec; }

#view-list {
  overflow-y: auto;
  padding: 14px 14px calc(var(--nav-h) + var(--safe-b) + 20px);
  -webkit-overflow-scrolling: touch;
}

/* ─────────── Carte : extras ─────────── */

.picking-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  z-index: 450;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.picking-banner .btn-ghost { color: var(--primary); padding: 2px 6px; }

.fab-mini {
  position: absolute;
  right: 14px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  font-size: 20px;
  box-shadow: var(--shadow);
  z-index: 440;
}

/* Marqueurs emoji */
.resto-marker { background: none; border: none; }
.resto-marker .pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50% 50% 50% 6px;
  transform: rotate(0deg);
  background: var(--card);
  border: 3px solid var(--muted);
  font-size: 20px;
  box-shadow: 0 3px 8px rgba(0,0,0,.3);
}
.resto-marker .pin.score-good { border-color: var(--good); }
.resto-marker .pin.score-meh  { border-color: var(--meh); }
.resto-marker .pin.score-bad  { border-color: var(--bad); }

/* ─────────── Liste ─────────── */

.list-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

#list-search {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
#list-search:focus { border-color: var(--primary); }

.segmented {
  display: flex;
  background: var(--card);
  border-radius: 999px;
  padding: 4px;
  border: 1.5px solid var(--border);
}
.segmented button {
  flex: 1;
  border: none;
  background: none;
  color: var(--muted);
  padding: 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}
.segmented button.active { background: var(--primary); color: #fff; }

.restaurant-list { display: flex; flex-direction: column; gap: 12px; }

.resto-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1.5px solid var(--border);
  text-align: left;
  width: 100%;
}
.resto-card:active { transform: scale(.985); }

.resto-card .card-emoji {
  font-size: 30px;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-body { flex: 1; min-width: 0; }
.card-body h3 {
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-addr {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
}
.stars-inline { color: #eab308; letter-spacing: 1px; }
.likes-inline { color: var(--muted); font-weight: 700; }

.card-avatars { display: flex; }
.card-avatars .avatar { width: 24px; height: 24px; font-size: 11px; margin-left: -7px; }
.card-avatars .avatar:first-child { margin-left: 0; }

.score-badge {
  min-width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.score-badge small { font-size: 9px; font-weight: 700; opacity: .85; }
.score-badge.score-good { background: var(--good); }
.score-badge.score-meh  { background: var(--meh); }
.score-badge.score-bad  { background: var(--bad); }
.score-badge.score-none { background: var(--muted); font-size: 13px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-emoji { font-size: 56px; margin-bottom: 12px; }
.inline-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 900;
}

/* ─────────── Navigation basse ─────────── */

.bottom-nav {
  flex-shrink: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--card);
  border-top: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 600;
  position: relative;
}

.nav-btn {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  width: 90px;
  padding: 6px 0;
}
.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 22px; }

.fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #f0774f 100%);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(232, 84, 63, .45);
  margin-top: -26px;
}
.fab:active { transform: scale(.93); }

/* ─────────── Modale « Qui es-tu ? » ─────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 10, .55);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--card);
  border-radius: 24px;
  padding: 26px 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
}
.who-card h2 { font-size: 22px; font-weight: 900; margin-bottom: 4px; }
.who-card .muted { font-size: 13px; margin-bottom: 18px; }

.who-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.who-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 18px;
  border: 2px solid var(--border);
  background: var(--bg);
  font-weight: 900;
  font-size: 15px;
  color: var(--text);
}
.who-btn .avatar { width: 52px; height: 52px; font-size: 24px; }
.who-btn:active { transform: scale(.96); }
.who-btn.selected { border-color: var(--primary); background: var(--primary-soft); }

/* ─────────── Popup « Installer l'application » ─────────── */

.install-card { padding-top: 20px; }

.install-icon {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  margin-bottom: 10px;
  box-shadow: 0 6px 16px rgba(232, 84, 63, .35);
}

.install-card .muted { font-size: 14px; margin-bottom: 16px; }

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-bottom: 6px;
}

.install-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.35;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
}

.ios-share {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
  color: #0a84ff;
}

.install-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

.install-btn { width: 100%; margin-top: 4px; }

.install-card .btn-ghost { margin-top: 8px; }

/* ─────────── Bottom sheets ─────────── */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 10, .45);
  z-index: 700;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b));
  z-index: 800;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  animation: slide-up .22s ease;
  -webkit-overflow-scrolling: touch;
}

@keyframes slide-up {
  from { transform: translateY(40%); opacity: .4; }
  to   { transform: translateY(0);   opacity: 1; }
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 99px;
  background: var(--border);
  margin: 4px auto 14px;
}

.sheet h2 { font-size: 19px; font-weight: 900; margin-bottom: 12px; }

/* ─────────── Formulaire ─────────── */

#add-form label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 14px 0 6px;
}

#add-form input[type="text"],
#add-form input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
#add-form input:focus { border-color: var(--primary); }

.address-row { display: flex; gap: 8px; }
.address-row input { flex: 1; }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-picker button {
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg);
}
.emoji-picker button.selected { border-color: var(--primary); background: var(--primary-soft); }

.geocode-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.geocode-results button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.geocode-results button:active { border-color: var(--primary); }

.location-status { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.location-status.ok { color: var(--good); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

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

.btn-primary {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(232, 84, 63, .35);
}
.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
  border: none;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
  font-size: 16px;
  padding: 0 16px;
  border-radius: 14px;
}

.btn-outline {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border-radius: 14px;
  border: 2px dashed var(--border);
  background: none;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

.btn-ghost {
  border: none;
  background: none;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 14px;
}

.btn-danger-ghost {
  border: none;
  background: none;
  color: var(--bad);
  font-weight: 800;
  font-size: 13px;
  padding: 10px;
}

/* ─────────── Fiche resto ─────────── */

.detail-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.detail-head .card-emoji {
  font-size: 32px;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.detail-head h2 { margin-bottom: 2px; }
.detail-addr { font-size: 13px; color: var(--muted); }

.detail-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 12px 0;
  font-weight: 800;
  font-size: 14px;
  flex-wrap: wrap;
}
.detail-comment {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 12px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1.5px solid var(--border);
}
.rating-row .r-name { font-weight: 900; font-size: 14px; width: 74px; flex-shrink: 0; }
.rating-row .r-stars { color: #eab308; font-size: 15px; letter-spacing: 1px; flex: 1; }
.rating-row .r-stars .off { color: var(--border); }
.rating-row .r-like { font-size: 17px; }

.my-rating {
  background: var(--primary-soft);
  border-radius: 18px;
  padding: 14px;
  margin-top: 12px;
}
.my-rating h3 { font-size: 14px; font-weight: 900; margin-bottom: 10px; }

.star-input { display: flex; gap: 4px; margin-bottom: 12px; }
.star-input button {
  font-size: 30px;
  background: none;
  border: none;
  padding: 2px;
  filter: grayscale(1) opacity(.45);
  transition: transform .1s;
}
.star-input button.on { filter: none; }
.star-input button:active { transform: scale(1.25); }

.like-input { display: flex; gap: 10px; }
.like-input button {
  flex: 1;
  padding: 11px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 900;
  font-size: 14px;
}
.like-input button.on-like    { border-color: var(--good); background: rgba(47,163,107,.14); color: var(--good); }
.like-input button.on-dislike { border-color: var(--bad);  background: rgba(217,79,67,.12);  color: var(--bad); }

.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-actions a {
  color: var(--primary);
  font-weight: 900;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 0;
}

/* ─────────── Toast ─────────── */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  background: var(--text);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  z-index: 950;
  box-shadow: var(--shadow);
  animation: slide-up .2s ease;
  max-width: 90vw;
  text-align: center;
}

/* ─────────── Écrans plus larges ─────────── */

@media (min-width: 700px) {
  .sheet, .toast { max-width: 480px; margin: 0 auto; }
  .sheet { border-radius: 26px 26px 0 0; }
  #view-list { max-width: 640px; margin: 0 auto; }
  .list-toolbar { flex-direction: row; }
  .segmented { min-width: 260px; }
}
