/* ==========================================================================
   bouv.chat — style.css

   Sommaire
     1. Variables (couleurs, polices) + thème sombre
     2. Base
     3. Éléments communs (conteneur, boutons, liens)
     4. En-tête
     5. Accroche (hero) + aperçu du chat
     6. Sections : fonctionnalités, étapes, tarifs, FAQ
     7. Appel à l'action final + pied de page
     8. Popups et formulaires
     9. Responsive
    10. Animations réduites
   ========================================================================== */


/* ==========================================================================
   1. VARIABLES
   Pour changer les couleurs du site, il suffit de modifier ce bloc.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Polices : uniquement celles déjà installées sur l'appareil (aucun téléchargement) */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI", Roboto, system-ui, sans-serif;

  /* Thème clair */
  --color-bg: #F6F7FB;
  --color-surface: #FFFFFF;
  --color-surface-alt: #ECEEF6;
  --color-text: #171C33;
  --color-text-muted: #555B75;
  --color-border: #D9DCEA;
  --color-primary: #3f85ed;        /* blue : boutons principaux, bulles de l'équipe */
  --color-primary-hover: #216ad7;
  --color-on-primary: #171C33;     /* texte posé sur le jaune */
  --color-band: #171C33;           /* bandeau d'appel à l'action */
  --color-on-band: #FFFFFF;
  --color-online: #18A866;         /* pastille « en ligne » */
  --color-focus: #216ad7;
  --color-backdrop: rgba(16, 20, 38, 0.6);
  --shadow-soft: 0 24px 60px -24px rgba(23, 28, 51, 0.35);

  --radius-small: 10px;
  --radius-medium: 16px;
  --radius-large: 24px;
  --container-width: 1120px;
  --header-height: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #040404;
  --color-surface: #181D33;
  --color-surface-alt: #232945;
  --color-text: #ECEEF8;
  --color-text-muted: #A4AAC4;
  --color-border: #2F3656;
  --color-band: #232945;
  --color-on-band: #ECEEF8;
  --color-online: #216ad7;
  --color-focus: #3f85ed;
  --color-backdrop: rgba(5, 7, 15, 0.7);
  --shadow-soft: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}


/* ==========================================================================
   2. BASE
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

/* La page reste masquée tant que les textes ne sont pas chargés (classe ajoutée par script.js) */
html:not(.is-ready) body {
  visibility: hidden;
}

/* Empêche la page de défiler derrière une popup ouverte */
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.25rem);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.1875rem;
  font-weight: 700;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}


/* ==========================================================================
   3. ÉLÉMENTS COMMUNS
   ========================================================================== */

