/**
 * BWA Cart Donation - Frontend CSS
 *
 * @author BWA Development
 * @version 1.0.0
 */

/* Container principal */
#bwa-donation-container {


  /*background: #f8f9fa;*/
  /*border: 1px solid #dee2e6;*/
  margin-top: 0.1rem;
  margin-bottom: 0.1rem;
  transition: all 0.3s ease;
}

#bwa-donation-total-container {
  background-color: #ffeb6c;
  margin-top: 0.1rem;
  margin-bottom: 0.1rem;
}

/*#bwa-donation-total-container .donation-total-wrapper {*/
/*  display: flex;*/
/*}*/

.donation-total {
  float: right;
  margin: 2px;
}
.donation-description {
  margin: 2px;
}


#bwa-donation-container .card-title {
  color: #e91e63;
  font-weight: 500;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#bwa-donation-container .card-title .material-icons {
  font-size: 1.2rem;
}

/* Description du don */
.donation-description {
  color: #1e1e20;
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 400;
}


/* listing */
.product-price-and-shipping + .gain-asso {
  display: flex;
  text-align: left;
  background-color: #ffeb6c;
  margin-left: 20px;
  padding: 4px;
  color: #0a0a0a;
  font-size: 14px;
  width: fit-content;
  font-style: italic;
  font-weight: 500;
  border-radius: 2px;
  border: 1px solid #f0f0f0;
}

/* page produit */
#product .gain-asso {
  display: flex;
  text-align: left;
  background-color: #ffeb6c;
  padding: 4px;
  font-size: 14px;
  width: fit-content;
  font-style: italic;
  font-weight: 500;
  border-radius: 2px;
  border: 1px solid #f0f0f0;
}

/* page panier */
#cart .donation-gain {
  display: flex;
  text-align: left;
  background-color: #ffeb6c;
  padding: 4px;
  font-size: 14px;
  width: fit-content;
  font-style: italic;
  font-weight: 500;
  border-radius: 2px;
  border: 1px solid #f0f0f0;
}

.cart-summary-mobile .donation-inline-container {
  display: none;
}

  /* Sélecteur de don */
#bwa-donation-select,
#bwa-donation-select-inline {
  background: white;
  border: 1px solid var(--main-color);
  /*border-radius: 4px;*/
  padding: 0.1rem 0.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--main-color);
  line-height: 20px;
  font-family: Roboto, sans-serif;
  font-weight: 400;
  text-align: right;


}
#bwa-donation-select option {
  padding-right: 0.5rem;
}

#bwa-donation-select:hover,
#bwa-donation-select-inline:hover {
  /*border-color: #d81b60;
  box-shadow: 0 0 0 0.2rem rgba(233, 30, 99, 0.25);*/
}

#bwa-donation-select:focus,
#bwa-donation-select-inline:focus {
  /*border-color: #d81b60;
  box-shadow: 0 0 0 0.2rem rgba(233, 30, 99, 0.25);*/
  outline: none;
}

#bwa-donation-select:disabled,
#bwa-donation-select-inline:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f8f9fa;
}

/* Version inline pour le checkout */
.donation-inline-container {
  border-top: 1px solid #dee2e6;
  padding-top: 1rem;
  margin-top: 1rem;
}

.donation-inline-container + .card-block {
  padding: 0 0 1.2rem 0 !important;
}

.donation-line {
  padding: 0.75rem 0;
  font-size: 1rem;
}

.donation-line .label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #495057;
  padding: 0.5rem 0;
  font-weight: 500;
}

.donation-line .material-icons {
  color: #e91e63;
  font-size: 1.2rem;
}

.donation-select-inline {
  max-width: 120px;
  margin-left: auto;
  padding: 0.25rem 0.5rem;
  font-size: 0.95rem;
}

/* Indicateur de chargement */
#donation-loading {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
  color: #6c757d;
}

#donation-loading .spinner-border {
  width: 1.5rem;
  height: 1.5rem;
  border-width: 0.2rem;
}

/* Messages */
#donation-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideDown 0.3s ease;
}

#donation-message .material-icons {
  font-size: 1.2rem;
}

#donation-message.alert-success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

#donation-message.alert-danger {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

#donation-message.alert-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

#donation-message.alert-info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  #bwa-donation-container .row {
    flex-direction: column;
  }

  #bwa-donation-container .col-md-8,
  #bwa-donation-container .col-md-4 {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0.5rem;
  }

  #bwa-donation-select {
    width: 100%;
  }

  .donation-line {
    flex-wrap: nowrap;
  }

  .donation-select-inline {
    max-width: 100px;
    font-size: 0.875rem;
  }
}

