/* ============================================================
   CTA Bar mobile + Order modal (bottom-sheet)
   Composant factorisé — 1 source pour les 3 pages
   Templatisable Mijote (URLs en data-attributes sur <body>)
   ============================================================ */

:root {
  --cta-blue: #12448E;
  --cta-red: #FF3131;
  --cta-cream: #F8F4E3;
  --cta-ink: #1A1A2E;
  --cta-wa-green: #25D366;
}

/* ── BARRE STICKY ── */

.cta-bar {
  display: none;
}

@media (max-width: 768px) {
  /* On NE met PAS de padding-bottom sur le body — sinon ça créait une bande
     cream visible sous le footer (le body.background = cream). À la place, on
     pousse le footer lui-même : son bg navy remplit alors la zone où la bar
     overlay, plus aucune couleur étrangère visible. Voir règle .footer plus bas. */

  .cta-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;

    display: flex;
    align-items: center;
    gap: 0.65rem;

    padding: 0.55rem 0.85rem 1.25rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));

    /* Fond complètement transparent — les boutons flottent au-dessus du contenu */
    background: transparent;

    opacity: 0;
    transform: translateY(110%);
    transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
  }

  .cta-bar.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  /* Wrap WhatsApp — plus large que le bouton pour laisser respirer l'orbite */
  .cta-bar__wa-wrap {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Orbite tournante — centrée sur le bouton, déborde au-dessus de la barre */
  .cta-bar__wa-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68px;
    height: 68px;
    margin-top: -34px;
    margin-left: -34px;
    pointer-events: none;
    animation: cta-bar-orbit-spin 14s linear infinite;
    transform-origin: center;
  }

  @keyframes cta-bar-orbit-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }

  /* Bouton WhatsApp */
  .cta-bar__wa {
    position: relative;
    z-index: 1;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--cta-wa-green);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(37, 211, 102, 0.4);
    animation: cta-bar-wa-pulse 3s ease-in-out infinite;
    transition: transform 0.18s ease;
  }
  .cta-bar__wa:active { transform: scale(0.94); }
  .cta-bar__wa svg { width: 22px; height: 22px; display: block; }
  .cta-bar__wa:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

  @keyframes cta-bar-wa-pulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(37, 211, 102, 0.4); }
    50%      { box-shadow: 0 2px 18px rgba(37, 211, 102, 0.65); }
  }

  /* Boutons Réserver / Commander — plus de respiration interne */
  .cta-bar__btn {
    flex: 1;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 0.6rem;

    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    color: white;

    border: none;
    border-radius: 6px;
    cursor: pointer;

    transition: transform 0.15s ease, background 0.25s ease, box-shadow 0.25s ease;
  }
  .cta-bar__btn:active { transform: scale(0.97); }
  .cta-bar__btn svg { flex-shrink: 0; display: block; }

  .cta-bar__btn--reserve {
    background: var(--cta-blue);
    box-shadow: 0 2px 12px rgba(18, 68, 142, 0.35);
  }
  .cta-bar__btn--order {
    background: var(--cta-red);
    box-shadow: 0 2px 12px rgba(255, 49, 49, 0.4);
  }

  /* Adaptation quand la barre est au-dessus d'une section sombre/bleue :
     boutons légèrement éclaircis + halo blanc subtil pour ressortir.
     Cas critique : Réserver bleu sur section "Infos pratiques" bleu identique. */
  .cta-bar.is-on-dark .cta-bar__btn--reserve {
    background: #1E5BB5;
    box-shadow: 0 2px 14px rgba(18, 68, 142, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.18);
  }
  .cta-bar.is-on-dark .cta-bar__btn--order {
    background: #FF4848;
    box-shadow: 0 2px 14px rgba(255, 49, 49, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15);
  }

  .cta-bar__btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
  }
}

/* ── Masquage des CTAs redondants (hero index + bouton menu) sur mobile/tablet ── */
/* Sur ces breakpoints, la cta-bar sticky est visible : les CTAs hero/menu deviennent
   du doublon. Sur desktop ≥1025px, ils restent visibles (la bar est cachée). */
@media (max-width: 1024px) {
  .hero-ctas,
  .cta-hide-on-touch {
    display: none !important;
  }
}

