/* ═══════════════════════════════════════════════════════════════════
   comparePatch.css — onglet "📊 Compare Patch"
   Réutilise les variables de thème définies dans damage-calc.css
   (--bg, --surface*, --border*, --violet, --blue, --green, --red,
   --yellow, --text*, --radius*, --shadow*), donc pas de redéfinition
   de tokens ici : ce fichier doit être chargé APRÈS damage-calc.css.
   ═══════════════════════════════════════════════════════════════════ */

.cpt-panel {
  position: relative;
  padding: 1.2rem;
  gap: 1rem;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-4) transparent;
}
.cpt-panel::-webkit-scrollbar { width: 6px; height: 6px; }
.cpt-panel::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

/* ─── Header ─────────────────────────────────────────────────────── */
.cpt-header { display: flex; flex-direction: column; gap: 0.2rem; }
.cpt-title {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cpt-icon { font-size: 1.2rem; }
.cpt-subtitle { font-size: 0.82rem; color: var(--text-dim); margin: 0; }

/* ─── Sélecteurs de patch (dropdowns natifs) ─────────────────────── */
.cpt-patch-selectors-v2 {
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
}
.cpt-patch-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
.cpt-patch-slot-label {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.cpt-patch-a .cpt-patch-slot-label { color: var(--violet); }
.cpt-patch-b .cpt-patch-slot-label { color: var(--blue); }

.cpt-patch-select {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-bright);
  cursor: pointer;
  width: 100%;
  transition: border-color 0.18s, background 0.18s;
}
.cpt-patch-a .cpt-patch-select { border: 2px solid rgba(159,83,236,0.55); }
.cpt-patch-b .cpt-patch-select { border: 2px solid rgba(79,195,247,0.55); }
.cpt-patch-a .cpt-patch-select:hover { border-color: var(--violet); background: var(--surface-3); }
.cpt-patch-b .cpt-patch-select:hover { border-color: var(--blue); background: var(--surface-3); }

.cpt-swap-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text-bright);
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s, border-color 0.18s, background 0.18s;
}
.cpt-swap-btn:hover { border-color: var(--violet); background: var(--violet-dim); transform: rotate(180deg); }

.cpt-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.55rem 0.8rem;
  line-height: 1.4;
}

/* ─── Grille principale : attaquant + cible ──────────────────────── */
.cpt-main-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: start;
}
.cpt-col-title {
  font-family: 'Exo 2', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}
.cpt-attacker-col, .cpt-target-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

/* ─── Filtre "seulement les Pokémon modifiés" ────────────────────── */
.cpt-grid-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.cpt-toggle-small { font-size: 0.74rem; gap: 0.3rem; }
.cpt-toggle-small input { width: 14px; height: 14px; }
.cpt-changed-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  font-family: 'Exo 2', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Attacker picker */
.cpt-grid-wrapper { max-height: 190px; margin-top: 0.5rem; }
.cpt-grid-item { position: relative; }
.cpt-grid-item-changed { box-shadow: inset 0 0 0 1px rgba(255,215,64,0.18); }
.cpt-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cpt-badge-onlyA { background: var(--blue-dim); color: var(--blue); }
.cpt-badge-onlyB { background: var(--orange-dim); color: var(--orange); }
.cpt-diff-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(255,215,64,0.7);
}

.cpt-attacker-controls {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  position: relative;
}

.cpt-level-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.cpt-level-label {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.cpt-level-row input[type="range"] { flex: 1; accent-color: var(--violet); }

/* Même style de piste dégradée + curseur lumineux que le Calculator principal */
.cpt-level-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin: 4px 0;
}
.cpt-level-row input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--violet) 0%,
    var(--violet) calc((var(--value, 15) - 1) / 14 * 100%),
    rgba(0,0,0,0.6) calc((var(--value, 15) - 1) / 14 * 100%),
    rgba(0,0,0,0.6) 100%);
}
.cpt-level-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 4px; height: 16px; border-radius: 2px;
  background: #fff; border: 1px solid rgba(0,0,0,0.4);
  box-shadow: 0 0 8px rgba(159,83,236,0.9), 0 0 0 1px rgba(159,83,236,0.4);
  cursor: pointer;
}
.cpt-level-row input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--violet) 0%,
    var(--violet) calc((var(--value, 15) - 1) / 14 * 100%),
    rgba(0,0,0,0.6) calc((var(--value, 15) - 1) / 14 * 100%),
    rgba(0,0,0,0.6) 100%);
}
.cpt-level-row input[type="range"]::-moz-range-thumb {
  width: 6px; height: 18px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.5); cursor: pointer;
  background: var(--violet); box-shadow: 0 0 8px rgba(159,83,236,.6);
}
.cpt-level-value {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--text-bright);
  min-width: 22px;
  text-align: center;
}

