/* ==========================================================================
   POSTI POSTA - STYLES SPÉCIFIQUES DU POC (LILLE, SWIPE FILTRES, STRIPE & LOADER)
   Charte : Rouge Vermillon (#E00000), Écru (#FAF7F2), Or (#D4AF37), Anthracite (#1E1E1E)
   ========================================================================== */

:root {
  --color-red-stamp: #E00000;
  --color-red-stamp-hover: #b80000;
  --color-cream-vintage: #FAF7F2;
  --color-cream-darker: #f0ebe1;
  --color-dark-charcoal: #1E1E1E;
  --color-border-gold: #D4AF37;
  --color-gold-light: #f4e8c1;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-handwriting: 'Caveat', cursive, sans-serif;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-cream-vintage);
  color: var(--color-dark-charcoal);
  overflow-x: hidden;
}

.font-serif { font-family: var(--font-serif); }
.font-handwriting { font-family: var(--font-handwriting); }

/* ==========================================================================
   GESTION DES ÉTAPES DU PARCOURS UTILISATEUR (STEPPER & ALIGNEMENT HAUT STRICT)
   ========================================================================== */
main {
  display: block;
  width: 100%;
  flex: 1 0 auto;
}

.step-screen {
  display: none !important;
  opacity: 0;
  width: 100%;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.step-screen.active {
  display: block !important;
  opacity: 1 !important;
}

/* ==========================================================================
   CARTE INTERACTIVE LEAFLET (CONTENEUR STRICT & Z-INDEX HIÉRARCHIQUE)
   ========================================================================== */
.map-strict-wrapper {
  position: relative;
  height: 38vh;
  max-height: 400px;
  min-height: 280px;
  width: 100%;
  overflow: hidden;
  z-index: 1;
  background-color: #e5e7eb;
}

#lille-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Dégradés en fondu (Gradient Overlay) en haut et en bas de la carte */
.map-fade-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to bottom, #FAF7F2 0%, rgba(250, 247, 242, 0) 100%);
  pointer-events: none;
  z-index: 15;
}

.map-fade-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55px;
  background: linear-gradient(to top, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: 15;
}

/* Marqueurs personnalisés Leaflet avec radar pulsant */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

.borne-marker-pin {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.borne-marker-radar {
  position: absolute;
  inset: -6px;
  border-radius: 9999px;
  background-color: rgba(224, 0, 0, 0.35);
  animation: marker-pulse 2s infinite ease-out;
  pointer-events: none;
}

.borne-marker-body {
  position: relative;
  width: 38px;
  height: 38px;
  background: #ffffff;
  border: 2.5px solid var(--color-red-stamp);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(224, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.borne-marker-pin:hover .borne-marker-body {
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(224, 0, 0, 0.45);
}

@keyframes marker-pulse {
  0% { transform: scale(0.8); opacity: 0.9; }
  50% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(0.8); opacity: 0; }
}

/* ==========================================================================
   BOUTON CARRÉ SCANNER LE QR CODE
   ========================================================================== */
.qr-scan-card {
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.qr-scan-card::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #E00000, transparent);
  box-shadow: 0 0 10px #E00000;
  transition: top 0.4s ease;
}

.qr-scan-card:hover::after {
  top: 100%;
}

.qr-scan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(224, 0, 0, 0.2), 0 0 0 2px var(--color-red-stamp);
}

/* ==========================================================================
   CARROUSEL DÉFILANT CONTINU (INFINITE MARQUEE) PARTENAIRES POSTAUX
   ========================================================================== */
@keyframes marquee-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.marquee-container,
.marquee-wrapper {
  overflow: hidden;
  position: relative;
  width: 100%;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 2.5rem;
  animation: marquee-scroll 24s linear infinite;
  will-change: transform;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* ==========================================================================
   VITRINE CARTES POSTALES D'EXEMPLE & DUO HERO (EFFET TIRAGE PAPIER 350G)
   ========================================================================== */
.postcard-print-frame,
.sample-postcard-card {
  background: #ffffff;
  padding: 8px 8px 10px 8px; /* Liseré blanc régulier de 8px façon tirage d'art */
  border-radius: 2px; /* Angle net et droit coupé au massicot */
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  position: relative;
  user-select: none;
}

.postcard-print-frame:hover,
.sample-postcard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.08);
}

.postcard-print-media,
.sample-postcard-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 1px;
  overflow: hidden;
  background-color: #f7f5f0;
}

.postcard-print-media img,
.sample-postcard-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sample-postmark-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #1E1E1E;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  pointer-events: none;
}

/* ==========================================================================
   ZONE PHOTO & CARTE POSTALE RECTO (RATIO 10x15, PAPIER DÉCOUPÉ, MARGE BLANCHE 6px)
   ========================================================================== */
