.catalog-hero {
  padding: 90px 0 46px;
}

.catalog-hero h1 {
  max-width: 860px;
}

.catalog-hero p {
  max-width: 690px;
}

.catalog-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  min-height: 52px;
  padding: 0 18px 0 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font: inherit;
  outline: none;
}

.search-input:focus {
  border-color: rgba(159, 122, 234, 0.65);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.search-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  min-height: 42px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  cursor: pointer;
  transition: color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: rgba(139, 92, 246, 0.13);
  border-color: rgba(159, 122, 234, 0.38);
  color: #fff;
}

.filter-count {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.065);
  color: #c6cad2;
  font-size: 0.76rem;
  line-height: 1;
}

.filter-btn.active .filter-count {
  background: rgba(159, 122, 234, 0.22);
  color: #fff;
}

.catalog-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-bottom: 90px;
}

/* ---------- Rarity system ---------- */

.catalog-card {
  --rarity: #8f96a3;
  --rarity-soft: rgba(143, 150, 163, 0.12);
}

.rarity-common {
  --rarity: #a8adb7;
  --rarity-soft: rgba(168, 173, 183, 0.12);
}

.rarity-uncommon {
  --rarity: #62c783;
  --rarity-soft: rgba(98, 199, 131, 0.13);
}

.rarity-rare {
  --rarity: #5aa8ff;
  --rarity-soft: rgba(90, 168, 255, 0.14);
}

.rarity-epic {
  --rarity: #a875ff;
  --rarity-soft: rgba(168, 117, 255, 0.14);
}

.rarity-legendary {
  --rarity: #f1bf55;
  --rarity-soft: rgba(241, 191, 85, 0.14);
}

.rarity-imperial {
  --rarity: #ef6b78;
  --rarity-soft: rgba(239, 107, 120, 0.14);
}

.rarity-collectable {
  --rarity: #ef83ca;
  --rarity-soft: rgba(239, 131, 202, 0.14);
}

.rarity-holy {
  --rarity: #f5e28a;
  --rarity-soft: rgba(245, 226, 138, 0.14);
}

.rarity-ancient {
  --rarity: #58d7d0;
  --rarity-soft: rgba(88, 215, 208, 0.14);
}

.rarity-ultimate {
  --rarity: #ff985b;
  --rarity-soft: rgba(255, 152, 91, 0.15);
}

.rarity-arabella-common {
  --rarity: #79c8b8;
  --rarity-soft: rgba(121, 200, 184, 0.13);
}

.rarity-onbekend {
  --rarity: #868e9c;
  --rarity-soft: rgba(134, 142, 156, 0.12);
}

/* ---------- Cards ---------- */

.catalog-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-top-color: color-mix(in srgb, var(--rarity) 48%, var(--border));
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.catalog-card::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--rarity),
    transparent
  );
  opacity: 0.8;
  pointer-events: none;
}

.catalog-card:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--rarity) 35%, var(--border));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.card-visual {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #0d1016;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.01);
  transition: transform 0.25s ease,
    opacity 0.25s ease;
  opacity: 0.92;
}

.catalog-card:hover .card-visual img {
  transform: scale(1.035);
  opacity: 1;
}

.visual-icon {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--rarity) 35%, rgba(255,255,255,.12));
  border-radius: 12px;
  background: rgba(9, 11, 16, 0.78);
  color: var(--rarity);
  backdrop-filter: blur(8px);
  font-size: 1.15rem;
}

.catalog-card-body {
  padding: 22px;
}

.item-topline,
.modal-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.item-category,
.item-rarity {
  display: inline-flex;
  min-height: 28px;
  padding: 0 10px;
  align-items: center;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.item-category {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-hover);
}

