/**
 * CustomerLogos - Styles front-office
 * Compatible Bootstrap 3/4, PrestaShop 1.7 default theme
 * Responsive, accessible, performant
 */

/* ============================================================
   SECTION GÉNÉRALE
   ============================================================ */
.cl-section {
  padding: 40px 0;
  overflow: hidden;
  position: relative;
}

.cl-section.cl-bg-transparent {
  background: transparent !important;
}

.cl-section-header {
  margin-bottom: 30px;
}

.cl-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cl-separator {
  width: 50px;
  height: 3px;
  background: #2196f3;
  margin: 0 auto;
  border-radius: 2px;
}

/* ============================================================
   LOGO CARD (commun à tous les modes)
   ============================================================ */
.cl-logo-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  transition: transform 0.25s ease;
  position: relative;
}

.cl-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.cl-logo-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

/* Niveaux de gris → couleur au hover */
.cl-grayscale .cl-logo-img {
  filter: grayscale(100%) opacity(0.6);
}

.cl-grayscale .cl-logo-item:hover .cl-logo-img,
.cl-grayscale .cl-logo-item:focus-within .cl-logo-img {
  filter: grayscale(0%) opacity(1);
  transform: scale(1.05);
}

/* Hover sans grayscale */
.cl-logo-item:hover .cl-logo-img {
  transform: scale(1.05);
  opacity: 0.85;
}

.cl-logo-name.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.cl-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  border: 1px dashed #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #888;
  text-align: center;
  padding: 10px;
}

/* ============================================================
   LAZY LOADING
   ============================================================ */
.cl-lazy {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.cl-lazy.cl-loaded {
  opacity: 1;
}

/* ============================================================
   MODE SLIDER / CAROUSEL
   ============================================================ */
.cl-slider-wrapper {
  position: relative;
  padding: 0 40px;
}

.cl-slider-track-outer {
  overflow: hidden;
}

.cl-slider-track {
  display: flex;
  transition: transform 0.4s ease;
  will-change: transform;
}

.cl-slide {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 5px;
  box-sizing: border-box;
}

/* Navigation */
.cl-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cl-nav:hover {
  background: #f0f0f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cl-nav:focus {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

.cl-nav-prev { left: 0; }
.cl-nav-next { right: 0; }

/* Dots */
.cl-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 15px;
}

.cl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.cl-dot-active,
.cl-dot:hover {
  background: #2196f3;
  transform: scale(1.3);
}

/* ============================================================
   MODE GRILLE
   ============================================================ */
.cl-grid {
  display: grid;
  grid-template-columns: repeat(var(--cl-per-row, 5), 1fr);
  gap: 20px;
  justify-items: center;
  align-items: center;
}

.cl-grid-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   MODE SCROLL / TICKER
   ============================================================ */
.cl-scroll-wrapper {
  overflow: hidden;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.cl-scroll-track {
  display: flex;
  width: max-content;
  animation: cl-scroll-anim 30s linear infinite;
  will-change: transform;
}

.cl-scroll-wrapper:hover .cl-scroll-track {
  animation-play-state: paused;
}

.cl-scroll-item {
  flex: 0 0 auto;
  margin: 0 10px;
}

@keyframes cl-scroll-anim {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  .cl-grid {
    --cl-per-row: 3 !important;
    gap: 15px;
  }
  .cl-slider-wrapper {
    padding: 0 30px;
  }
}

@media (max-width: 768px) {
  .cl-section {
    padding: 25px 0;
  }
  .cl-grid {
    --cl-per-row: 2 !important;
    gap: 10px;
  }
  .cl-slider-wrapper {
    padding: 0 25px;
  }
  .cl-nav {
    width: 28px;
    height: 28px;
  }
  .cl-section-title {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .cl-grid {
    --cl-per-row: 2 !important;
    gap: 8px;
  }
  .cl-logo-card {
    padding: 5px 8px;
  }
}

/* ============================================================
   ACCESSIBILITÉ - Préférence reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .cl-scroll-track {
    animation: none;
  }
  .cl-slider-track {
    transition: none;
  }
  .cl-logo-img {
    transition: none;
  }
  .cl-lazy {
    transition: none;
    opacity: 1;
  }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .cl-section {
    break-inside: avoid;
  }
  .cl-nav, .cl-dots {
    display: none;
  }
  .cl-slider-track, .cl-scroll-track {
    flex-wrap: wrap;
    animation: none;
    transform: none;
  }
  .cl-slide, .cl-scroll-item {
    flex: 0 0 20%;
  }
}
