/* Page livraison (delivery.html)
   - grid : choix des cartes à gauche, récapitulatif à droite
   - flex : chaque ligne du récapitulatif (texte à gauche, valeur à droite) */

.delivery-page {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.delivery-intro {
  text-align: center;
  margin-bottom: 32px;
}

.delivery-page h2 {
  margin-top: 0;
  text-align: left;
}

/* ---------- Deux colonnes → GRID ---------- */

.delivery-layout {
  display: grid;
  grid-template-columns: 1fr 380px;   /* le récap garde une largeur fixe */
  gap: 24px;
  align-items: start;
}

.delivery-select,
.delivery-summary {
  padding: 24px;
  background-color: #1a1d27;
  border: 1px solid #2a2e3a;
  border-radius: 12px;
}

/* ---------- Choix du nombre de cartes ---------- */

.delivery-select label {
  display: block;
  margin-bottom: 8px;
  color: #e7eaf4;
  font-weight: bold;
}

#card-count {
  width: 100%;
  max-width: 200px;
  padding: 10px 14px;
  border: 1px solid #2a2e3a;
  border-radius: 8px;
  background-color: #0f1117;
  color: #ffffff;
  font-size: 1.2rem;
}

#card-count:focus {
  outline: 2px solid #eab711;
  border-color: transparent;
}

.delivery-select .premium-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  font-weight: normal;
  cursor: pointer;
}

.premium-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #eab711;              /* case cochée en jaune TwinCard */
}

/* ---------- Récapitulatif ---------- */

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #2a2e3a;
  color: #e7eaf4;
}

.summary-total strong {
  font-size: 1.6rem;
  color: #eab711;
}

/* Barre de progression vers la fin de la tranche */
.tier-bar {
  height: 10px;
  margin-top: 20px;
  background-color: #2a2e3a;
  border-radius: 999px;
  overflow: hidden;
}

.tier-fill {
  width: 0%;                          /* modifié en JS */
  height: 100%;
  background-color: #eab711;
  border-radius: 999px;
  transition: width 0.3s ease;        /* la barre glisse au lieu de sauter */
}

.delivery-page .tier-text {
  margin: 20px 0 0;
  font-size: 0.85rem;
  color: #9aa0ad;
  text-align: right;
}

.delivery-page .delivery-message {
  margin: 16px 0;
  color: #12b5f0;
  font-weight: bold;
}

.delivery-page .delivery-error {
  margin: 0 0 16px;
  color: #ff6b6b;
}

#confirm-delivery {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

#confirm-delivery:disabled {
  background-color: #2a2e3a;
  color: #6b7080;
  cursor: not-allowed;
}

/* ---------- Tableau des prix ---------- */

.delivery-prices {
  margin-top: 48px;
}

/* ---------- Mobile : le récap passe sous le choix ---------- */

@media (max-width: 760px) {
  .delivery-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Animation de confirmation (prototype, js/delivery_anim.js) ---------- */

.ship-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(30, 34, 48, 0.96), rgba(5, 6, 10, 0.98) 70%);
}

.ship-overlay[hidden] {
  display: none;                  /* sinon "display: flex" empêcherait l'attribut hidden de cacher l'overlay */
}

.ship-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  color: #e7eaf4;
  text-align: center;
}

.ship-status {
  min-height: 3em;                /* garde la place quand le texte change */
  max-width: 420px;
  color: #c9cdd8;
}

/* La scène : la carte en haut, le colis en bas. "isolation" crée un repère pour les z-index :
   la carte (z 1) passe devant le fond du colis (z 0) mais derrière sa poche avant (z 2). */
.ship-scene {
  position: relative;
  isolation: isolate;
  width: 260px;
  height: 420px;
}

.ship-card {
  position: absolute;
  top: 0;
  left: 55px;                     /* centrée : (260 - 150) / 2 */
  z-index: 1;
  width: 150px;
}

.ship-card > img {
  width: 100%;
  height: auto;
}

/* Pastille du nombre de cartes envoyées */
.ship-count {
  position: absolute;
  right: -10px;
  top: -10px;
  padding: 2px 10px;
  border-radius: 999px;
  background-color: #eab711;
  color: #0f1117;
  font-weight: bold;
}

/* La carte descend dans le colis en rapetissant, puis disparaît derrière la poche avant */
.ship-card.into-parcel {
  animation: rangement 0.9s ease-in forwards;
}

@keyframes rangement {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  70%  { transform: translateY(230px) scale(0.75); opacity: 1; }
  100% { transform: translateY(280px) scale(0.7); opacity: 0; }
}

/* Le colis */
.parcel {
  position: absolute;
  bottom: 0;
  left: 20px;
  width: 220px;
  height: 140px;
}

.parcel-back {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 2px solid #eab711;
  border-radius: 10px;
  background-color: #12141c;
}

.parcel-front {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 75%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid #eab711;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(160deg, #1a1d27, #0f1117);
  font-size: 1.3rem;
  font-weight: bold;
}

.parcel-front .twin { color: #eab711; }
.parcel-front .card { color: #12b5f0; }

/* Le rabat : un triangle accroché en haut. Ouvert, il est retourné vers le haut (derrière la carte) ;
   fermé, il se rabat devant tout. */
.parcel-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  height: 60%;
  transform-origin: top;
  transform: perspective(600px) rotateX(180deg);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(to bottom, #eab711, #9c7608);
  transition: transform 0.45s ease;
}

.parcel.closed .parcel-flap {
  z-index: 3;
  transform: perspective(600px) rotateX(0deg);
}

/* Le colis part vers la droite */
.parcel.sent {
  animation: envoi 0.9s ease-in forwards;
}

@keyframes envoi {
  0%   { transform: translateX(0) rotate(0deg); opacity: 1; }
  20%  { transform: translateX(-20px) rotate(-3deg); opacity: 1; }   /* petit élan en arrière */
  100% { transform: translateX(120vw) rotate(6deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ship-card.into-parcel,
  .parcel.sent {
    animation: none;
    opacity: 0;
  }

  .parcel-flap {
    transition: none;
  }
}