/* Item slots */
.cpt-item-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.cpt-item-slot {
  flex: 1;
  min-width: 110px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-md);
  background: var(--surface-2);
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  text-align: center;
}
.cpt-item-empty { cursor: pointer; color: var(--text-dim); transition: border-color 0.15s, background 0.15s; min-height: 74px; justify-content: center; }
.cpt-item-empty:hover { border-color: var(--violet); background: var(--surface-3); }
.cpt-item-plus { font-size: 1.3rem; font-weight: 900; color: var(--text-dim); }
.cpt-item-empty-label { font-size: 0.75rem; }

.cpt-item-filled img { width: 34px; height: 34px; border-radius: var(--radius-xs); object-fit: cover; }
.cpt-item-name { font-size: 0.72rem; font-weight: 700; color: var(--text-bright); line-height: 1.2; }
.cpt-item-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--red-dim);
  color: var(--red);
  font-size: 0.6rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpt-item-stacks { display: flex; align-items: center; gap: 0.3rem; font-weight: 800; font-size: 0.78rem; color: var(--text-bright); }
.cpt-stack-btn {
  width: 18px; height: 18px; border-radius: 4px; border: none;
  background: var(--surface-4); color: var(--text-bright); cursor: pointer;
  font-weight: 900; line-height: 1; font-size: 0.85rem;
}
.cpt-stack-max { color: var(--text-dim); font-weight: 600; }
.cpt-item-toggle {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-md);
  background: var(--surface-3);
  color: var(--text-dim);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cpt-item-toggle.active { background: var(--green-dim); color: var(--green); border-color: var(--green); }

.cpt-item-popover {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.4rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border-md);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.6rem;
  z-index: 20;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cpt-item-search {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-md);
  background: var(--surface-3);
  color: var(--text-bright);
}
.cpt-item-popover-grid {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.4rem;
}
.cpt-item-popover-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  text-align: center;
  font-size: 0.68rem;
  color: var(--text);
  transition: background 0.12s;
}
.cpt-item-popover-option:hover { background: var(--surface-4); }
.cpt-item-popover-option img { width: 26px; height: 26px; border-radius: 4px; object-fit: cover; }

/* ─── Buffs/Debuffs universels (réutilise .buffs-drawer de damage-calc.css) ─ */
.cpt-universal-drawers { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.2rem; }
.cpt-universal-drawer.cpt-drawer-buff .buffs-drawer-header { border-left: 3px solid var(--green); }
.cpt-universal-drawer.cpt-drawer-debuff .buffs-drawer-header { border-left: 3px solid var(--red); }
.cpt-universal-drawer.cpt-drawer-buff .buff-label:has(input:checked) { border-left-color: var(--green); }
.cpt-universal-drawer.cpt-drawer-debuff .buff-label:has(input:checked) { border-left-color: var(--red); }

/* Target dummy panel */
.cpt-target-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.7rem; }
.cpt-target-field:last-child { margin-bottom: 0; }
.cpt-target-field label {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
}
.cpt-target-field label span { color: var(--yellow); }
.cpt-target-field input[type="number"] {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text-bright);
}
.cpt-target-field input[type="range"] { accent-color: var(--yellow); width: 100%; }
.cpt-target-field input.cpt-hp-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  margin: 6px 0;
  background: transparent;
  border: 2px solid rgba(0,0,0,0.7);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.06);
}
.cpt-target-field input.cpt-hp-slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 2px;
  background: linear-gradient(to right,
    var(--yellow) 0%, var(--yellow) calc(var(--value, 100) * 1%),
    rgba(0,0,0,0.8) calc(var(--value, 100) * 1%), rgba(0,0,0,0.8) 100%);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}
.cpt-target-field input.cpt-hp-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 6px; height: 18px; border-radius: 3px;
  background: #fff; border: 1px solid rgba(0,0,0,0.5);
  box-shadow: 0 0 0 2px rgba(255,215,64,0.6), 0 2px 6px rgba(0,0,0,0.8);
  cursor: pointer; margin-top: -4px;
}
.cpt-target-field input.cpt-hp-slider::-moz-range-track {
  height: 10px; border-radius: 2px;
  background: linear-gradient(to right,
    var(--yellow) 0%, var(--yellow) calc(var(--value, 100) * 1%),
    rgba(0,0,0,0.8) calc(var(--value, 100) * 1%), rgba(0,0,0,0.8) 100%);
}
.cpt-target-field input.cpt-hp-slider::-moz-range-thumb {
  width: 6px; height: 18px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.5); cursor: pointer; background: #fff;
  box-shadow: 0 0 0 2px rgba(255,215,64,0.6), 0 2px 6px rgba(0,0,0,0.8);
}
.cpt-target-field-row { display: flex; gap: 0.6rem; }
.cpt-target-field-row .cpt-target-field { flex: 1; }

