/* =====================================================
   CSS COMPLET POUR LES PAGES D'ARTICLES - C-N Store
   ===================================================== */

/* ---- Conteneurs et Titres ---- */
.article-list-container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 1rem; 
}

.article-banner { 
  position: relative; 
  width: 100%; 
  height: 250px; 
  border-radius: 1rem; 
  overflow: hidden; 
  margin-bottom: 2.5rem; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  box-shadow: 0 8px 20px rgba(0,0,0,0.3); 
}

.banner-background { 
  position: absolute; 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  filter: brightness(0.4); 
}

.banner-content { 
  position: relative; 
  z-index: 2; 
  color: #fff; 
  text-align: center; 
  text-shadow: 0 2px 8px rgba(0,0,0,0.7); 
}

.banner-content h1 { 
  font-size: 2.5rem; 
  margin: 0 0 0.5rem 0; 
}

.banner-content p { 
  font-size: 1.2rem; 
  opacity: 0.9; 
}

.product-section h2 { 
  font-size: 1.8rem; 
  color: #f0f0f0; 
  margin-bottom: 1.5rem; 
  border-left: 4px solid #ffd700; 
  padding-left: 1rem; 
}

.back-button { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  margin-bottom: 1.5rem; 
  padding: 10px 18px; 
  background: rgba(255, 255, 255, 0.1); 
  color: #f0f0f0; 
  border: 1px solid rgba(255, 255, 255, 0.2); 
  border-radius: 25px; 
  text-decoration: none; 
  font-weight: bold; 
  font-size: 0.9rem; 
  backdrop-filter: blur(10px); 
  transition: all 0.3s ease; 
}

.back-button:hover { 
  background: rgba(255, 255, 255, 0.2); 
  color: #ffffff; 
  transform: translateY(-3px); 
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); 
}

/* ---- Grille des produits ---- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

/* ---- Carte d'article ---- */
.article-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.article-card-image-wrapper {
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.article-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.article-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 0.5rem 0;
  flex-grow: 1;
}

/* Conteneur pour le prix et le statut */
.price-and-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.article-card-price {
  font-size: 1.4rem;
  font-weight: bold;
  color: #ffd700;
  margin: 0;
}

/* Style du badge de statut */
.article-status {
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-status.available {
  background-color: #28a745;
  box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
}

.article-status.unavailable {
  background-color: #dc3545;
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.5);
}

.article-card-stock {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: #28a745;
  box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
}

/* Style pour la carte entière quand l'article est indisponible */
.article-card.unavailable .article-card-image {
  filter: grayscale(80%);
  opacity: 0.5;
}

/* --- Conteneur pour le pied de la carte --- */
.article-card-footer {
  margin-top: auto;
  padding-top: 1rem;
}

/* --- Conteneur pour les deux boutons --- */
.article-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Si le bouton "Détails" n'existe pas, le bouton "Acheter" prend toute la place */
.article-card-actions:has(:not(.btn-details)) {
  grid-template-columns: 1fr;
}

/* --- Style commun aux deux boutons --- */
.btn-details, .btn-buy {
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* --- Style spécifique au bouton "Détails" --- */
.btn-details {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-details:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* --- Style spécifique au bouton "Acheter" --- */
.btn-buy {
  background-color: #ffd700;
  color: #111;
}

.btn-buy:hover {
  background-color: #e0c000;
  transform: scale(1.05);
}

/* Style pour le bouton d'achat désactivé */
.btn-buy:disabled,
.btn-buy[disabled] {
  background-color: #444;
  border-color: #555;
  color: #888;
  cursor: not-allowed;
}

.btn-buy:disabled:hover,
.btn-buy[disabled]:hover {
  background-color: #444;
  transform: none;
}

/* --- Panneau de description qui apparaît --- */
.article-card-description-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #2a2a2a;
  padding: 1rem;
  border-top: 2px solid #ffd700;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out, visibility 0.3s;
  visibility: hidden;
  max-height: 150px;
  overflow-y: auto;
  z-index: 10;
}

/* La classe 'visible' est ajoutée par le JS pour montrer le panneau */
.article-card-description-panel.visible {
  transform: translateY(0);
  visibility: visible;
}

.article-card-description-panel p {
  color: #ccc;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* --- Bloc pour chaque catégorie --- */
.category-block {
  margin-bottom: 3rem;
  padding: 2rem;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.category-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #f0f0f0;
  border-left: 5px solid #ffd700;
  padding-left: 1rem;
}

/* --- Titre principal caché (pour le SEO) --- */
.visually-hidden {
  position: absolute;
  width: 1px; 
  height: 1px;
  padding: 0; 
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- Section des articles populaires --- */
.articles-populaires-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.main-title {
  font-size: 2.5rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 2.5rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Style pour le stock dans la modale */
.modal-stock {
  font-size: 1rem;
  font-weight: 500;
  color: #ffd700;
  margin-top: -10px;
  margin-bottom: 15px;
  text-align: center;
}

/* =============================================== */
/* ANIMATIONS POUR STOCK TEMPS REEL */
/* =============================================== */

/* Animation pour le flash de mise à jour */
@keyframes stockUpdateFlash {
  0% { background-color: transparent; }
  50% { background-color: rgba(40, 167, 69, 0.1); }
  100% { background-color: transparent; }
}

/* Animation pour le pulse d'alerte */
@keyframes stockPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Classe appliquée pendant la mise à jour */
.stock-updating {
  animation: stockUpdateFlash 1s ease, stockPulse 1s ease;
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Style pour stock faible (≤ 3) */
.stock-low {
  color: #ff6b6b !important;
  font-weight: bold !important;
  position: relative;
  animation: stockPulse 2s infinite;
}

/* Style pour rupture de stock */
.stock-out {
  color: #dc3545 !important;
  font-weight: bold !important;
  text-decoration: line-through;
}

/* Indicateur de mise à jour en direct (optionnel) */
.live-stock-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #28a745;
  margin-left: 8px;
  vertical-align: middle;
}

.live-stock-indicator::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* =============================================== */
/* RESPONSIVE DESIGN */
/* =============================================== */
@media (max-width: 768px) {
  .article-banner {
    height: 200px;
  }
  
  .banner-content h1 {
    font-size: 1.8rem;
  }
  
  .banner-content p {
    font-size: 1rem;
  }
  
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  .article-card-title {
    font-size: 1rem;
  }
  
  .article-card-price {
    font-size: 1.2rem;
  }
  
  .category-block {
    padding: 1.5rem;
  }
  
  .category-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .article-banner {
    height: 150px;
  }
  
  .banner-content h1 {
    font-size: 1.5rem;
  }
  
  .article-card-actions {
    grid-template-columns: 1fr;
  }
}
/* Styles pour les boutons de description et détails */
.article-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-description, .btn-detail-data {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 80px;
}

.btn-description {
    background: #4a5568;  /* Gris foncé */
    color: white;
}

.btn-description:hover {
    background: #2d3748;
}

.btn-detail-data {
    background: #3182ce;  /* Bleu */
    color: white;
}

.btn-detail-data:hover {
    background: #2c5282;
}

.btn-buy {
    background: #ffd700;  /* Jaune/or */
    color: #000;
    font-weight: bold;
}

.btn-buy:disabled {
    background: #4a5568;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Panneau de description temporaire */
.article-card-description-panel {
    display: none;
    background: #2a2a2a;
    padding: 15px;
    margin-top: 10px;
    border-radius: 8px;
    border-left: 4px solid #ffd700;
    animation: slideDown 0.3s ease;
}

.article-card-description-panel.visible {
    display: block;
}

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