/* =========================
   RESET / BASE
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  background: #0f0f0f;
  color: #f2f2f2;
}

a {
  color: #aaa;
  text-decoration: none;
}

a:hover {
  color: #fff;
}

/* =========================
   HEADER
========================= */

header {
  padding: 10px;
  text-align: center;
}

header h1 {
  margin: 6px 0 10px;
  font-size: 1.2rem;
}

#search {
  width: 90%;
  max-width: 420px;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 0.9rem;
}

/* =========================
   COLLECTION GRID
========================= */

#collection {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px;
}

/* =========================
   VINYL CARD
========================= */

.vinyl {
  position: relative;
  background: #141414;
  border-radius: 12px;
  padding: 8px;
  text-align: center;
}

/* Jaquette */
.vinyl img {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  margin: 0 auto 6px;
  display: block;
}

/* Texte */
.vinyl strong {
  display: block;
  font-size: 0.85rem;
  line-height: 1.15;
  margin-bottom: 2px;
}

.vinyl {
  font-size: 0.75rem;
  line-height: 1.2;
}

/* Lien Discogs */
.vinyl a {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  opacity: 0.7;
}

.vinyl img {
  transition: opacity 0.15s ease;
}

/* =========================
   AURAS
========================= */

/* Ajouté par ≠ Laurent */
.vinyl.not-mine img {
  box-shadow:
    0 0 0 2px rgba(255, 215, 100, 0.35),
    0 0 12px rgba(255, 215, 100, 0.25);
}

/* Inactif */
.vinyl.inactive img {
  box-shadow:
    0 0 0 2px rgba(220, 50, 50, 0.6),
    0 0 14px rgba(220, 50, 50, 0.5);
  opacity: 0.85;
}

/* =========================
   DELETE BUTTON
========================= */

.delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s ease, transform 0.1s ease;
}

/* Actif → masquer */
.vinyl:not(.inactive) .delete-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.05);
}

/* Inactif → suppression définitive */
.vinyl.inactive .delete-btn {
  background: rgba(180, 0, 0, 0.85);
}

.vinyl.inactive .delete-btn:hover {
  background: rgb(220, 0, 0);
  transform: scale(1.1);
}

/* =========================
   RESTORE BUTTON
========================= */

.restore-btn {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(30, 160, 80, 0.9);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.1s ease, background 0.15s ease;
}

.restore-btn:hover {
  background: rgb(40, 200, 100);
  transform: scale(1.1);
}

/* =========================
   MODAL RECHERCHE
========================= */

#modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#modal.hidden {
  display: none;
}

.modal-content {
  background: #181818;
  width: 95%;
  max-width: 480px;
  max-height: 90vh;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

#discogsSearch {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  outline: none;
  margin-bottom: 10px;
}

/* Résultats Discogs */
#results {
  overflow-y: auto;
}

.result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}

.result img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
}

.result:hover {
  background: #222;
}

/* =========================
   MODAL PREVIEW
========================= */

.preview-wrapper {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.preview-wrapper.hidden {
  display: none;
}

.preview-content {
  position: relative;
  background: #111;
  border-radius: 12px;
  padding: 12px;
  max-width: 320px;
  width: 90%;
  text-align: center;
}

#preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 8px;
}

/* Close */
.close-preview {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

/* Navigation */
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
}

.nav.left {
  left: -18px;
}

.nav.right {
  right: -18px;
}

/* Confirmation */
.confirm.big {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: #27ae60;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.confirm.big:hover {
  background: #2ecc71;
}

/* =========================
   DESKTOP
========================= */

@media (min-width: 768px) {
  #collection {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 16px;
  }

  .vinyl img {
    max-width: 160px;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .preview-content {
    max-width: 400px;
  }
}

/* =========================
   PREVIEW IMAGE CHECK
========================= */

.check-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #2ecc71;
  font-size: 40px;
  font-weight: bold;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.check-overlay.visible {
  opacity: 1;
}

/* =========================
   ALT IMAGE CHOICE
========================= */

.alt-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 10px 0;
}

.alt-images img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  filter: grayscale(100%);
  opacity: 0.6;
  cursor: pointer;
  transition: filter .15s, opacity .15s, outline .15s;
}

.alt-images img.active {
  filter: none;
  opacity: 1;
  outline: 3px solid #2ecc71;
}