.container {
  width: min(100% - 2.5rem, var(--container-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  background: var(--color-text);
  color: var(--color-bg);
}

.skip-link:focus {
  top: 1rem;
}

.load-error {
  padding: 0.875rem 1.25rem;
  background: #B3261E;
  color: #FFFFFF;
  font-size: 0.9375rem;
  text-align: center;
}

/* --- Boutons --- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1.125rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.button--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.button--primary:hover {
  background: var(--color-primary-hover);
}

.button--outline {
  border-color: var(--color-text);
}

.button--outline:hover,
.button--ghost:hover {
  background: var(--color-surface-alt);
}

.button--large {
  min-height: 52px;
  padding: 0.75rem 1.5rem;
  font-size: 1.0625rem;
}

.button--block {
  width: 100%;
}

/* Bouton qui ressemble à un lien (pied de page, popups) */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover,
.footer__links a:hover {
  text-decoration-thickness: 2px;
}

/* --- Logo --- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand__dot,
.status-dot {
  flex: none;
  border-radius: 50%;
  background: var(--color-online);
}

.brand__dot {
  width: 0.7em;
  height: 0.7em;
}

.status-dot {
  width: 8px;
  height: 8px;
}


/* ==========================================================================
   4. EN-TÊTE
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-height);
}

/* Sur grand écran, le bloc « menu » s'efface : ses enfants se placent directement dans l'en-tête.
   L'ordre visuel est donné par « order » : logo, navigation, outils, boutons de compte. */
.header__menu {
  display: contents;
}

.header .brand {
  order: 1;
}

.nav {
  order: 2;
  display: flex;
  gap: 1.5rem;
  margin-inline: auto;
}

.nav a {
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.nav a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.header__tools {
  order: 3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header__auth {
  order: 4;
  display: flex;
  gap: 0.25rem;
}

/* --- Choix de la langue --- */

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
}

.lang-switch button {
  padding: 0.3rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--color-text);
  color: var(--color-bg);
}

/* --- Boutons ronds (thème, menu mobile) --- */

.tool-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.0625rem;
  line-height: 1;
  cursor: pointer;
}

.tool-button:hover {
  border-color: var(--color-text-muted);
}

.menu-toggle {
  display: none;
}


/* ==========================================================================
   5. ACCROCHE (HERO) + APERÇU DU CHAT
   ========================================================================== */

.hero {
  padding-block: clamp(3rem, 8vw, 6.5rem);
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.hero__subtitle {
  max-width: 34rem;
  margin-top: 1.5rem;
  color: var(--color-text-muted);
  font-size: 1.1875rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero__note {
  margin-top: 1rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* --- Fenêtre de chat --- */

.chat {
  justify-self: end;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.chat__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.chat__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-display);
  font-weight: 800;
}

.chat__name {
  font-weight: 700;
  line-height: 1.3;
}

.chat__status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.3;
}

.chat__messages {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.25rem;
}

.bubble {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: 18px;
  font-size: 0.9688rem;
  line-height: 1.45;
}

/* Le visiteur écrit à droite, l'équipe répond à gauche (comme dans le widget) */
.bubble--visitor {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: var(--color-surface-alt);
}

.bubble--agent {
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  background: var(--color-primary);
  color: var(--color-on-primary);
}

/* Au premier affichage, les bulles arrivent l'une après l'autre.
   --index (0, 1, 2…) est posé par script.js sur chaque bulle. */
.chat--intro .bubble {
  opacity: 0;
  transform: translateY(8px);
  animation: bubble-in 0.45s ease-out forwards;
  animation-delay: calc(0.4s + var(--index, 0) * 0.9s);
}

@keyframes bubble-in {
  to {
    opacity: 1;
    transform: none;
  }
}

.chat__composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.chat__send {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-text);
  color: var(--color-surface);
  font-weight: 700;
}


/* ==========================================================================
   6. SECTIONS
   ========================================================================== */

.section {
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

.section--alt {
  border-block: 1px solid var(--color-border);
  background: var(--color-surface);
}

.section__header {
  max-width: 40rem;
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.section__header p {
  margin-top: 0.75rem;
  color: var(--color-text-muted);
  font-size: 1.125rem;
}

/* --- Fonctionnalités --- */

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.75rem 2.5rem;
}

.feature__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  border-radius: 14px;
  background: var(--color-surface-alt);
  font-size: 1.375rem;
  line-height: 1;
}

.feature p,
.step p {
  margin-top: 0.5rem;
  color: var(--color-text-muted);
}

/* --- Étapes (la numérotation est faite en CSS) --- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  counter-reset: step;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
}

/* --- Tarifs --- */

.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  max-width: 800px;
}

.plan {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
}

/* Offre mise en avant ("highlighted": true dans le JSON) */
.plan--highlighted {
  border-color: var(--color-text);
}

.plan__description {
  margin-top: 0.25rem;
  color: var(--color-text-muted);
}

.plan__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.625rem;
  margin-top: 1.5rem;
}

