/* =========================================================
   IMPORT POLICE
========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

/* =========================================================
   VARIABLES
========================================================= */
:root {
  --scroll-btn-opacity: 0.7;
  --scroll-btn-opacity-hover: 0.9;
  --scroll-btn-anim-speed: 1s;
}

/* =========================================================
   ANIMATIONS
========================================================= */
@keyframes fadeInScroll {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeOutScroll {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* =========================================================
   GLOBAL
   ========================================================= */
body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', Arial, sans-serif;
  background-color: #000;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* =========================================================
   SPA - SCOPES CSS
   ========================================================= */
/* Les sections SPA sont cachées par défaut */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.page-section.spa-artist {
  position: relative;
  z-index: 5;
}

/* Empêcher les conflits CSS entre les sections */
.spa-explore #artist-container,
.spa-explore #singles-container {
  display: block;
}

.spa-profile .profile-wrapper,
.spa-artist .page,
.spa-user .profile-wrapper {
  display: block;
}

/* =========================================================
   SPA - FIX LAYOUT
   ========================================================= */
/* Le menu est déjà en position fixed dans menu.css, pas de conflit */
/* Le player est déjà en position fixed dans player.css, pas de conflit */
/* Le scroll-to-top est déjà en position fixed dans Explore.css, pas de conflit */

/* =========================================================
   CARROUSEL ARTISTES
========================================================= */
#artist-container {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
  display: flex;
  align-items: center;
  margin-top: 6rem;
  cursor: grab;
}

#artist-container:active {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  /* 🔥 force GPU, démarrage instant */
  /* transition: transform 0.1s linear; ❌ SUPPRIMÉ */
  margin-top: 4rem;
}

.artist {
  flex-shrink: 0;
  width: 140px;
  text-align: center;
  cursor: pointer;
}

.artist-img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 50%;
  background: #111;
  opacity: 1;
  /* Par défaut visible pour éviter le noir permanent */
  transition: opacity 0.4s ease-in-out;

  /* 🔥 FIX GPU BLACK IMAGE */
  backface-visibility: hidden;
  transform: translateZ(0);

  /* 🔒 bloque drag image */
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* Cache seulement si pas de src ou pas encore chargé via JS (optionnel si on veut le fondu) */
.artist-img:not([src]),
.artist-img[src=""] {
  opacity: 0;
}

.artist-img.loaded {
  opacity: 1;
}


.artist-name {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.9;
  pointer-events: none;
}

/* =========================================================
   FADE LATERAL
========================================================= */
.fade {
  position: absolute;
  top: 0;
  width: 220px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.fade-left {
  left: 0;
  background: linear-gradient(to right, #000 50%, transparent);
}

.fade-right {
  right: 0;
  background: linear-gradient(to left, #000 50%, transparent);
}

/* =========================================================
   SECTION SINGLES (GRILLE CSS)
========================================================= */
.singles-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
  gap: 1.5rem !important;
  width: 100% !important;
  margin-top: 5rem !important;
  padding: 0 1rem !important;
  user-select: none !important;
  place-items: start !important;
  align-content: start !important;
}

/* =========================================================
   CARTE SINGLE
========================================================= */
.single-card {
  width: 160px;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  contain: layout paint;
}

.single-card:hover {
  transform: scale(1.05);
}

.single-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  background: #111;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.single-cover.loaded {
  opacity: 1;
}

.single-title {
  display: none;
}

/* =========================================================
   TRACK MANQUANT
========================================================= */
.single-card.missing {
  opacity: 0.5;
  filter: grayscale(1);
  cursor: default;
  pointer-events: none;
}

.missing-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(200, 30, 30, 0.9);
  color: white;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
}

/* =========================================================
   PLAYER
========================================================= */
#player-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
}

/* =========================================================
   SCROLL TO TOP
========================================================= */
.scroll-to-top {
  position: fixed;
  width: 70px;
  height: 70px;
  bottom: 2rem;
  right: 2rem;
  background: rgba(255, 243, 243, var(--scroll-btn-opacity));
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #2b2929;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  opacity: 0;
  animation: fadeOutScroll var(--scroll-btn-anim-speed) ease forwards;
  z-index: 100;
}

.scroll-to-top.show {
  display: flex;
  opacity: 1;
  animation: fadeInScroll var(--scroll-btn-anim-speed) ease forwards;
}

.scroll-to-top:hover {
  background: rgba(255, 255, 255, var(--scroll-btn-opacity-hover));
  transform: scale(1.1);
}

.scroll-to-top:active {
  transform: scale(0.95);
}

/* =========================================================
   SCROLLBAR
========================================================= */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}