/* PIERROT Split Pay – styles front (neutres, surchargeables par le thème) */

:root {
  --psp-alma: #fa5022;
  --psp-alma-blue: #00a4d6;
  --psp-alma-yellow: #f5b400;
  --psp-klarna: #ffb3c7;
  --psp-klarna-ink: #0b051d;
}

.pierrot-splitpay:empty { display: none; }

/* ---------- Lignes ---------- */
.psp-line {
  margin: .4rem 0;
  font-size: .82rem;
  line-height: 1.4;
}
.psp-line__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem;
  min-height: 1.4rem; margin-bottom: .15rem;
}
.psp-line__text { font-weight: 500; }
.psp-line__foot { font-size: .78rem; }
/* L. 312-8 : l'avertissement doit être en caractères plus grands que les autres informations sur le financement */
.psp-line__warning { display: block; margin-bottom: .15rem; font-size: .9rem; font-weight: 600; }
.psp-line__more { display: inline-block; }
.psp-line__warning { opacity: .85; }
.psp-line__more {
  background: none; border: 0; padding: 0;
  font: inherit; text-decoration: underline; cursor: pointer; color: inherit;
}

/* Rotation entre prestataires */
/* Toutes les lignes sont empilées dans la même cellule : la hauteur du bloc
   est celle de la ligne la plus haute et ne change pas pendant la rotation. */
.psp-lines--slide { display: grid; }
.psp-lines--slide .psp-line {
  grid-area: 1 / 1; margin: 0;
  visibility: hidden; opacity: 0; transition: opacity .4s ease, visibility 0s linear .4s;
}
.psp-lines--slide .psp-line.is-visible {
  visibility: visible; opacity: 1; transition: opacity .4s ease, visibility 0s;
}

/* Flèches et puces (mode rotation) */
.psp-lines--nav { position: relative; padding: 0 1.75rem; }
.psp-nav {
  position: absolute; top: calc(50% - .35rem); transform: translateY(-50%); z-index: 1;
  width: 1.5rem; height: 1.5rem; padding: 0; border: 1px solid rgba(0,0,0,.25); border-radius: 50%;
  background: #fff; color: #111; font-size: 1rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.psp-nav:hover { border-color: #111; }
.psp-nav--prev { left: 0; }
.psp-nav--next { right: 0; }
.psp-dots { grid-row: 2; display: flex; justify-content: center; gap: .4rem; margin: .45rem 0 0; }
.psp-dot {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.2); cursor: pointer;
}
.psp-dot.is-active { background: #111; }
/* Panier / commande : flèches à l'intérieur de l'encadré */
.pierrot-splitpay--cart .psp-lines.psp-lines--nav,
.pierrot-splitpay--checkout .psp-lines.psp-lines--nav { padding: .75rem 2.5rem; }
.pierrot-splitpay--cart .psp-nav--prev,
.pierrot-splitpay--checkout .psp-nav--prev { left: .5rem; }
.pierrot-splitpay--cart .psp-nav--next,
.pierrot-splitpay--checkout .psp-nav--next { right: .5rem; }

/* Checkout : espace avec le récapitulatif et la réassurance */
.pierrot-splitpay[data-hook="summary"] { margin: 1rem 0 1.5rem; }

/* Panier / checkout : lignes centrées dans un encadré */
.pierrot-splitpay--cart .psp-line,
.pierrot-splitpay--checkout .psp-line { text-align: center; }
.pierrot-splitpay--cart .psp-line__head,
.pierrot-splitpay--checkout .psp-line__head { justify-content: center; }

.pierrot-splitpay--cart,
.pierrot-splitpay--checkout { margin: 1rem 0; }
.pierrot-splitpay--cart .psp-lines,
.pierrot-splitpay--checkout .psp-lines {
  padding: .75rem 1rem;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 6px;
}
.pierrot-splitpay--cart .psp-lines:not(.psp-lines--slide) .psp-line + .psp-line,
.pierrot-splitpay--checkout .psp-lines:not(.psp-lines--slide) .psp-line + .psp-line {
  border-top: 1px dashed rgba(0, 0, 0, .12);
  padding-top: .5rem;
}

/* ---------- Logos ---------- */
.psp-logo { display: inline-flex; align-items: center; vertical-align: middle; }
.psp-logo img { height: 18px; width: auto; display: block; }
.psp-logo--klarna img { height: 24px; }
.psp-line__amount { font-weight: 700; }
.psp-logo--badge {
  font-weight: 700; font-size: .78rem; letter-spacing: .02em;
  padding: .1rem .45rem; border-radius: 4px; color: #fff;
}
.psp-logo--badge.psp-logo--alma   { background: var(--psp-alma); }
.psp-logo--badge.psp-logo--klarna { background: var(--psp-klarna); color: var(--psp-klarna-ink); }

/* ---------- Mentions légales sous la ligne ---------- */
.psp-legal-block { font-size: .7rem; line-height: 1.4; opacity: .65; margin: .25rem 0 .75rem; }
.psp-legal-block p { margin: 0 0 .3rem; }

/* ---------- Popin (commun) ---------- */
.psp-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); padding: 1rem;
}
.psp-modal[hidden] { display: none; }
.psp-modal__dialog {
  position: relative; background: #fff; color: #111;
  max-height: 90vh; overflow: auto; border-radius: 12px;
  font-family: inherit; text-align: left;
}
.psp-modal__close {
  width: 32px; height: 32px; border: 0; cursor: pointer; font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
body.psp-modal-open { overflow: hidden; }

.psp-schedule { list-style: none; padding: 0; margin: 0 0 .75rem; }
.psp-schedule li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .4rem 0; font-size: .95rem;
}
.psp-schedule li:first-child { font-weight: 700; }
.psp-warning {
  margin: .75rem 0; padding: .6rem .75rem;
  border: 1px solid #111; font-size: 1.15rem; line-height: 1.3; font-weight: 700;
}
.psp-total {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: #f4f4f4; border-radius: 8px;
}
.psp-total__label { font-weight: 700; font-size: 1.1rem; }
.psp-total__amounts { text-align: right; font-weight: 700; font-size: 1.1rem; }
.psp-total__fees { font-weight: 600; font-size: .8rem; opacity: .8; }
.psp-legal { font-size: .72rem; line-height: 1.4; opacity: .7; margin: 1rem 0 0; }