.item-rarity {
  background: var(--rarity-soft, rgba(255,255,255,.05));
  color: var(--rarity, #b8bdc7);
  border: 1px solid color-mix(in srgb, var(--rarity, #999) 22%, transparent);
}

.catalog-card h2 {
  min-height: 2.5em;
  margin: 0 0 9px;
  font-size: 1.22rem;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.card-description {
  display: -webkit-box;
  min-height: 68px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.94rem;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.enchant-preview,
.modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.enchant-preview {
  min-height: 28px;
  margin-top: 16px;
}

.enchant-preview span,
.modal-chips span {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: #aeb4bf;
  font-size: 0.73rem;
  font-weight: 700;
}

.details-btn {
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: color 160ms ease, opacity 160ms ease;
}

.details-btn:hover {
  color: var(--rarity);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 70px 25px;
  border: 1px dashed var(--border);
  border-radius: 17px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 1.1rem;
}

/* ---------- Detail modal ---------- */

body.modal-open {
  overflow: hidden;
}

.item-modal[hidden] {
  display: none;
}

.item-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 4, 7, 0.84);
  backdrop-filter: blur(11px);
}

.modal-shell {
  position: relative;
  width: min(100%, 1180px);
  max-height: min(92vh, 900px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: #0c0f15;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.56);
}

.modal-close {
  position: sticky;
  top: 14px;
  z-index: 5;
  float: right;
  width: 42px;
  height: 42px;
  margin: 14px 14px -56px 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(9, 11, 16, 0.9);
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
}

.modal-layout {
  --rarity: #8f96a3;
  --rarity-soft: rgba(143, 150, 163, 0.12);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  min-height: 600px;
}

.modal-media {
  display: grid;
  place-items: center;
  min-height: 600px;
  padding: 26px;
  background: radial-gradient(
      circle at 50% 25%,
      var(--rarity-soft),
      transparent 48%
    ),
    #080a0e;
  border-right: 1px solid var(--border);
}

.modal-image {
  width: 100%;
  max-height: 76vh;
  display: block;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

.modal-info {
  padding: 54px 34px 34px;
}

.modal-info h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 26px;
}

.detail-row {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.detail-label {
  display: block;
  margin-bottom: 4px;
  color: #777f8b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-row strong {
  display: block;
  overflow-wrap: anywhere;
  color: #eceef2;
  font-size: 0.9rem;
}

.modal-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.modal-section h3 {
  margin: 0 0 12px;
  color: #838a95;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.modal-section p {
  margin: 0;
  color: #c2c6ce;
  line-height: 1.7;
}

.modal-description {
  font-size: 0.98rem;
}

.muted-detail {
  color: #777f8b !important;
}

@media (max-width: 1000px) {
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .catalog-controls {
    grid-template-columns: 1fr;
  }
  .modal-layout {
    grid-template-columns: 1fr;
  }
  .modal-media {
    min-height: 0;
    padding: 22px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .modal-image {
    max-height: 52vh;
  }
}

@media (max-width: 620px) {
  .catalog-grid {
    grid-template-columns: 1fr;
  }
  .catalog-hero {
    padding-top: 70px;
  }
  .catalog-meta {
    flex-direction: column;
    gap: 3px;
  }
  .item-modal {
    padding: 8px;
  }
  .modal-info {
    padding: 42px 20px 24px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .catalog-card h2 {
    min-height: 0;
  }
}

.catalog-controls-enhanced {
  display: grid;
  gap: 12px;
}

.catalog-secondary-controls {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.catalog-select,.catalog-small-btn {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  font: inherit;
  font-size: .78rem;
  font-weight: 730;
}

.catalog-select option {
  color: #111;
}

.catalog-small-btn {
  cursor: pointer;
}

.catalog-small-btn.active {
  border-color: rgba(159,122,234,.4);
  background: rgba(139,92,246,.1);
  color: #cbbcff;
}

.card-favorite {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: rgba(9,11,16,.72);
  backdrop-filter: blur(8px);
  color: #a8aeba;
  font-size: 1.05rem;
  cursor: pointer;
}

.card-favorite.active {
  color: #efc45e;
  border-color: rgba(239,196,94,.3);
}

.catalog-card {
  position: relative;
}

.modal-item-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0 18px;
}

.modal-fav.active {
  color: #efc45e;
  border-color: rgba(239,196,94,.3);
}

@media (max-width:620px) {
  .catalog-secondary-controls>* {
    flex: 1;
  }
  .catalog-select {
    min-width: 0;
  }
}


/* ---------- Navigatie in item-popup ---------- */

.modal-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin: 0 0 22px;
}

.modal-prev {
  justify-self: start;
}

.modal-next {
  justify-self: end;
}

.modal-position {
  min-width: 66px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.modal-navigation .catalog-small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.modal-navigation .catalog-small-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.modal-navigation .catalog-small-btn:not(:disabled):hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: var(--accent-soft);
  color: var(--text);
}

@media (max-width: 620px) {
  .modal-navigation {
    grid-template-columns: 1fr 1fr;
  }

  .modal-position {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }

  .modal-prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
  }

  .modal-next {
    grid-column: 2;
    grid-row: 2;
    justify-self: stretch;
  }
}


/* ==========================================================
   RP-item popup volgt het actieve website-thema
   ========================================================== */

.item-modal {
  background:
    color-mix(
      in srgb,
      var(--bg) 68%,
      rgba(28, 30, 36, 0.62)
    );
}

.modal-shell {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--site-shadow, 0 30px 90px rgba(0, 0, 0, 0.32));
}

.modal-close {
  border-color: var(--border);
  background:
    color-mix(
      in srgb,
      var(--surface-2) 88%,
      transparent
    );
  color: var(--text);
}

.modal-close:hover {
  border-color:
    color-mix(
      in srgb,
      var(--accent) 40%,
      var(--border)
    );
  background: var(--accent-soft);
  color: var(--text);
}

.modal-layout {
  color: var(--text);
}

.modal-media {
  background:
    radial-gradient(
      circle at 50% 25%,
      var(--rarity-soft),
      transparent 48%
    ),
    color-mix(
      in srgb,
      var(--surface-2) 76%,
      var(--bg)
    );
  border-color: var(--border);
}

.modal-image {
  border-color: var(--border);
  background:
    color-mix(
      in srgb,
      var(--surface-2) 76%,
      transparent
    );
  box-shadow:
    0 18px 45px
    color-mix(
      in srgb,
      var(--bg) 38%,
      transparent
    );
}

.modal-info {
  background: var(--surface);
  color: var(--text);
}

.modal-info h2 {
  color: var(--text);
}

.detail-row {
  border-color: var(--border);
  background:
    color-mix(
      in srgb,
      var(--surface-2) 62%,
      transparent
    );
}

.detail-label {
  color: var(--muted);
}

.detail-row strong {
  color: var(--text);
}

.modal-section {
  border-top-color: var(--border);
}

.modal-section h3 {
  color: var(--muted);
}

.modal-section p,
.modal-description {
  color: var(--text);
}

.muted-detail {
  color: var(--muted) !important;
}

.catalog-select,
.catalog-small-btn {
  border-color: var(--border);
  background:
    color-mix(
      in srgb,
      var(--surface-2) 62%,
      transparent
    );
  color: var(--text);
}

.catalog-select option {
  background: var(--surface);
  color: var(--text);
}

.catalog-small-btn:hover {
  border-color:
    color-mix(
      in srgb,
      var(--accent) 38%,
      var(--border)
    );
  background: var(--accent-soft);
  color: var(--text);
}

.catalog-small-btn.active,
.modal-fav.active {
  border-color:
    color-mix(
      in srgb,
      #efc45e 34%,
      var(--border)
    );
  background:
    color-mix(
      in srgb,
      #efc45e 10%,
      var(--surface)
    );
  color:
    color-mix(
      in srgb,
      #efc45e 82%,
      var(--text)
    );
}

.modal-position {
  border-color: var(--border);
  background:
    color-mix(
      in srgb,
      var(--surface-2) 62%,
      transparent
    );
  color: var(--muted);
}

.modal-chips span {
  border-color: var(--border);
  background:
    color-mix(
      in srgb,
      var(--surface-2) 68%,
      transparent
    );
  color: var(--text);
}

/* Light mode krijgt een iets zachtere overlay en schaduw. */
html[data-appearance="light"] .item-modal {
  background: rgba(31, 34, 42, 0.46);
}

html[data-appearance="light"] .modal-shell {
  box-shadow:
    0 30px 90px rgba(36, 40, 50, 0.22);
}

html[data-appearance="light"] .modal-media {
  background:
    radial-gradient(
      circle at 50% 25%,
      var(--rarity-soft),
      transparent 48%
    ),
    color-mix(
      in srgb,
      var(--surface-2) 88%,
      white
    );
}

html[data-appearance="light"] .modal-image {
  box-shadow:
    0 16px 42px rgba(45, 49, 60, 0.16);
}

/* Glass-kaarten laten ook de popup subtiel meegaan. */
html[data-cards="glass"] .modal-shell {
  background:
    color-mix(
      in srgb,
      var(--surface) 88%,
      transparent
    );
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
}

html[data-cards="glass"] .modal-info {
  background: transparent;
}


/* Fix: 'Bekijk details' moet ook in licht thema goed leesbaar zijn */
html[data-appearance="light"] .details-btn {
  color: #1f2430;
}
