/* ─────────────────────────────────────────────
   PokéDex Tracker — Card extras, notes, regions,
   loading states, and the Pokémon detail drawer.
   ───────────────────────────────────────────── */

/* ── Shiny ── */
.shiny-btn {
  position: absolute; top: 5px; right: 5px;
  background: none; border: none; font-size: 14px; line-height: 1;
  padding: 2px; cursor: pointer; opacity: 0.2;
  transition: opacity 0.15s ease, transform 0.15s ease; z-index: 2;
}
.poke-card:hover .shiny-btn { opacity: 0.55; }
.shiny-btn.shiny-on         { opacity: 1; }
.shiny-btn:hover            { transform: scale(1.3); opacity: 1 !important; }
.poke-card.shiny {
  box-shadow: 0 0 14px 3px rgba(255,215,0,0.35), inset 0 0 0 1px rgba(255,215,0,0.3);
  border-color: rgba(255,215,0,0.4);
}
.poke-card.shiny .poke-name { color: #ffd700; }
.filter-pill-shiny.active { background: linear-gradient(135deg,#ffd700,#ff8c00); color: #0a0a12; border-color: #ffd700; }
.hdr-shiny { font-size: 12px; color: #ffd700; margin-top: 4px; text-align: right; font-weight: 600; letter-spacing: 0.02em; }

/* ── Types ── */
.type-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.type-badge {
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  color: white; text-transform: capitalize;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4); letter-spacing: 0.02em;
}

/* ── Info button on card ── */
.info-btn {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(255,255,255,0.13);
  border: 1.5px solid rgba(255,255,255,0.25);
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 13px; line-height: 21px; text-align: center;
  color: #fff; cursor: pointer; opacity: 1;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  z-index: 2; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.info-btn:hover  { background: var(--pokeyellow); border-color: var(--pokeyellow); color: #000; transform: scale(1.15); }
.info-btn:active { transform: scale(0.95); }
/* Light mode: white button on white card is invisible — use dark ink instead */
[data-theme="light"] .info-btn {
  background: rgba(0,0,0,0.10);
  border-color: rgba(0,0,0,0.22);
  color: #333;
}
[data-theme="light"] .info-btn:hover { background: var(--pokeyellow); border-color: var(--pokeyellow); color: #000; }

/* ── Gen accuracy note ── */
.gen-accuracy-note {
  font-size: 11px; color: var(--text-muted);
  background: rgba(255,193,7,0.08); border: 1px solid rgba(255,193,7,0.2);
  border-radius: 6px; padding: 7px 10px; margin: 0 0 10px;
  line-height: 1.5;
}

/* ── Notes Panel ── */
.notes-panel { margin: 0 0 16px; border: 1px solid var(--border2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.notes-toggle { width:100%; display:flex; align-items:center; gap:8px; background:var(--surface2); border:none; color:var(--text-muted); font-size:13px; font-weight:600; padding:10px 14px; cursor:pointer; text-align:left; transition:background 0.15s; }
.notes-toggle:hover { background: var(--card-hover); color: var(--text); }
.notes-toggle-icon { font-size: 15px; }
.notes-chevron { margin-left: auto; font-size: 11px; opacity: 0.6; }
.notes-body { padding: 12px 14px 10px; }
.notes-textarea {
  width: 100%; min-height: 100px; background: var(--bg);
  border: 1px solid var(--border2); border-radius: 8px; color: var(--text);
  font-size: 13px; font-family: inherit; line-height: 1.6;
  padding: 10px 12px; resize: vertical; box-sizing: border-box; transition: border-color 0.15s;
}
.notes-textarea:focus { outline: none; border-color: var(--pokeyellow); box-shadow: 0 0 0 2px rgba(255,193,7,0.15); }
.notes-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; min-height: 20px; }
.notes-hint { font-size: 11px; color: var(--text-dim); }
.notes-saved-flash { font-size: 11px; color: #2a8703; font-weight: 600; animation: fadeout 2s ease forwards; }
@keyframes fadeout { 0%,60% { opacity:1; } 100% { opacity:0; } }

/* ── Region Sections ── */
.region-section { margin-bottom: 36px; }
.region-header {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  margin-bottom: 12px; cursor: pointer; user-select: none; transition: var(--transition);
}
.region-header:hover { background: var(--card); border-color: var(--border2); }
.region-emoji  { font-size: 22px; }
.region-name   { font-size: 15px; font-weight: 700; }
.region-stats  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.region-progress-mini { flex: 1; max-width: 120px; margin-left: auto; margin-right: 12px; }
.region-toggle { color: var(--text-dim); font-size: 12px; transition: transform 0.2s; }
.region-section.collapsed .region-toggle { transform: rotate(-90deg); }
.region-section.collapsed .region-grid  { display: none; }
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }

/* ── Loading State ── */
.loading-block { text-align: center; padding: 80px 20px; max-width: 360px; margin: 0 auto; }
.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border2); border-top-color: var(--pokeyellow);
  border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 13px; font-weight: 700; color: var(--pokeyellow); margin-bottom: 8px; }
.loading-sub   { font-size: 12px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.load-error    { font-size: 12px; color: #ef5350; margin-top: 12px; line-height: 1.6; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 64px 20px; color: var(--text-muted); }
.empty-icon  { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-text  { font-size: 13px; }

/* ── Footer ── */
.footer { text-align: center; padding: 32px 20px; font-size: 11px; color: var(--text-dim); border-top: 1px solid var(--border); margin-top: 24px; }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* ── Cartridge Images ── */
.cart-pair { display: flex; align-items: flex-end; flex-shrink: 0; gap: 4px; }
.game-cart-img { object-fit: contain; object-position: center bottom; flex-shrink: 0; filter: drop-shadow(0 3px 10px rgba(0,0,0,0.6)); }
.game-cart-lg  { width: 56px; height: 88px; }
.cart-pair .cart-a { transform: rotate(-5deg); transform-origin: bottom center; }
.cart-pair .cart-b { transform: rotate(5deg);  transform-origin: bottom center; }

/* ── Utilities ── */
.mt-4  { margin-top: 16px; }
.mb-8  { margin-bottom: 32px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ═══════════════════════════════════════════════
   POKÉMON DETAIL DRAWER
   Slides in from the right (bottom on mobile)
   ═══════════════════════════════════════════════ */

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 400;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease;
}
.drawer-backdrop.open {
  opacity: 1; pointer-events: all;
}

.poke-drawer {
  position: fixed; top: 0; right: 0;
  width: 420px; max-width: 100vw; height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  z-index: 401;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.poke-drawer.open { transform: translateX(0); }

/* Mobile: bottom sheet */
@media (max-width: 520px) {
  .poke-drawer {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 85vh;
    border-left: none; border-top: 1px solid var(--border2);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .poke-drawer.open { transform: translateY(0); }
}

.drawer-close {
  position: absolute; top: 12px; right: 14px;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text-muted); border-radius: 50%;
  width: 32px; height: 32px; font-size: 18px; line-height: 30px;
  text-align: center; cursor: pointer; z-index: 1;
  transition: background 0.15s, color 0.15s;
}
.drawer-close:hover { background: var(--card-hover); color: var(--text); }

.drawer-scroll { flex: 1; overflow-y: auto; padding: 20px 20px 40px; scroll-behavior: smooth; }
.drawer-scroll::-webkit-scrollbar { width: 4px; }
.drawer-scroll::-webkit-scrollbar-track { background: transparent; }
.drawer-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* Drawer header */
.drawer-hero {
  display: flex; gap: 16px; align-items: flex-start;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-sprite-wrap {
  position: relative; flex-shrink: 0;
  width: 96px; height: 96px;
  background: var(--surface2); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.drawer-sprite { width: 88px; height: 88px; image-rendering: pixelated; }
.drawer-shiny-toggle {
  position: absolute; bottom: 2px; right: 2px;
  background: none; border: none; font-size: 14px;
  cursor: pointer; opacity: 0.4; transition: opacity 0.15s;
}
.drawer-shiny-toggle:hover,
.drawer-shiny-toggle.active { opacity: 1; }
.drawer-info { flex: 1; min-width: 0; }
.drawer-num  { font-size: 11px; color: var(--text-dim); font-weight: 600; margin-bottom: 2px; }
.drawer-name { font-size: 22px; font-weight: 800; text-transform: capitalize; line-height: 1.1; margin-bottom: 6px; }
.drawer-types { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.drawer-type-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; color: white; text-transform: capitalize;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.drawer-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* Drawer sections */
.drawer-section { margin-bottom: 20px; }
.drawer-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-dim);
  margin-bottom: 8px;
}

/* Flavor text */
.drawer-flavor {
  font-size: 13px; line-height: 1.65; color: var(--text-muted);
  font-style: italic;
}

/* Stat bars */
.stat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.stat-name { font-size: 10px; color: var(--text-dim); width: 72px; text-align: right; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-val  { font-size: 11px; font-weight: 700; width: 28px; flex-shrink: 0; }
.stat-bar-track { flex: 1; height: 6px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.stat-bar-fill  { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(.4,0,.2,1); }

/* Type matchups */
.matchup-group { margin-bottom: 8px; }
.matchup-label { font-size: 10px; color: var(--text-dim); margin-bottom: 4px; }
.matchup-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.matchup-chip {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 12px; color: white; text-transform: capitalize;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Evolution chain */
.evo-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.evo-step  { display: flex; align-items: center; gap: 4px; }
.evo-node  {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; padding: 6px 8px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
  min-width: 72px; max-width: 90px;
}
.evo-node:hover { background: var(--card-hover); border-color: var(--border2); }
.evo-node.current { border-color: var(--pokeyellow); background: rgba(255,193,7,0.08); }
.evo-sprite { width: 52px; height: 52px; image-rendering: pixelated; }
.evo-name  { font-size: 9px; font-weight: 600; text-transform: capitalize; color: var(--text-muted); }
.evo-arrow { font-size: 14px; color: var(--text-dim); }
.evo-trigger { font-size: 9px; color: var(--text-dim); text-align: center; max-width: 56px; line-height: 1.2; }
/* Inline trigger shown inside each branch sibling, under its name */
.evo-trigger-inline {
  display: block;
  font-size: 9px;
  color: var(--pokeyellow);
  text-align: center;
  line-height: 1.3;
  margin-top: 2px;
  max-width: 72px;
  word-break: break-word;
}
.evo-branch { display: flex; flex-direction: column; gap: 6px; }

/* Abilities */
.ability-list { display: flex; flex-direction: column; gap: 5px; }
.ability-item {
  background: var(--surface2); border-radius: 8px;
  padding: 7px 10px; font-size: 12px;
}
.ability-name { font-weight: 600; text-transform: capitalize; color: var(--text); }
.ability-hidden { font-size: 10px; color: var(--pokeyellow); margin-left: 4px; }
.ability-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

/* Encounter locations */
.location-list { display: flex; flex-wrap: wrap; gap: 5px; }
.location-chip {
  font-size: 11px; background: var(--surface2);
  border: 1px solid var(--border2); border-radius: 8px;
  padding: 3px 9px; color: var(--text-muted); text-transform: capitalize;
}

/* ── DV/IV/EV Tracker (drawer) ── */
.st-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.st-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.st-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.st-level-row {
  margin-bottom: 8px;
}
.st-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.st-input {
  width: 64px;
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12px;
}
.st-input:disabled { opacity: 0.45; }
.st-summary {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}
.st-calc {
  margin-top: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.st-calc-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.st-calc-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.st-calc-chip {
  font-size: 11px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 3px 8px;
}
.st-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.st-status {
  font-size: 11px;
  color: var(--text-dim);
}

/* Drawer loading / error */
.drawer-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 200px; gap: 12px; color: var(--text-dim);
}
.drawer-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border2); border-top-color: var(--pokeyellow);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* ── Type Chart Panel ── */
.type-chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.type-chart-toggle {
  width: 100%; background: none; border: none;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; cursor: pointer;
  color: var(--text); font-size: 13px; font-weight: 600;
  text-align: left;
}
.type-chart-toggle:hover { background: var(--surface2); }
.type-chart-icon { font-size: 15px; }
.type-chart-chevron { margin-left: auto; font-size: 10px; color: var(--text-dim); }

.type-chart-body { padding: 0 10px 10px; }
.type-chart-controls {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.type-chart-mode-group {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
}
.type-chart-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
}
.type-chart-mode-btn:hover { background: var(--card-hover); color: var(--text); }
.type-chart-mode-btn.active {
  background: var(--pokeyellow);
  color: #0a0a12;
}
.type-chart-search-wrap {
  position: relative;
  min-width: 180px;
  flex: 1;
  max-width: 280px;
}
.type-chart-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: 0.7;
}
.type-chart-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px 6px 28px;
  font-size: 12px;
}
.type-chart-search:focus {
  outline: none;
  border-color: rgba(255,193,7,0.4);
}
.type-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
}
.type-chart-row {
  display: grid;
  grid-template-columns: 104px 1fr 1fr 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
}
.type-chart-attack { padding-top: 2px; }
.type-chart-col-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.type-chart-hidden-col { display: none; }
.type-chart-grid.type-chart-defense-mode .type-chart-col-offense { display: none; }
.type-chart-grid.type-chart-defense-mode .type-chart-col-defense { display: block; }
.type-chart-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 20px;
}
.type-chart-empty {
  font-size: 11px;
  color: var(--text-dim);
}
.type-badge-se { background: #2e7d32; }
.type-badge-nve { background: #a66a00; }
.type-badge-immune { background: #455a64; }
.type-chart-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

@media (max-width: 720px) {
  .type-chart-controls { align-items: stretch; }
  .type-chart-search-wrap { max-width: none; }
  .type-chart-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── Gym Guide Panel ── */
.gym-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.gym-toggle {
  width: 100%; background: none; border: none;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; cursor: pointer;
  color: var(--text); font-size: 13px; font-weight: 600;
  text-align: left;
}
.gym-toggle:hover { background: var(--surface2); }
.gym-toggle-icon { font-size: 15px; }
.gym-chevron { margin-left: auto; font-size: 10px; color: var(--text-dim); }

.gym-panel-body { padding: 0 10px 10px; }

.gp-section { margin-top: 10px; }
.gp-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 4px 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.gp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
}

.gp-check {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  width: 26px;
  height: 24px;
  flex-shrink: 0;
}

.gp-check-done {
  border-color: #2fb86f;
  background: rgba(47, 184, 111, .18);
}

.gp-row-done {
  opacity: .75;
}

.gp-next-card {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 4px 2px 10px;
  background: var(--surface2);
  font-size: 12px;
  color: var(--text);
}
.gp-row:last-child { border-bottom: none; }

.gp-emoji { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }

.gp-info { flex: 0 0 140px; }
.gp-leader { font-size: 13px; font-weight: 600; color: var(--text); }
.gp-meta   { font-size: 10px; color: var(--text-dim); margin-top: 1px; }

.gp-types { flex: 1; min-width: 0; }
.gp-type-line   { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
.gp-counter-line { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.gp-counter-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  color: var(--text-dim); letter-spacing: 0.06em; margin-right: 2px;
}

@media (max-width: 480px) {
  .gp-info    { flex: 0 0 110px; }
  .gp-leader  { font-size: 12px; }
}