/* =========================
   RESET & BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at top, #0f172a, #020617);
  color: #e5e7eb;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
}

/* =========================
   LAYOUT
========================= */
.container {
  max-width: 1400px;
  margin: auto;
  padding: 30px 20px 60px;
}

/* =========================
   CONTROLS
========================= */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 25px;
}

.controls input,
.controls select,
.controls button {
  background: #020617;
  border: 1px solid #1e293b;
  color: #e5e7eb;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}

.controls input::placeholder {
  color: #64748b;
}

.controls button {
  cursor: pointer;
  transition: all 0.25s ease;
}

.controls button:hover {
  background: #0f172a;
  border-color: #38bdf8;
}

/* =========================
   GRID
========================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 18px;
}

/* =========================
   MOBI CARD
========================= */
.mobi {
  position: relative;
  background: linear-gradient(180deg, #020617, #020617cc);
  border: 1px solid #1e293b;
  border-radius: 16px;
  padding: 16px 10px 14px;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease;
  overflow: hidden;
}

.mobi::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(56, 189, 248, 0.15),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobi:hover::before {
  opacity: 1;
}

.mobi:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: #38bdf8;
  box-shadow:
    0 20px 40px rgba(2, 6, 23, 0.8),
    0 0 0 1px rgba(56, 189, 248, 0.2);
}

/* =========================
   IMAGE
========================= */
.mobi img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  margin-bottom: 10px;
}

/* =========================
   NAME (NO OVERFLOW)
========================= */
.mobi-name {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
}

/* =========================
   BADGE NEW
========================= */
.badge-new {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: white;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow:
    0 0 12px rgba(56, 189, 248, 0.7),
    0 0 25px rgba(37, 99, 235, 0.4);
  animation: pulse 2s infinite;
}

/* =========================
   NEW CARD EFFECT
========================= */
.mobi.new {
  border-color: #38bdf8;
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.25),
    0 0 30px rgba(56, 189, 248, 0.15);
}

/* =========================
   PAGINATION
========================= */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 35px;
}

.pagination button {
  background: #020617;
  border: 1px solid #1e293b;
  color: #e5e7eb;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.pagination button:hover {
  background: #0f172a;
  border-color: #38bdf8;
}

#pageInfo {
  padding: 8px 14px;
  color: #94a3b8;
}

/* =========================
   ANIMATIONS
========================= */
@keyframes pulse {
  0% {
    box-shadow:
      0 0 10px rgba(56, 189, 248, 0.6),
      0 0 20px rgba(37, 99, 235, 0.3);
  }
  50% {
    box-shadow:
      0 0 16px rgba(56, 189, 248, 0.9),
      0 0 30px rgba(37, 99, 235, 0.5);
  }
  100% {
    box-shadow:
      0 0 10px rgba(56, 189, 248, 0.6),
      0 0 20px rgba(37, 99, 235, 0.3);
  }
}

/* =========================
   POPUP
========================= */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.popup-overlay.active {
  display: flex;
}

.popup-content {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  padding: 20px;
  text-align: center;
  position: relative;
  animation: popupFadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #e5e7eb;
  cursor: pointer;
}

.popup-body {
  overflow-y: auto;
  padding-right: 5px;
  text-align: left;
}

.popup-body img {
  width: 80px;
  height: 80px;
  margin-bottom: 15px;
  image-rendering: pixelated;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.popup-body h2 {
  margin-bottom: 10px;
  font-size: 18px;
  color: #38bdf8;
  text-align: center;
}

.popup-body p {
  font-size: 14px;
  color: #cbd5f5;
  margin-bottom: 10px;
}

.popup-body ul {
  list-style: none;
  padding-left: 0;
}

.popup-body ul li {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 4px;
}

/* Scrollbar personnalisée */
.popup-body::-webkit-scrollbar {
  width: 6px;
}

.popup-body::-webkit-scrollbar-thumb {
  background-color: #38bdf8;
  border-radius: 3px;
}

.popup-body::-webkit-scrollbar-track {
  background: #020617;
}

@keyframes popupFadeIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* =========================
   SELECTION MODE
========================= */
.mobi.selectable {
  cursor: pointer;
  border-color: #facc15;
}

.mobi.selected {
  background: linear-gradient(180deg, #facc15cc, #facc1599);
}