/* ---------- Popin Alma ---------- */
.psp-alma {
  width: min(820px, 100%);
  padding: 2.25rem 2rem 2rem;
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 2.5rem;
}

.psp-alma .psp-modal__close {
  position: absolute; top: .75rem; right: .75rem;
  border-radius: 50%; background: #111; color: #fff;
}
.psp-alma__title {
  font-size: 1.5rem; line-height: 1.25; font-weight: 700; margin: 0 0 1.5rem;
  font-family: Georgia, "Times New Roman", serif;
}
.psp-alma__steps { list-style: none; padding: 0; margin: 0 0 2rem; }
.psp-alma__steps li { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.1rem; font-size: .92rem; line-height: 1.45; }
.psp-alma__num {
  flex: 0 0 auto; width: 1.6rem; font-size: 1.6rem; line-height: 1; font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
}
.psp-alma__steps li:nth-child(1) .psp-alma__num { color: var(--psp-alma); }
.psp-alma__steps li:nth-child(2) .psp-alma__num { color: var(--psp-alma-blue); }
.psp-alma__steps li:nth-child(3) .psp-alma__num { color: var(--psp-alma-yellow); }
.psp-alma__logo .psp-logo img { height: 26px; }
.psp-alma__tabs { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
.psp-alma__tab {
  min-width: 4.5rem; padding: .55rem 1.2rem; border-radius: 999px;
  border: 1.5px solid #111; background: #fff; color: #111;
  font-weight: 700; font-size: 1.05rem; cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
}
.psp-alma__tab.is-active { background: var(--psp-alma); border-color: var(--psp-alma); color: #fff; }
.psp-alma .psp-schedule li { position: relative; padding-left: 1.25rem; }
.psp-alma .psp-schedule li::before {
  content: ""; position: absolute; left: 0; top: .85rem;
  width: 8px; height: 8px; border-radius: 50%; background: #fbd3c6;
}
.psp-alma .psp-schedule li:first-child::before { background: var(--psp-alma); }
.psp-alma .psp-warning { border-color: var(--psp-alma); }

/* ---------- Popin Klarna ---------- */
.psp-klarna { width: min(640px, 100%); padding: 1.75rem 1.75rem 1.5rem; position: relative; }
.psp-klarna__logo { margin: 0 0 .75rem; }
.psp-klarna__logo .psp-logo img { height: 30px; }
.psp-klarna .psp-klarna__head .psp-modal__close { position: absolute; top: 1.25rem; right: 1.25rem; }
.psp-klarna__title { padding-right: 2.5rem; }
.psp-klarna__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .75rem; }
.psp-klarna__title { font-size: 1.35rem; font-weight: 600; margin: 0; line-height: 1.3; }
.psp-klarna .psp-modal__close { border-radius: 6px; background: #fff; border: 1.5px solid var(--psp-klarna-ink); color: var(--psp-klarna-ink); }
.psp-klarna__price { font-size: .85rem; font-weight: 600; opacity: .7; margin: 0 0 .75rem; }
.psp-klarna__intro { font-size: .95rem; margin: 0 0 1rem; line-height: 1.5; }
.psp-klarna__option {
  background: #f5f5f5; border-radius: 8px; padding: .9rem 1rem; margin-bottom: .6rem;
  cursor: pointer; border: 1.5px solid transparent; transition: border-color .15s;
}
.psp-klarna__option:hover { border-color: var(--psp-klarna); }
.psp-klarna__option.is-open { border-color: var(--psp-klarna); background: #fff; }
.psp-klarna__option-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .95rem; }
.psp-klarna__option-total { font-size: .82rem; opacity: .7; margin-top: .35rem; }
.psp-klarna__option-detail { display: none; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid #eee; }
.psp-klarna__option.is-open .psp-klarna__option-detail { display: block; }
.psp-klarna .psp-schedule li:first-child { color: #e0527f; }
.psp-klarna .psp-warning { border-color: var(--psp-klarna); }
.psp-klarna .psp-total { background: #fff0f4; }
.psp-klarna__legal { background: #f5f5f5; border-radius: 8px; padding: .75rem 1rem; opacity: 1; color: #666; }

/* ---------- Mentions légales en pied de page ---------- */
.pierrot-splitpay-footer { padding: .75rem 0; color: #000; }
.pierrot-splitpay-footer p,
.pierrot-splitpay-footer strong { font-size: 10px; line-height: 1.4; color: #000; margin: 0 0 .25rem; }
/* L. 312-8 : l'avertissement reste plus grand que le reste des mentions */
.pierrot-splitpay-footer .psp-footer__warning { font-size: 12px; font-weight: 700; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .psp-alma { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.5rem 1.25rem 1.25rem; }
  /* Mobile : logo en tête, titre et étapes plus compacts */
  .psp-alma__left { display: flex; flex-direction: column; }
  .psp-alma__logo { order: -1; margin: 0 0 .75rem; }
  .psp-alma__logo .psp-logo img { height: 22px; }
  .psp-alma__title { font-size: 1.25rem; margin: 0 2.5rem 1rem 0; }
  .psp-alma__steps { margin: 0; }
  .psp-alma__steps li { margin-bottom: .7rem; font-size: .88rem; }
  .psp-alma__num { font-size: 1.3rem; }
  .psp-alma__tab { min-width: 3.8rem; padding: .45rem 1rem; font-size: .95rem; }
  .psp-klarna { padding: 1.25rem; }
  .psp-klarna__title { font-size: 1.15rem; }
  .psp-klarna__logo .psp-logo img { height: 26px; }
  .psp-total__amounts .psp-total__fees { white-space: nowrap; }
}

/* Fiche produit : bloc centré */
.pierrot-splitpay:not([data-context]) .psp-line,
.pierrot-splitpay[data-context^="product"] .psp-line { text-align: center; }
.pierrot-splitpay:not([data-context]) .psp-line__head,
.pierrot-splitpay[data-context^="product"] .psp-line__head { justify-content: center; }

/* Côte à côte : une colonne par prestataire, avertissement commun en dessous */
.psp-lines--columns {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem;
}
.psp-lines--columns .psp-line {
  margin: 0; padding: .6rem .5rem; text-align: center;
  border: 1px solid rgba(0, 0, 0, .12); border-radius: 6px;
}
.psp-lines--columns .psp-line__head { flex-direction: column; justify-content: flex-start; gap: .3rem; }
/* Alignement des deux cartes : 3 lignes de texte, zone logo de hauteur fixe, lien en dessous */
.psp-lines--columns .psp-line__text { display: block; }
.psp-lines--columns .psp-row { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psp-lines--columns .psp-line__head .psp-logo { height: 28px; display: flex; align-items: center; justify-content: center; }
.psp-lines--columns .psp-line__foot { margin-top: .15rem; }
.psp-lines--columns .psp-columns__warning { grid-column: 1 / -1; text-align: center; margin: .2rem 0 0; }
/* Panier / commande : l'encadré global disparaît, chaque offre a son cadre */
.pierrot-splitpay--cart .psp-lines.psp-lines--columns,
.pierrot-splitpay--checkout .psp-lines.psp-lines--columns { border: 0; padding: 0; }
.pierrot-splitpay--cart .psp-lines.psp-lines--columns .psp-line + .psp-line,
.pierrot-splitpay--checkout .psp-lines.psp-lines--columns .psp-line + .psp-line { border-top: 1px solid rgba(0, 0, 0, .12); padding-top: .6rem; }
@media (max-width: 480px) {
  /* Mobile : on garde les 2 colonnes, en plus compact */
  .psp-lines--columns { gap: .4rem; }
  .psp-lines--columns .psp-line { padding: .5rem .35rem; font-size: .76rem; }
  .psp-lines--columns .psp-logo img { height: 16px; }
  .psp-lines--columns .psp-logo--klarna img { height: 20px; }
}
@media (max-width: 330px) {
  .psp-lines--columns { grid-template-columns: 1fr; }
}