/* Intégration avec le thème PrestaShop Classic */
.cart-detailed-totals #bwa-donation-inline {
  background: white;
  padding: 0;
  /*margin-bottom: 0.5rem;*/
}

/* Style pour le checkout en une page */
.checkout-step #bwa-donation-container {
  margin: 1rem 0;
  padding: 1rem;
}

/* Ajustements pour différents thèmes */
body.theme-dark #bwa-donation-container {
  background: #2c2c2c;
  border-color: #444;
  color: #fff;
}

body.theme-dark #bwa-donation-select,
body.theme-dark #bwa-donation-select-inline {
  background: #1a1a1a;
  color: #fff;
  border-color: #e91e63;
}

/* Badge de don actif */
.donation-active-badge {
  display: inline-block;
  background: #e91e63;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(233, 30, 99, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(233, 30, 99, 0);
  }
}

/* Effet de mise à jour des lignes du panier */
.cart-item.updated {
  background: #fff3cd !important;
  transition: background 0.3s ease;
}

.cart-item.updating {
  opacity: 0.6;
  pointer-events: none;
}

/* Animation de mise à jour des totaux */
.cart-total .value,
.cart-subtotal .value,
.cart-taxes .value {
  transition: color 0.3s ease, transform 0.2s ease;
}

.cart-total .value.updating,
.cart-subtotal .value.updating,
.cart-taxes .value.updating {
  color: #e91e63;
  transform: scale(1.05);
}

/* Loader inline pour les mises à jour AJAX */
.ajax-loader-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #e91e63;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Notification de mise à jour réussie */
.donation-update-success {
  position: fixed;
  top: 100px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 15px 20px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 1. Néon animé */
div.donation-card-block.style-neon {
  position: relative;
  padding: 1rem 1.5rem;
  background: #fffbe0;
  color: #333;
  border: 2px solid #0ff;
  box-shadow:
    0 0 8px rgba(0,255,255,0.6),
    0 0 16px rgba(0,255,255,0.4),
    inset 0 0 4px rgba(0,255,255,0.5);
  animation: neon-glow 2s ease-in-out infinite alternate;
}

@keyframes neon-glow {
  from {
    box-shadow:
      0 0 4px rgba(0,255,255,0.4),
      0 0 8px rgba(0,255,255,0.3),
      inset 0 0 2px rgba(0,255,255,0.4);
  }
  to {
    box-shadow:
      0 0 12px rgba(0,255,255,0.8),
      0 0 20px rgba(0,255,255,0.6),
      inset 0 0 6px rgba(0,255,255,0.7);
  }
}

/* 2. Dégradé animé */
div.donation-card-block.style-gradient {
  position: relative;
  padding: 1rem;
  background: #fffbe0;
  color: #333;
  border: 4px solid transparent;
  border-image:
    linear-gradient(
      90deg,
      #00f, #0ff, #0f0, #ff0, #f00, #f0f
    ) 1;
  animation: rotate-gradient 4s linear infinite;
}

@keyframes rotate-gradient {
  0%   { border-image: linear-gradient( 0deg, #00f, #0ff, #0f0, #ff0, #f00, #f0f ) 1; }
  100% { border-image: linear-gradient(360deg, #00f, #0ff, #0f0, #ff0, #f00, #f0f ) 1; }
}

/* 3. Effet “scan” technologique */
div.donation-card-block.style-scan {
  position: relative;
  padding: 1rem 1.5rem;
  background: #fffbe0;
  color: #333;
  overflow: hidden;
}

div.donation-card-block.style-scan::before,
div.donation-card-block.style-scan::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

div.donation-card-block.style-scan::before {
  border: 2px dashed rgba(255, 191, 0, 0.6);
  mix-blend-mode: screen;
  animation: scan-line 3s linear infinite;
}

div.donation-card-block.style-scan::after {
  background:
    linear-gradient(
      120deg,
      transparent 30%, rgba(255,191,0,0.6), transparent 70%
    );
  transform: translateX(-100%) skewX(-20deg);
  animation: sweep 4s ease-in-out infinite;
}

@keyframes scan-line {
  to { transform: translate(5px,5px); }
}
@keyframes sweep {
  to { transform: translateX(200%) skewX(-20deg); }
}

/* 4. Contour polygonal */
div.donation-card-block.style-polygon {
  position: relative;
  padding: 1rem;
  background: #fffbe0;
  color: #333;
}

div.donation-card-block.style-polygon::before {
  content: "";
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  background: #0ff;
  clip-path: polygon(
    10% 0%, 90% 0%, 100% 10%,
    100% 90%, 90% 100%, 10% 100%,
    0% 90%, 0% 10%
  );
  z-index: -1;
  filter: blur(2px);
}

