/**
 * Modale de redirection externe (Figma) — overlay sur la page courante.
 * Couleurs brand : #1D3253 / #465874 / #6F7E95
 */

/* Overlay : site visible derrière (semi-transparent) */
.redirect-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.45);
  -webkit-overflow-scrolling: touch;
}

.redirect-overlay.is-open {
  display: flex;
}

.redirect-overlay.is-open ~ * {
  /* rien — le site reste dans le DOM derrière */
}

body.redirect-modal-open {
  overflow: hidden;
}

.redirect-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 20px 24px -4px rgba(10, 13, 18, 0.08), 0 8px 8px -4px rgba(10, 13, 18, 0.03);
  font-family: "Roboto", sans-serif;
  /* Isolation vs CSS wall (* Quicksand / h2 / a / button) */
  color: #1d3253;
  line-height: normal;
  text-align: left;
}

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

.redirect-modal h1,
.redirect-modal h2,
.redirect-modal p,
.redirect-modal a,
.redirect-modal button {
  margin: 0;
}

.redirect-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: auto;
  height: auto;
  padding: 6px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.redirect-modal__close:hover {
  background: #f5f5f5;
}

.redirect-modal__close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.redirect-modal__logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.redirect-modal__logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.redirect-modal__logo--kiwiiz {
  background: transparent;
}

.redirect-modal__logo--kiwiiz svg {
  width: 48px;
  height: 48px;
  display: block;
}

.redirect-modal__logo--partner {
  background: #f0f0f0;
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
}

.redirect-modal__logo--partner svg {
  width: 20px;
  height: 20px;
  display: block;
}

.redirect-modal__arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.redirect-modal__arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

.redirect-modal__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  word-break: break-word;
  width: 100%;
}

.redirect-modal__title {
  margin: 0;
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 28px;
  color: #1d3253;
}

.redirect-modal__body {
  margin: 0;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  color: #1d3253;
}

.redirect-modal__legal {
  margin: 0;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  color: #6f7e95;
}

.redirect-modal__actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.redirect-modal__btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 999px;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  border: 1px solid transparent;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

.redirect-modal__btn:hover,
.redirect-modal__btn:focus,
.redirect-modal__btn:active,
.redirect-modal__btn:visited,
.redirect-modal a.redirect-modal__btn:hover,
.redirect-modal a.redirect-modal__btn:focus {
  text-decoration: none !important;
}

.redirect-modal__btn:hover .redirect-modal__btn-label,
.redirect-modal__btn:focus .redirect-modal__btn-label {
  text-decoration: none !important;
}

/* Contre le * { font-weight: 400 } global (index-remi) — le span ne doit pas rester Regular */
.redirect-modal__btn-label {
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  text-decoration: none;
}

.redirect-modal__btn--secondary {
  background: #fff;
  border-color: #465874;
  color: #1d3253;
}

.redirect-modal__btn--secondary:hover {
  background: #f8f9fb;
}

.redirect-modal__btn--primary {
  background: #1d3253;
  color: #fff;
}

.redirect-modal__btn--primary:hover {
  background: #16263f;
}

/* État Figma « Loading » */
.redirect-modal.is-loading .redirect-modal__btn--secondary {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.redirect-modal.is-loading .redirect-modal__btn--primary {
  opacity: 0.6;
  pointer-events: none;
  cursor: default;
}

.redirect-modal.is-loading .redirect-modal__btn--primary:hover {
  background: #1d3253;
}

.redirect-modal.is-loading .redirect-modal__close {
  opacity: 0.4;
  pointer-events: none;
}

.redirect-modal__btn--primary svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

/* Page dédiée (fallback /petite-annonce-*.html sans JS wall) */
.redirect-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Roboto", sans-serif;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.redirect-page .redirect-modal {
  /* hérite des styles ci-dessus */
}

/* Mobile Figma : padding 24 / gap 20 / radius 16 / boutons empilés gap 10 */
@media (max-width: 560px) {
  .redirect-overlay,
  .redirect-page {
    padding: 0;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.55);
  }

  .redirect-modal {
    max-width: none;
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    gap: 20px;
    align-items: stretch;
  }

  .redirect-modal__close {
    top: 16px;
    right: 24px;
  }

  .redirect-modal__logos,
  .redirect-modal__text,
  .redirect-modal__actions {
    width: 100%;
  }

  .redirect-modal__actions {
    flex-direction: column-reverse;
    gap: 10px;
    align-items: stretch;
  }

  .redirect-modal__btn {
    flex: 0 0 auto;
    width: 100%;
  }
}
