:root {
  --ink: #1d1a17;
  --muted: #6f665d;
  --bg: #faf7f2;
  --card: #ffffff;
  --line: #e8e1d6;
  --accent: #b5542c;
  --wa: #1fa855;
  --radius: 14px;
  --topbar: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Barre du haut */
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.langs { display: flex; gap: 4px; }
.langs a {
  min-width: 40px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.langs a.active { background: var(--ink); color: #fff; }

/* Visionneuse 360° */
.viewer-wrap { position: relative; background: #000; }
.pano { width: 100%; height: 62svh; min-height: 340px; }

.badge-demo {
  position: absolute;
  top: 12px;
  right: 12px; /* les boutons Pannellum sont toujours à gauche */
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}
.hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 14px;
  pointer-events: none;
  transition: opacity .4s;
}
.hint.hidden { opacity: 0; }

/* Barre des pièces */
.rooms {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  scrollbar-width: none;
}
.room {
  flex: 0 0 auto;
  width: 132px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.room img { display: block; width: 100%; height: 56px; object-fit: cover; }
.room span { display: block; min-height: 36px; padding: 3px 6px; font-size: 12px; line-height: 1.3; text-align: start; }
.pnlm-panorama-info { display: none !important; } /* le titre est déjà dans la barre des pièces */
.room[aria-selected="true"] { border-color: #fff; }

/* Points cliquables dans le panorama */
.hs { display: flex; align-items: center; justify-content: center; }
.hs::before {
  content: "";
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.hs-scene::before { background: rgba(181, 84, 44, .85); }
.hs-info::before { width: 26px; height: 26px; background: rgba(255, 255, 255, .35); }
.hs-label {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}
.hs-info .hs-label { display: none; }
.hs-info:hover .hs-label, .hs-info.open .hs-label { display: block; }

/* Fiche du bien */
.sheet { padding: 20px 16px 110px; }
.ref { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .06em; }
h1 { margin: 4px 0 0; font-size: 24px; line-height: 1.2; }
.place { margin: 2px 0 0; color: var(--muted); }
.price { margin: 12px 0 16px; font-size: 26px; font-weight: 700; color: var(--accent); }

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 18px;
}
.facts div {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  text-align: center;
}
.facts dt { font-size: 11px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; }

.desc { margin: 0 0 18px; }
h2 { margin: 0 0 8px; font-size: 16px; }
.features { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.features li { padding: 4px 10px; border-radius: 999px; background: #f0e8dc; font-size: 14px; }

/* Bouton WhatsApp : collé en bas de l'écran sur mobile */
.cta {
  position: fixed;
  inset-inline: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--wa);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(31, 168, 85, .35);
  z-index: 10;
}
.cta svg { flex: 0 0 auto; width: 30px; height: 30px; }
.cta strong { display: block; font-size: 17px; }
.cta small { display: block; opacity: .9; font-size: 13px; }

/* Ordinateur : visite à gauche, fiche à droite */
@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: 1fr 400px; height: calc(100vh - var(--topbar)); }
  .pano { height: 100%; min-height: 0; }
  .sheet { padding: 28px 28px 32px; overflow-y: auto; border-inline-start: 1px solid var(--line); }
  .cta { position: static; margin-top: 24px; }
}

/* Chat de l'assistant */
.chat-open {
  position: fixed;
  inset-inline-end: 12px;
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 76px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  cursor: pointer;
  z-index: 11;
}
.chat-open svg { width: 20px; height: 20px; }

.chat {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 20;
}
.chat[hidden] { display: none; }
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
}
.chat-head button { border: 0; background: none; color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.bubble.me { align-self: flex-end; background: var(--ink); color: #fff; }
.bubble a { color: var(--accent); }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choices button {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--card); }
.chat-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.chat-form button { padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }

@media (min-width: 960px) {
  .chat-open { bottom: 24px; inset-inline-end: 424px; }
  .chat { inset: auto; bottom: 24px; inset-inline-end: 424px; width: 380px; height: 560px; border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
}