/* ── Footer : reserve l'espace de la cta-bar via son propre padding-bottom ── */
/* Approche : on étend le padding interne du footer (qui a un fond navy) plutôt que
   d'ajouter du padding au body (qui aurait un fond cream visible sous le footer).
   Résultat : la bar overlay le footer, mais le footer's navy fill comble l'espace. */
@media (max-width: 768px) {
  body.cta-bar-ready footer {
    padding-bottom: calc(2rem + 92px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ── MODAL / BOTTOM-SHEET COMMANDER ── */

.order-modal {
  position: fixed; inset: 0; z-index: 250;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.order-modal.open { opacity: 1; pointer-events: auto; }

.order-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 14, 26, 0.72);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.order-modal__card {
  position: relative;
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, #15192b 0%, #0e1322 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: clamp(1.75rem, 5vw, 2.5rem) clamp(1.5rem, 4vw, 2.25rem) clamp(1.5rem, 4vw, 2rem);
  box-shadow: 0 25px 60px -10px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,49,49,0.06);
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}
.order-modal.open .order-modal__card { transform: translateY(0) scale(1); opacity: 1; }

/* Drag handle visible uniquement en bottom-sheet (mobile) */
.order-modal__handle {
  display: none;
}

.order-modal__close {
  position: absolute; top: 0.85rem; right: 0.85rem;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  color: rgba(255,255,255,0.7); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.order-modal__close:hover { background: rgba(255,255,255,0.12); color: white; transform: scale(1.05); }
.order-modal__close:active { transform: scale(0.95); }

.order-modal__eyebrow {
  color: var(--cta-red);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 700; margin: 0 0 0.6rem;
}
.order-modal__title {
  font-family: 'Intro Rust', sans-serif; color: white;
  font-size: clamp(1.35rem, 4.5vw, 1.7rem);
  line-height: 1.2; letter-spacing: 0.01em; margin: 0 0 0.6rem;
}
.order-modal__subtitle {
  color: rgba(255,255,255,0.6);
  font-size: 0.88rem; line-height: 1.55; margin: 0 0 1.5rem;
}
.order-modal__subtitle strong { color: white; font-weight: 600; }

.order-modal__actions { display: flex; flex-direction: column; gap: 0.75rem; }

.order-modal__btn {
  display: flex; align-items: center; gap: 0.95rem;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none; text-align: left;
  transition: transform 0.18s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.order-modal__btn svg { flex-shrink: 0; }
.order-modal__btn-label { display: block; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; }
.order-modal__btn-meta  { display: block; font-weight: 400; font-size: 0.75rem; opacity: 0.7; margin-top: 0.1rem; }

.order-modal__btn--primary {
  background: var(--cta-red); color: white;
  box-shadow: 0 6px 20px rgba(255,49,49,0.32);
}
.order-modal__btn--primary:hover  { background: #d42020; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(255,49,49,0.42); }
.order-modal__btn--primary:active { transform: translateY(0); }

.order-modal__btn--ghost {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  color: white;
}
.order-modal__btn--ghost:hover  { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.28); transform: translateY(-1px); }
.order-modal__btn--ghost:active { transform: translateY(0); }

.order-modal__btn:focus-visible,
.order-modal__close:focus-visible { outline: 2px solid var(--cta-red); outline-offset: 3px; }

/* Bottom-sheet sur mobile + drag handle visible + swipe down animation */
@media (max-width: 600px) {
  .order-modal { align-items: flex-end; padding: 0; }
  .order-modal__card {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    padding-top: 1.75rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    touch-action: pan-y;
  }
  .order-modal.open .order-modal__card { transform: translateY(0); }

  .order-modal__handle {
    display: block;
    width: 42px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    margin: 0 auto 1.1rem;
  }

  .order-modal__close {
    top: 0.5rem; right: 0.6rem;
  }

  /* Pendant le swipe : pas de transition pour suivre le doigt */
  .order-modal.is-dragging .order-modal__card {
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cta-bar, .cta-bar__wa, .cta-bar__wa-orbit,
  .order-modal, .order-modal__card {
    animation: none !important;
    transition: opacity 0.15s ease !important;
  }
}
