/* PokeCollection - composants "L'Index".
   BEM, prefixe pc-. Depend de tokens.css + base.css.
   Principe : la hierarchie vient des bordures et des fonds, pas des ombres. */

/* ============ Header / navigation ============ */
.pc-header {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  height: 56px;
  padding: 0 var(--sp-5);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
}
.pc-logo {
  font: 600 17px var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.pc-logo em { font-style: normal; color: var(--accent); }

.pc-nav {
  display: flex;
  gap: var(--sp-1);
  padding: 3px;
  background: var(--surface-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pc-nav__tab {
  min-height: 38px;
  padding: 0 var(--sp-3);
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
}
.pc-nav__tab[aria-current="page"] {
  background: var(--surface-card);
  border-color: var(--border);
  color: var(--text-primary);
  font-weight: 600;
}

/* ============ Boutons ============ */
.pc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.pc-btn--primary { background: var(--accent); color: var(--text-on-accent); }
.pc-btn--primary:hover { background: var(--accent-hover); }
.pc-btn--secondary {
  background: var(--surface-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.pc-btn--secondary:hover { border-color: var(--accent); color: var(--accent); }
.pc-btn--ghost { background: none; color: var(--accent); }
.pc-btn--ghost:hover { background: var(--accent-soft); }

/* ============ Champ de recherche ============ */
.pc-input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.pc-input::placeholder { color: var(--text-muted); }
.pc-input:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); }

/* ============ Tuile de serie ============ */
.pc-serie {
  display: block;
  padding: var(--sp-5);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.pc-serie:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); text-decoration: none; }
.pc-serie__logo {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-3);
}
.pc-serie__logo img { max-height: 64px; width: auto; }
.pc-serie__name { font: 600 16px var(--font-display); }
.pc-serie__meta { margin-top: var(--sp-1); font-size: 12px; color: var(--text-muted); }

/* ============ Grille de cartes ============ */
.pc-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(var(--grid-cols, 3), 1fr);
  transition: opacity var(--transition-view);
}
.pc-grid[data-density="2"]       { --grid-cols: 2; }
.pc-grid[data-density="3"]       { --grid-cols: 3; }
.pc-grid[data-density="binder"]  { --grid-cols: 3; gap: var(--sp-2); }
.pc-grid[data-density="dense"]   { --grid-cols: 4; gap: var(--sp-2); }
@media (min-width: 640px) {
  .pc-grid[data-density="3"]      { --grid-cols: 4; }
  .pc-grid[data-density="binder"] { --grid-cols: 3; }
  .pc-grid[data-density="dense"]  { --grid-cols: 6; }
}
@media (min-width: 1280px) {
  .pc-grid[data-density="2"]      { --grid-cols: 4; }
  .pc-grid[data-density="3"]      { --grid-cols: 6; }
  .pc-grid[data-density="dense"]  { --grid-cols: 8; }
}

/* ============ Vignette de carte ============ */
.pc-card {
  display: block;
  padding: 7px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.pc-card:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); text-decoration: none; }
.pc-card:hover .pc-card__name { color: var(--accent); }
.pc-card__name { margin-top: 7px; font-size: 12.5px; font-weight: 600; }
.pc-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.pc-card--owned  { border: 1.5px solid var(--ok); }
.pc-card--missing { border-style: dashed; opacity: 0.7; }
.pc-card__qty {
  position: absolute;
  top: 5px; right: 5px;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  font: 500 9.5px var(--font-data);
  color: #fff;
  background: var(--ok);
}
.pc-card__qty--dupe { background: var(--accent-2); }
.pc-card__media { position: relative; }