/* ─── Zone de résultat ───────────────────────────────────────────── */
.cpt-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 80px;
}
.cpt-empty-state { padding: 1.4rem; text-align: center; color: var(--text-dim); font-size: 0.85rem; }
.cpt-setup-hint code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  font-size: 0.78rem;
  color: var(--yellow);
}
.cpt-loading { padding: 1.4rem; text-align: center; color: var(--text-dim); font-size: 0.85rem; }
.cpt-error { padding: 1.4rem; text-align: center; color: var(--red); font-size: 0.85rem; }

.cpt-onesided { display: flex; align-items: center; gap: 0.9rem; padding: 1.2rem; }
.cpt-onesided img { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; }
.cpt-onesided-name { font-weight: 700; color: var(--text-bright); font-size: 1rem; }
.cpt-onesided-msg { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.2rem; }

/* Result header */
.cpt-result-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.cpt-result-header img { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; }
.cpt-result-headtext { flex: 1; min-width: 160px; }
.cpt-result-name { font-family: 'Exo 2', sans-serif; font-weight: 900; color: var(--text-bright); font-size: 1.05rem; }
.cpt-result-summary { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; font-weight: 600; }
.cpt-vs-inline { color: var(--violet); font-weight: 800; margin: 0 2px; }

.cpt-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-bright);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.cpt-toggle input { accent-color: var(--violet); width: 16px; height: 16px; cursor: pointer; }

/* ─── Liste des moves (style calculator) ─────────────────────────── */
.cpt-moves-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem;
}

.cpt-move-card {
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cpt-move-card:hover {
  border-color: rgba(159,83,236,0.35);
  box-shadow: 0 0 20px rgba(159,83,236,0.1);
}
.cpt-move-name {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cpt-move-badge {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cpt-move-badge-new { background: var(--green-dim); color: var(--green); }
.cpt-move-badge-removed { background: var(--red-dim); color: var(--red); }

.cpt-move-summary {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cpt-move-summary.cpt-buff { background: var(--green-dim); color: var(--green); }
.cpt-move-summary.cpt-nerf { background: var(--red-dim); color: var(--red); }
.cpt-move-summary.cpt-neutral { background: var(--surface-3); color: var(--text-dim); }

.cpt-hit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.45rem 0;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.cpt-hit-row:first-of-type { border-top: none; }
.cpt-hit-changed { background: rgba(255,215,64,0.05); border-radius: var(--radius-xs); padding-left: 0.4rem; padding-right: 0.4rem; }

.cpt-hit-label {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-mid);
  min-width: 120px;
}

.cpt-hit-compare {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}
.cpt-hit-val {
  color: var(--text-bright);
  white-space: nowrap;
  font-family: 'Exo 2', sans-serif;
  font-size: 1.05rem;
}
.cpt-hit-before { color: var(--text-dim); font-size: 0.92rem; }
.cpt-crit { color: var(--red); font-size: 0.82em; font-weight: 700; margin-left: 2px; }
.cpt-hit-arrow { color: var(--text-dim); font-weight: 900; }
.cpt-missing { color: var(--text-dim); font-style: italic; font-weight: 500; }

.cpt-hit-val.cpt-buff { color: var(--green); text-shadow: 0 0 12px rgba(76,175,130,0.3); }
.cpt-hit-val.cpt-nerf { color: var(--red); text-shadow: 0 0 12px rgba(239,83,80,0.3); }

.cpt-hit-delta {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.cpt-hit-delta.cpt-buff { color: var(--green); background: var(--green-dim); }
.cpt-hit-delta.cpt-nerf { color: var(--red); background: var(--red-dim); }
.cpt-hit-delta.cpt-neutral { color: var(--text-dim); background: var(--surface-3); }

.cpt-hit-bar-track {
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-4);
  overflow: hidden;
  flex-shrink: 0;
}
.cpt-hit-bar-fill { height: 100%; border-radius: 3px; transition: width 0.25s ease; }
.cpt-hit-bar-fill.cpt-buff { background: var(--green); box-shadow: 0 0 8px rgba(76,175,130,0.5); }
.cpt-hit-bar-fill.cpt-nerf { background: var(--red); box-shadow: 0 0 8px rgba(239,83,80,0.5); }

@media (max-width: 720px) {
  .cpt-main-grid { grid-template-columns: 1fr; }
  .cpt-patch-selectors-v2 { flex-direction: column; align-items: stretch; }
  .cpt-swap-btn { align-self: center; }
  .cpt-result-header { flex-direction: column; align-items: flex-start; }
  .cpt-hit-compare { font-size: 0.9rem; }
}