/* ── HOMEPAGE DYNAMIC MANAGEMENT SYSTEM STYLES ───────────────────── */

/* ── HOMEPAGE GRID LAYOUT ─────────────────────────────────────────── */
.homepage-dynamic {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  /* L'espacement VERTICAL entre blocs est désormais réglable PAR BLOC
     (voir row_gap_px / margin-bottom posé sur .homepage-block dans
     homepage.js createBlockShell) plutôt que par un seul espacement
     global — d'où row-gap: 0 ici. Le column-gap (espace horizontal entre
     deux blocs côte à côte sur une même ligne de la grille) reste fixe. */
  column-gap: 6px;
  row-gap: 0;
  width: 100%;
  padding: 6px 6px 0;
}

/* ── BLOCK SIZING ───────────────────────────────────────────────── */
.homepage-block.size-small {
  grid-column: span 4;
}

.homepage-block.size-medium {
  grid-column: span 6;
}

.homepage-block.size-large {
  grid-column: span 8;
}

.homepage-block.size-full {
  grid-column: span 12;
}

/* ── RESPONSIVE BREAKPOINTS ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .homepage-block.size-small,
  .homepage-block.size-medium,
  .homepage-block.size-large {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .homepage-block.size-small,
  .homepage-block.size-medium,
  .homepage-block.size-large,
  .homepage-block.size-full {
    grid-column: span 12;
  }

  /* Apply mobile grid positioning if specified */
  .homepage-block[data-mobile-grid-area] {
    grid-column: auto;
    grid-row: auto;
  }

  .homepage-block[data-mobile-grid-area="hero"] {
    grid-column: span 12;
  }

  .homepage-block[data-mobile-grid-area="promo-section"] {
    grid-column: span 12;
  }

  .homepage-block[data-mobile-grid-area="promo-left"] {
    grid-column: span 12;
  }

  .homepage-block[data-mobile-grid-area="promo-right"] {
    grid-column: span 12;
  }

  .homepage-block[data-mobile-grid-area="flash-section"] {
    grid-column: span 12;
  }
}

/* ── DYNAMIC BANNER ─────────────────────────────────────────────── */
.dynamic-banner {
  border-radius: var(--hp-radius, var(--r12));
  overflow: hidden;
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dynamic-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.dynamic-banner h3 {
  font-size: clamp(1rem, 2vw, 1.4rem);
  line-height: 1.3;
}

.dynamic-banner p {
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  line-height: 1.5;
}

/* ── PROMO CAROUSEL ─────────────────────────────────────────────── */
.promo-carousel,
.promo-flash-carousel {
  border-radius: var(--hp-radius, var(--r12));
  overflow: hidden;
  position: relative;
  background: var(--dark-2);
  min-height: 300px;
}

.promo-flash-carousel {
  background: linear-gradient(135deg, #1a0800, #8b2000, #2d1500);
}

.flash-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--red);
  color: #fff;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: flashPulse 1.5s ease-in-out infinite;
}

@keyframes flashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ── CAROUSEL TRACK ─────────────────────────────────────────────── */
.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  padding: 20px;
}

.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── PROMO PRODUCT CARD ─────────────────────────────────────────── */
.promo-product-card {
  background: #fff;
  border-radius: var(--hp-radius, var(--r12));
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  max-width: 280px;
  width: 100%;
  transition: transform 0.2s;
}

.promo-product-card:hover {
  transform: translateY(-4px);
}

.promo-product-card.flash-card {
  border: 2px solid var(--red);
}

.promo-product-card .prod-img {
  position: relative;
  overflow: hidden;
}

.prod-x2-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--gold);
  color: #1a0f00;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  z-index: 5;
}

.flash-badge-small {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--red);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  z-index: 5;
}

/* ── CAROUSEL CONTROLS ───────────────────────────────────────────── */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--gray-200);
  color: var(--gray-700);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.carousel-arrow:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 4px 16px rgba(227, 29, 26, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.carousel-arrow.prev {
  left: 12px;
}

.carousel-arrow.next {
  right: 12px;
}

.carousel-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 20;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.7);
}

.carousel-dot.active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

/* ── RESPONSIVE CAROUSEL ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .carousel-arrow {
    width: 36px;
    height: 36px;
  }

  .carousel-arrow.prev {
    left: 8px;
  }

  .carousel-arrow.next {
    right: 8px;
  }

  .promo-product-card {
    max-width: 240px;
  }

  .carousel-slide {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .promo-carousel,
  .promo-flash-carousel {
    min-height: 260px;
  }

  .carousel-track {
    min-height: 260px;
  }

  .promo-product-card {
    max-width: 200px;
  }

  .carousel-dots {
    bottom: 12px;
  }

  .carousel-dot {
    width: 6px;
    height: 6px;
  }

  .carousel-dot.active {
    width: 18px;
  }
}

/* ── NOTE ────────────────────────────────────────────────────────
   L'ancien système "grid_area" (zones nommées façon CSS Grid
   Template Areas) n'a jamais été fonctionnel : aucun
   grid-template-areas n'était défini nulle part, donc les classes
   .hero/.hero-sidebar/.promo-section/etc. définies ici plus bas
   dans l'ancienne version étaient à la fois inutiles ET dangereuses
   (elles portaient les MÊMES noms que les vraies classes utilisées
   par la page d'accueil statique — .hero, .hero-sidebar — et
   pouvaient donc leur appliquer des styles involontaires).
   Le nouveau système utilise desktop_columns / mobile_columns
   (voir homepage.js) : plus simple, prévisible, et réellement
   appliqué via grid-column inline sur chaque bloc. */

/* ── TRANSITION ANIMATIONS ───────────────────────────────────────── */
.homepage-block {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── LOADING STATE ─────────────────────────────────────────────── */
.homepage-block.loading {
  min-height: 200px;
  background: var(--gray-100);
  border-radius: var(--hp-radius, var(--r12));
  display: flex;
  align-items: center;
  justify-content: center;
}

.homepage-block.loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── SKELETON (affiché pendant le chargement / avant hydratation) ── */
.hp-skeleton {
  min-height: 220px;
  border-radius: var(--hp-radius, var(--r12));
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
  background-size: 400% 100%;
  animation: hpSkeletonShine 1.4s ease infinite;
}

@keyframes hpSkeletonShine {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── SECTION HEADER (utilisé par les blocs product_row) ──────────── */
.hp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.hp-section-header h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--dark);
}

/* ── PRODUCT ROW (ligne de produits en défilement continu) ───────── */
.product-row-wrap {
  position: relative;
  min-width: 0;
}

.product-row-track {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: var(--hp-product-gap, 6px);
  padding: 5px 4px 15px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.product-row-track::-webkit-scrollbar {
  display: none;
}

.product-row-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--hp-radius, var(--r12));
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.product-row-card .prod-img {
  aspect-ratio: unset;
  padding: 0;
}

@media (max-width: 480px) {
  .product-row-card .prod-img {
    height: 110px !important;
  }
}