/* ============ Badges de rarete ============ */
.pc-rarity {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: 500 9.5px var(--font-data);
  color: var(--text-muted);
  white-space: nowrap;
}
.pc-rarity--pc  { border-color: var(--border-strong); }
.pc-rarity--r   { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pc-rarity--rh  { color: var(--warn); border-color: var(--warn); }
.pc-rarity--v   { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.pc-rarity--vmax{ color: var(--accent); border-color: var(--accent); }
.pc-rarity--sec { color: var(--text-on-accent); background: var(--accent-2); border-color: var(--accent-2); }
:root[data-theme="dark"] .pc-rarity--sec { color: var(--surface-base); }

/* ============ Barre de filtres ============ */
.pc-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pc-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.pc-chip:hover { border-color: var(--accent); }
.pc-chip--active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}
:root[data-theme="dark"] .pc-chip--active { color: var(--surface-base); }
.pc-filters__count {
  margin-left: auto;
  font: 500 12px var(--font-data);
  color: var(--text-muted);
}

/* ============ Jauge de completude ============ */
.pc-gauge__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-2);
}
.pc-gauge__track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.pc-gauge__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease-out;
}
.pc-gauge__legend {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-2);
  font: 400 11px var(--font-data);
}
.pc-gauge__legend .is-owned { color: var(--ok); }
.pc-gauge__legend .is-missing { color: var(--error); }

/* ============ Skeleton loaders ============ */
.pc-skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg,
    var(--surface-inset) 40%,
    color-mix(in srgb, var(--surface-inset) 50%, var(--surface-card)) 50%,
    var(--surface-inset) 60%);
  background-size: 200% 100%;
  animation: pc-shimmer 1.6s linear infinite;
}
.pc-skeleton--card { aspect-ratio: var(--ratio-card); }
.pc-skeleton--line { height: 11px; margin-top: 7px; }
@keyframes pc-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

/* ============ Etat vide ============ */
.pc-empty {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pc-empty__count { font: 500 13px var(--font-data); color: var(--border-strong); }
.pc-empty__title { margin-top: var(--sp-3); font-size: 14px; font-weight: 600; }
.pc-empty__hint { margin: var(--sp-1) 0 0; font-size: 12.5px; color: var(--text-muted); }

/* ============ Boutons icones (densite, navigation) ============ */
.pc-nav__tab svg { display: block; width: 16px; height: 16px; fill: currentColor; }
.pc-iconbtn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.pc-iconbtn:hover { border-color: var(--accent); color: var(--accent); }
.pc-iconbtn:disabled { opacity: 0.4; cursor: default; }
.pc-iconbtn:disabled:hover { border-color: var(--border-strong); color: var(--text-primary); }
.pc-iconbtn svg { width: 16px; height: 16px; fill: currentColor; }

/* ============ Filtres de raretes ============ */
.pc-rarities { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pc-chip .pc-num { opacity: 0.7; }
.pc-card.pc-filter-off { display: none; }

/* ============ Mode classeur ============ */
.pc-grid[data-density="binder"] {
  max-width: 620px;
  margin: 0 auto;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pc-grid[data-density="binder"] .pc-card { display: none; }
.pc-grid[data-density="binder"] .pc-card.pc-page-on { display: block; }
.pc-binder-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}
.pc-binder-bar[hidden] { display: none; }
.pc-binder-bar .pc-num { min-width: 96px; text-align: center; color: var(--text-muted); }

/* ============ Apercu de carte (surimpression) ============ */
.pc-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: var(--sp-4); }
.pc-modal[hidden] { display: none; }
.pc-modal__overlay { position: absolute; inset: 0; background: rgba(18, 22, 27, 0.55); }
.pc-modal__panel {
  position: relative;
  z-index: 1;
  width: min(400px, 92vw);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}
.pc-modal__img { width: 100%; aspect-ratio: var(--ratio-card); object-fit: contain; border-radius: var(--radius-sm); background: var(--surface-inset); }
.pc-modal__meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); }
.pc-modal__name { font: 600 16px var(--font-display); }
.pc-modal__illus { margin-top: 2px; font-size: var(--fs-small); color: var(--text-muted); }
.pc-modal__actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); }
.pc-modal__actions .pc-btn { flex: 1; }
.pc-modal__close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.pc-modal__nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.pc-modal__nav--prev { left: 10px; }
.pc-modal__nav--next { right: 10px; }
body.pc-modal-open { overflow: hidden; }
@media (min-width: 640px) {
  .pc-modal__nav--prev { left: calc(50% - 200px - 56px); }
  .pc-modal__nav--next { right: calc(50% - 200px - 56px); }
}