.plan__amount {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.plan__period {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.plan__features {
  display: grid;
  gap: 0.625rem;
  margin-block: 1.5rem 2rem;
}

.plan__features li {
  display: flex;
  gap: 0.625rem;
}

.plan__features li::before {
  content: "✓";
  color: var(--color-online);
  font-weight: 700;
}

.plan .button {
  margin-top: auto;
}

/* --- FAQ --- */

.faq {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
  align-items: start;
  gap: 2rem 4rem;
}

.faq__item {
  border-bottom: 1px solid var(--color-border);
}

.faq__item:first-child {
  border-top: 1px solid var(--color-border);
}

.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.125rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

.faq__item summary::after {
  content: "+";
  flex: none;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.2s ease;
}

.faq__item[open] summary::after {
  transform: rotate(45deg);
}

.faq__item p {
  max-width: 38rem;
  padding-bottom: 1.25rem;
  color: var(--color-text-muted);
}


/* ==========================================================================
   7. APPEL À L'ACTION FINAL + PIED DE PAGE
   ========================================================================== */

.cta-band {
  padding-block: clamp(3rem, 7vw, 5rem);
  background: var(--color-band);
  color: var(--color-on-band);
}

.cta-band__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

.cta-band h2 {
  max-width: 20ch;
}

.footer {
  padding-block: 3rem 2rem;
  font-size: 0.9375rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}

.footer__tagline {
  margin-top: 0.375rem;
  color: var(--color-text-muted);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}

.footer__links a {
  text-underline-offset: 3px;
}

.footer__copyright {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}


/* ==========================================================================
   8. POPUPS ET FORMULAIRES
   ========================================================================== */

.dialog {
  width: min(100% - 2rem, 440px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.dialog--wide {
  width: min(100% - 2rem, 680px);
}

.dialog::backdrop {
  background: var(--color-backdrop);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 0.2s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* C'est le panneau intérieur qui défile, pas la popup elle-même */
.dialog__panel {
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 2rem;
  overflow-y: auto;
}

.dialog__close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 0.9375rem;
  line-height: 1;
  cursor: pointer;
}

.dialog__title {
  padding-right: 2.5rem;
  font-size: 1.625rem;
}

.dialog__subtitle {
  margin-top: 0.375rem;
  color: var(--color-text-muted);
}

.dialog__switch {
  margin-top: 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  text-align: center;
}

.dialog__switch .link-button {
  color: var(--color-text);
  font-weight: 600;
}

/* --- Formulaires --- */

.form {
  display: grid;
  gap: 1.125rem;
  margin-top: 1.5rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0.5rem 0.875rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-bg);
  color: inherit;
  font: inherit;
}

.field input:hover {
  border-color: var(--color-text-muted);
}

.field__hint {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

a.field__hint {
  justify-self: start;
  text-underline-offset: 3px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.checkbox input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0.2em 0 0;
  accent-color: var(--color-text);
}

/* Zone de message : invisible tant qu'elle est vide */
.form__message {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-small);
  background: var(--color-surface-alt);
  font-size: 0.9375rem;
}

.form__message:empty {
  display: none;
}

/* --- Documents légaux --- */

.legal {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.75rem;
}

.legal h3 {
  font-size: 1.0625rem;
}

.legal p {
  margin-top: 0.375rem;
  color: var(--color-text-muted);
}


/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */

/* --- Menu mobile : la navigation passe dans un panneau déroulant --- */
@media (max-width: 1040px) {
  .header__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding: 0.75rem 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
  }

  .header__menu.is-open {
    display: flex;
  }

  .nav {
    flex-direction: column;
    gap: 0;
    margin: 0;
  }

  .nav a {
    padding-block: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.0625rem;
  }

  .header__auth {
    flex-direction: column;
    gap: 0.5rem;
  }

  .header__auth .button--ghost {
    border-color: var(--color-border);
  }

  .header__tools {
    margin-left: auto;
  }

  .menu-toggle {
    display: grid;
  }
}

/* --- Tablette --- */
@media (max-width: 900px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat {
    justify-self: start;
  }

  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faq {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- Téléphone --- */
@media (max-width: 640px) {
  .features,
  .steps,
  .plans {
    grid-template-columns: minmax(0, 1fr);
  }

  .features,
  .steps {
    gap: 2rem;
  }

  .hero__actions .button {
    width: 100%;
  }

  .plan,
  .dialog__panel {
    padding: 1.5rem;
  }
}

@media (max-width: 380px) {
  .container {
    width: calc(100% - 2rem);
  }

  .header__inner,
  .header__tools {
    gap: 0.375rem;
  }

  .header__menu {
    padding-inline: 1rem;
  }

  .brand {
    font-size: 1.125rem;
  }

  .lang-switch button {
    padding-inline: 0.45rem;
  }

  .tool-button {
    width: 36px;
    height: 36px;
  }
}


/* ==========================================================================
   10. ANIMATIONS RÉDUITES
   Respecte le réglage « réduire les animations » du système.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .chat--intro .bubble,
  .dialog[open] {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .faq__item summary::after {
    transition: none;
  }
}
