/* Commerçants de Bruges — mock mobile PWA */
:root {
  --cdb-mint: #acdda7;
  --cdb-green: #618f69;
  --cdb-teal: #63c8ca;
  --bg: #f3f8f2;
  --surface: #fffcf9;
  --ink: #1e2a22;
  --muted: #5a6e5f;
  --line: rgba(97, 143, 105, 0.22);
  --brand: #618f69;
  --brand-soft: #4d7356;
  --accent: #63c8ca;
  --accent-ink: #1a5c5e;
  --open: #4a7d59;
  --closed: #a34a4a;
  --radius: 14px;
  --nav-h: 64px;
  --header-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "DM Sans", system-ui, sans-serif;
}

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

html {
  height: 100%;
  height: -webkit-fill-available;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: -webkit-fill-available;
  padding-top: calc(var(--header-h) + var(--safe-t));
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  overscroll-behavior-y: contain;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(243, 248, 242, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.header-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 46%;
}

.header-prenom {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
}

.header-prenom[hidden] {
  display: none !important;
}

.brand-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(97, 143, 105, 0.22);
}

.brand-mark-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.08;
}

.brand-kicker {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.12rem, 4.2vw, 1.42rem);
  color: var(--ink);
  letter-spacing: -0.04em;
}

.commerce-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "Twemoji Mozilla",
    sans-serif;
  font-style: normal;
  line-height: 1;
}

.big-ico.commerce-emoji {
  font-size: 2.6rem;
}

.agenda-ico.commerce-emoji {
  line-height: 1;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:active {
  transform: scale(0.96);
}

.view {
  display: none;
  padding: 12px 14px 24px;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Pas de transform ici : sur iOS, translateX + fixed fait parfois « sauter » la barre du bas */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(26, 31, 30, 0.06);
  z-index: 100;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.nav-item {
  flex: 1;
  border: none;
  background: none;
  padding: 6px 2px 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: 92px;
}

.nav-item .nav-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.1;
}

.nav-item .ui-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: rgba(97, 143, 105, 0.5);
}

.nav-item.active {
  color: var(--brand);
}

.nav-item.active .ui-icon {
  color: var(--cdb-teal);
  transform: scale(1.05);
}

.nav-item.nav-item--guest .nav-label {
  opacity: 0.65;
}

.nav-item.nav-item--guest .ui-icon {
  opacity: 0.55;
}

.ui-icon {
  display: block;
  shape-rendering: geometricPrecision;
}

.btn-icon .ui-icon {
  width: 24px;
  height: 24px;
  color: var(--cdb-green);
}

.star-fav-svg {
  display: block;
  color: rgba(97, 143, 105, 0.42);
}

.star-fav.on .star-fav-svg {
  color: #618f69;
  filter: drop-shadow(0 0 5px rgba(99, 200, 202, 0.35));
}

.fav-chip-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fav-chip-inner .star-fav-svg {
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill-open {
  background: rgba(172, 221, 167, 0.42);
  color: var(--open);
}

.pill-closed {
  background: rgba(157, 59, 59, 0.12);
  color: var(--closed);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  color: var(--brand);
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.chip.on {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.wall-fav-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -2px 0 8px;
  min-height: 26px;
}

.chip-fav-mini {
  padding: 4px 11px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.chip.chip-fav {
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  justify-content: center;
}

.chip.chip-fav .fav-chip-inner {
  justify-content: center;
}

.chip.chip-fav .star-fav-svg {
  color: rgba(97, 143, 105, 0.55);
}

.chip.chip-fav.on .star-fav-svg {
  color: #fff;
  filter: none;
}

.post {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  overflow: hidden;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--line);
}

.post-meta {
  flex: 1;
  min-width: 0;
}

.post-meta .name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Safari iOS : sans couleur explicite, les <button> du mur prennent le bleu « lien » système */
.post-meta .link-commerce {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
}

.post-meta .time {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.post-body {
  padding: 0 12px 12px;
  font-size: 0.92rem;
  line-height: 1.58;
}

.post-photos {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.post-photos.one {
  grid-template-columns: 1fr;
}

.post-photos.two {
  grid-template-columns: 1fr 1fr;
}

.post-photos img {
  width: 100%;
  border-radius: 10px;
  display: block;
  max-height: 220px;
  object-fit: cover;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--line);
  min-height: 48px;
}

.btn-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: rgba(172, 221, 167, 0.15);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 10px;
  min-width: 4.75rem;
}

.btn-like .like-count {
  min-width: 1.25em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.btn-like.liked {
  color: var(--accent);
  background: rgba(99, 200, 202, 0.12);
}

.btn-like:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.star-fav {
  border: none;
  background: rgba(172, 221, 167, 0.2);
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-fav.on {
  background: rgba(99, 200, 202, 0.18);
}

.end-list {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 16px 8px 8px;
}

#view-agenda.view {
  padding-top: 8px;
}

.agenda-day {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  color: var(--brand);
  margin: 18px 0 8px;
}

#view-agenda .agenda-day:first-child {
  margin-top: 0;
}

.agenda-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  outline: none;
}

.agenda-card:focus-visible {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cdb-teal);
}