.card-preview-container {
  position: relative;
  width: 100%;
  max-width: 620px;
  aspect-ratio: 3 / 2; /* Format carte postale 10x15 horizontal */
  margin: 0 auto;
  background-color: #ffffff; /* Marge blanche papier découpé */
  padding: 6px; /* Marge blanche de 6px */
  border-radius: 2px; /* Angles nets type papier découpé */
  box-shadow: 0 12px 30px -6px rgba(28, 25, 23, 0.12), 0 4px 10px -2px rgba(28, 25, 23, 0.06); /* Ombre douce */
  touch-action: pan-y;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Zone intérieure de la carte (dans la marge blanche de 6px) */
.card-inner-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 1px;
}

/* État initial d'attente (Placeholder interactif avec texture papier écru) */
.card-placeholder-zone {
  width: 100%;
  height: 100%;
  background-color: #FAF7F2; /* Fond écru clair */
  background-image: radial-gradient(#e2dbce 0.75px, transparent 0.75px);
  background-size: 10px 10px; /* Subtile texture grain papier */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 12px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.card-placeholder-zone:hover {
  background-color: #f7f3eb;
}

.card-placeholder-zone.drag-over {
  background-color: #fff5f5 !important;
}

.card-placeholder-zone.drag-over .card-placeholder-dashed {
  border-color: #E00000 !important;
  background-color: rgba(224, 0, 0, 0.04);
}

.card-placeholder-dashed {
  width: 100%;
  height: 100%;
  border: 2px dashed #d6d3d1; /* border-neutral-300 / border-stone-300 */
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.card-placeholder-zone:hover .card-placeholder-dashed {
  border-color: #a8a29e;
}

/* Zone de la photo chargée */
.card-photo-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.card-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-svg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 1 !important;
  z-index: 20;
  object-fit: cover;
}

.swipe-hint-pill {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.82);
  backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

/* Boutons pilules des filtres */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}

/* État filtre actif */
.filter-pill.active {
  background-color: #E00000 !important;
  border-color: #E00000 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px -2px rgba(224, 0, 0, 0.35);
  transform: translateY(-1px);
}

/* État filtre actif mais non sélectionné */
.filter-pill.enabled:not(.active) {
  background-color: #ffffff;
  border: 1.5px solid #e7e5e4;
  color: #44403c;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.filter-pill.enabled:not(.active):hover {
  border-color: #E00000;
  color: #E00000;
  background-color: #fff9f8;
  transform: translateY(-1px);
}

/* État filtre désactivé (pas de photo) */
.filter-pill-disabled,
.filter-pill:disabled {
  background-color: #f5f5f4 !important;
  border: 1.5px solid #e7e5e4 !important;
  color: #a8a29e !important;
  cursor: not-allowed;
  opacity: 0.65;
}

/* Animation d'alerte photo requise (shake) */
@keyframes shakePlaceholder {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake-attention {
  animation: shakePlaceholder 0.4s ease-in-out;
}

/* ==========================================================================
   VERSO DE LA CARTE POSTALE (RATIO 10x15, PAPIER IVOIRE, LIGNES ESPACÉES)
   ========================================================================== */
.postcard-back-container {
  position: relative;
  width: 100%;
  max-width: 620px;
  aspect-ratio: 3 / 2; /* 10x15 cm standard horizontal */
  margin: 0 auto;
  background: #FFFDF9; /* Fond ivoire doux / papier vergé */
  border-radius: 2px; /* Papier découpé franc */
  padding: 16px 20px;
  box-shadow: 0 12px 30px -6px rgba(28, 25, 23, 0.12), 0 4px 10px -2px rgba(28, 25, 23, 0.06);
  border: 1px solid rgba(220, 215, 205, 0.7);
  display: grid;
  grid-template-columns: 1.15fr 1px 0.85fr;
  gap: 16px;
  user-select: none;
}

.postcard-back-divider-line {
  background: repeating-linear-gradient(
    to bottom,
    #cfc7b9,
    #cfc7b9 6px,
    transparent 6px,
    transparent 12px
  );
  width: 1px;
}

.stamp-slot-box {
  width: 72px;
  height: 90px;
  border-radius: 3px;
  overflow: hidden;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stamp-slot-box.has-stamp {
  border: 1px solid #16a34a;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

/* ==========================================================================
   CERCLE DE CHARGEMENT PROGRESSIF (STEP 5 IMPRESSION)
   ========================================================================== */
.progress-ring-circle {
  stroke: var(--color-red-stamp);
  stroke-dasharray: 440;
  stroke-dashoffset: 440;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.25s linear;
}

@keyframes checkmark-appear {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.checkmark-icon-animated {
  animation: checkmark-appear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Notation étoiles */
.star-rating-btn {
  color: #cbd5e1;
  transition: color 0.15s ease, transform 0.15s ease;
}

.star-rating-btn.active,
.star-rating-btn:hover {
  color: #fbbf24;
}
