/* mini-cart.css - Version Finale Consolidée */

:root {
  --Color_1: #202020;
  --Color_2: #EAEAEA;
  --Color_3: #9400D3;


  --insta-color: var(--accent);
  --color-primary: var(--accent);
  --Color_3: var(--accent);
}

/* --- ICÔNE DU PANIER --- */
#cartIcon {
  position: fixed;
  opacity: 0;
  top: 35px;
  right: 25px;
  width: 48px;
  height: 48px;
  background: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  color: var(--Color_2);
  transition: all 0.25s ease;
}

#cartIcon:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

#cartIcon::before {
  content: "🛒";
  font-size: 23px;
  filter: grayscale(1) brightness(0.7) sepia(1) hue-rotate(250deg) saturate(1);
}

#cartIcon span {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--Color_1);
  color: var(--Color_2);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}

/* --- NOUVEAU STYLE POPUP AVEC ANIMATION --- */
#cartPopup {
  /* Positionnement existant */
  position: fixed;
  top: 48px;
  right: 20px;
  width: 350px;
  max-height: 80vh;
  z-index: 10005;

  /* Look Moderne */
  background: rgba(15, 15, 16, 0.95);
  /* Semi-transparent */
  backdrop-filter: blur(15px);
  /* Effet de flou derrière */
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 20px;
  display: flex;
  flex-direction: column;

  /* ÉTAT INITIAL (CACHÉ) */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px) scale(0.95);
  /* Part d'un peu plus haut et plus petit */
  transition:
    opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.6s;

  transform-origin: top right;
  /* L'animation part de l'icône */
}

/* ÉTAT ACTIF (AFFICHÉ) */
#cartPopup.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Petit bonus : animation de la liste des items */
#cartItems>div {
  animation: fadeInSlide 0.5s ease forwards;
  opacity: 0;
}

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Force l'affichage flex pour la structure interne */
#cartPopup[style*="display: block"] {
  display: flex !important;
}

#cartPopup h4 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.4em;
  text-align: center;
  border-bottom: 1px solid #444;
  padding-bottom: 10px;
  flex-shrink: 0;
}

/* --- ZONE DES ARTICLES (SCROLLABLE) --- */
#cartItems {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 5px;
}

/* Style de la scrollbar */
#cartItems::-webkit-scrollbar {
  width: 5px;
}

#cartItems::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

#cartItems::-webkit-scrollbar-thumb {
  background: var(--Color_3);
  border-radius: 10px;
}

#cartItems .item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: center;
  position: relative;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.item-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-name {
  font-weight: 600;
  font-size: 0.95em;
  color: var(--Color_2);
}

.item-attributes {
  color: #aaa !important;
  font-size: 0.8em !important;
}

.item-price {
  font-weight: 700;
  color: var(--Color_2);
}

/* --- ÉLÉMENTS DE CHARGEMENT ET ACTIONS --- */
.loading-text {
  font-size: 0.9em;
  color: var(--Color_3);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.5;
  }
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  border: none;
  color: var(--Color_2);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  background: var(--Color_3);
}

.remove-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  background: none;
  border: none;
  cursor: pointer;
}

.remove-btn::before {
  content: "❌";
  color: #FF6161 !important;
  font-size: 1.1em;
}

/* --- FOOTER FIXE --- */
#cartTotal {
  text-align: right;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #444;
  font-weight: 700;
  flex-shrink: 0;
}

#checkoutBtn {
  width: 100%;
  padding: 12px;
  margin-top: 15px;
  background: var(--Color_3);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  #cartPopup {
    right: 10px;
    top: 50px;
  }

  #cartIcon {
    right: 8px;
    top: 25px;
  }
}

/* Style par défaut du prix dans le panier */
.item-price {
    display: block;
    margin-top: 5px;
    font-weight: bold;
}

/* Style spécifique quand il y a une promo */
.item-price.promo-active del {
    text-decoration: line-through;
    color: #999; /* Couleur grise pour le prix barré */
    font-size: 0.85em;
    margin-right: 8px;
    font-weight: normal;
}

.item-price.promo-active ins {
    text-decoration: none;
    color: #CC3333; /* Couleur rouge/accent pour le prix promo */
    font-weight: bold;
}

/* On s'assure que WooCommerce n'ajoute pas de styles parasites */
.item-price bdi {
    color: inherit;
}