.agenda-card-thumb-wrap {
  flex-shrink: 0;
  width: 100px;
  min-height: 88px;
  background: var(--bg);
}

.agenda-card-thumb {
  width: 100%;
  height: 100%;
  min-height: 88px;
  object-fit: cover;
  display: block;
}

.agenda-card-body {
  flex: 1;
  min-width: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.agenda-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.agenda-card-copy {
  flex: 1;
  min-width: 0;
}

.agenda-ico {
  font-size: 1.55rem;
  line-height: 1;
  flex-shrink: 0;
}

.agenda-card h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.agenda-card .sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.agenda-card .link-commerce {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--brand-soft);
  cursor: pointer;
  text-decoration: none;
}

.agenda-card .link-commerce:active {
  opacity: 0.85;
}

.agenda-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.event-hero {
  margin: -4px -16px 14px;
  border-radius: 0;
  overflow: hidden;
  max-height: 200px;
}

.event-hero img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.event-hero--placeholder {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(172, 221, 167, 0.35), rgba(99, 200, 202, 0.2));
}

.event-when {
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.event-organisateur {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.event-detail {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
}

.event-modal-meta {
  margin-bottom: 16px;
}

#event-body .btn-primary {
  margin-top: 0;
}

.search-bar {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1rem;
  margin-bottom: 12px;
}

#map-annuaire {
  height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  z-index: 1;
}

.annuaire-row {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  align-items: flex-start;
}

.annuaire-row img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
}

.annuaire-row .txt {
  flex: 1;
  min-width: 0;
}

.annuaire-row h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.annuaire-row .typo {
  font-size: 0.8rem;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 31, 30, 0.45);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  z-index: 101;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.15);
}

.modal.show {
  transform: translate(-50%, 0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 10px auto 6px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
}

.modal-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-close {
  border: none;
  background: var(--bg);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.2rem;
  cursor: pointer;
}

.fiche-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.fiche-hero img.cover {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  object-fit: cover;
}

.fiche-hero .big-ico {
  font-size: 2.5rem;
  line-height: 1;
}

.fiche-block {
  margin-bottom: 18px;
}

.fiche-block h4 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.fiche-block p,
.fiche-block a {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}

.fiche-block a {
  color: var(--brand-soft);
  word-break: break-all;
}

.horaire-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

#map-fiche {
  height: 180px;
  border-radius: var(--radius);
  margin-top: 8px;
  border: 1px solid var(--line);
}

.view-assistant-page.view {
  padding-top: 4px;
  padding-bottom: 4px;
}

.assistant-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--header-h) - var(--nav-h) - var(--safe-t) - var(--safe-b) - 32px);
}

.assistant-chat {
  flex: 1;
  min-height: 100px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 2px 8px;
  margin: 0;
  background: transparent;
  border-radius: 0;
}

.assistant-compose {
  flex-shrink: 0;
  margin: 0 -14px 0;
  padding: 10px 14px 2px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(26, 31, 30, 0.05);
}

.bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.bubble.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.assistant-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.assistant-input-row input {
  flex: 1;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 1rem;
  background: var(--bg);
}

.assistant-input-row button {
  padding: 0 16px;
  min-height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 1rem;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
}

.btn-ghost {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.hint-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 12px;
}

.fav-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.fav-list-item button {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 200;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.leaflet-container {
  font-family: inherit;
}

@media (min-width: 481px) {
  body {
    box-shadow: 0 0 0 1px var(--line);
  }
}
