/* ============================================================
   PKMN PRO — ASSISTANT | BUILDER & META
   Palette: Dark Charcoal + Logo Red (#e03030) + Minimal
   ============================================================ */

/* ===== CSS VARIABLES — DARK THEME (default) ===== */
:root {
  /* Backgrounds — charcoal grays, NOT purple */
  --bg-base:    #1a1a1a;
  --bg-card:    #222222;
  --bg-card2:   #2a2a2a;
  --bg-card3:   #313131;
  --bg-hover:   #383838;

  /* Borders */
  --border:        #3a3a3a;
  --border-bright: #4e4e4e;

  /* Brand colors from logo */
  --accent:     #e03030;   /* pokeball red */
  --accent-dim: #a02020;
  --accent2:    #4a5568;   /* logo dark slate for PRO text */
  --accent2-light: #718096;
  --gold:       #d4a843;

  /* Text */
  --text:       #f0f0f0;
  --text-dim:   #aaaaaa;
  --text-muted: #666666;

  /* Misc */
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:       0 4px 24px rgba(0,0,0,0.6);
  --shadow-card:  0 2px 10px rgba(0,0,0,0.35);
  --transition:   0.15s ease;

  /* Tier colors */
  --tier-s:  #e63946;
  --tier-sm: #f4622a;
  --tier-ap: #f4922a;
  --tier-a:  #f4b62a;
  --tier-am: #f4d62a;
  --tier-bp: #c8d62a;
  --tier-b:  #78c832;
  --tier-bm: #32b850;
  --tier-cp: #20a870;
  --tier-c:  #2090a0;
  --tier-cm: #4070a8;
}

/* ===== PHOSPHOR ICONS ===== */
[class^="ph-"], [class*=" ph-"] {
  vertical-align: middle;
  line-height: 1;
}
.nav-icon [class^="ph-"],
.nav-icon [class*=" ph-"] { font-size: 18px; }
.icon-accent { color: var(--accent); }
.icon-gold   { color: var(--gold); }
.icon-dim    { color: var(--text-dim); }
.icon-muted  { color: var(--text-muted); }
.icon-good   { color: #4caf7d; }
.icon-warn   { color: #f0c040; }
.icon-danger { color: #f07070; }

/* ===== LIGHT THEME ===== */
html.light {
  --bg-base:    #f4f4f4;
  --bg-card:    #ffffff;
  --bg-card2:   #f8f8f8;
  --bg-card3:   #eeeeee;
  --bg-hover:   #e8e8e8;
  --border:        #d8d8d8;
  --border-bright: #c0c0c0;
  --accent:     #c42020;
  --accent-dim: #e05050;
  --accent2:    #4a5568;
  --accent2-light: #718096;
  --gold:       #b58a1a;
  --text:       #1a1a1a;
  --text-dim:   #555555;
  --text-muted: #999999;
  --shadow:      0 4px 20px rgba(0,0,0,0.1);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.07);
}

/* Light overrides */
html.light .poke-card               { background:#f2f2f2; border-color:#ddd; }
html.light .poke-card:hover         { background:#e8e8e8; box-shadow:0 3px 10px rgba(196,32,32,0.15); }
html.light .poke-card.in-team       { background:rgba(212,168,67,0.12); }
html.light .team-slot               { background:#f4f4f4; }
html.light .set-card                { background:#f2f2f2; }
html.light .blitz-tip               { background:#f2f2f2; }
html.light .synergy-row             { background:#f4f4f4; }
html.light .stat-box                { background:#f4f4f4; }
html.light .saved-team-card         { background:#f4f4f4; }
html.light .coverage-cell           { background:#f4f4f4; border-color:#ddd; }
html.light .search-input,
html.light .filter-select,
html.light .paste-area,
html.light .profile-input           { background:#fff; color:#1a1a1a; border-color:#ccc; }
html.light .nav-btn:hover           { background:#eeeeee; }
html.light .nav-btn.active          { background:#eeeeee; }
html.light .type-matrix th          { background:#eeeeee; }
html.light .sidebar-team-preview    { background:#f4f4f4; }
html.light .team-preview-slot       { background:#ebebeb; }
html.light .weakness-bar-wrap       { background:#e0e0e0; }
html.light .move-item               { background:#ebebeb; }
html.light #pokemon-detail          { background:#fff; border-left-color:#ddd; }
html.light .detail-header           { background:#fff; }
html.light #move-editor-modal       { background:#fff; }
html.light ::-webkit-scrollbar-track { background:#f0f0f0; }
html.light ::-webkit-scrollbar-thumb { background:#c0c0c0; }
html.light .coverage-cell.weak2  { background:rgba(196,32,32,0.10); border-color:rgba(196,32,32,0.28); }
html.light .coverage-cell.weak4  { background:rgba(196,32,32,0.22); border-color:rgba(196,32,32,0.45); }
html.light .coverage-cell.res2   { background:rgba(74,85,104,0.10); border-color:rgba(74,85,104,0.28); }
html.light .coverage-cell.res4   { background:rgba(74,85,104,0.22); border-color:rgba(74,85,104,0.40); }
html.light #sidebar { border-right-color:#ddd; }
html.light .rec-card { background:#f8f8f8 !important; }

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ===== LAYOUT ===== */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

/* ===== LOGO / BRAND ===== */
.sidebar-logo {
  padding: 16px 12px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo-img-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.logo-img-wrap img {
  height: 90px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  /* make it work on dark bg — the image has white bg, use mix-blend */
  /* we'll handle this via CSS filter for dark mode */
}

/* On dark theme: lighten the SVG tagline text (which is dark by default) */
html:not(.light) .logo-img-wrap img {
  /* SVG tagline (#333) becomes near-white via invert on tagline only — use filter hue trick */
  /* No-op: SVG inline CSS class handles this via .logo-tagline-text */
}

.logo-tagline {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

html:not(.light) .logo-img-wrap img {
  background: transparent;
}

/* ===== SIDEBAR USER WIDGET ===== */
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin: 0 8px 6px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 8px;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  padding: 4px 7px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-logout-btn:hover {
  background: rgba(224,48,48,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.nav-section {
  padding: 8px 0;
}

.nav-section-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 8px 16px 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.nav-btn:hover { background: var(--bg-card2); color: var(--text); }
.nav-btn.active {
  background: var(--bg-card2);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-btn .nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ===== THEME TOGGLE ===== */
#theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  width: calc(100% - 20px);
  margin: 0 10px;
}
#theme-toggle:hover { background: var(--bg-hover); color: var(--text); }

.theme-toggle-track {
  width: 32px; height: 18px;
  background: var(--border-bright);
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
html.light .theme-toggle-track { background: var(--accent2); }

.theme-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
html.light .theme-toggle-thumb { transform: translateX(14px); }

/* ===== SIDEBAR TEAM PREVIEW ===== */
.sidebar-team-preview {
  margin: 8px 10px;
  padding: 10px;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.team-preview-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.team-preview-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.team-preview-slot {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-card3);
  border-radius: 4px;
  border: 1px dashed var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.team-preview-slot img {
  width: 90%; height: 90%;
  object-fit: contain;
  image-rendering: pixelated;
}

.team-preview-slot .slot-empty {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1px dashed var(--text-muted);
  opacity: 0.35;
}

/* ===== MAIN ===== */
#main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.tab-content.active { display: flex; flex-direction: column; gap: 14px; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-title span { color: var(--accent); }

.page-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 160px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.filter-select {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--accent); }

/* ===== BUTTONS ===== */
.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-secondary { background: var(--bg-card2); color: var(--text); border: 1px solid var(--border-bright); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost     { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-bright); }
.btn-sm        { padding: 4px 9px; font-size: 11px; }

/* ===== TIER LIST ===== */
#meta-tier-list { display: flex; flex-direction: column; gap: 3px; }

.tier-row {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 58px;
  transition: border-color var(--transition);
}
.tier-row:hover { border-color: var(--border-bright); }

.tier-label {
  width: 52px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  letter-spacing: -1px;
}

.tier-pokemon-list {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 5px;
  background: var(--bg-card);
  align-items: center;
}

/* ===== POKE CARD ===== */
.poke-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  width: 70px;
  position: relative;
  overflow: hidden;
}
.poke-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(224,48,48,0.25);
  z-index: 2;
}
.poke-card.in-team {
  border-color: var(--gold);
  background: rgba(212,168,67,0.08);
}
.poke-card img {
  width: 50px; height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}
.poke-card-name {
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  max-width: 100%;
}
.poke-card-types { display: flex; gap: 2px; margin-top: 2px; }

/* ===== TYPE BADGE ===== */
.type-badge {
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  white-space: nowrap;
}

/* ===== TEAM BUILDER ===== */
.team-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.team-slot {
  background: var(--bg-card2);
  border: 2px dashed var(--border-bright);
  border-radius: var(--radius);
  padding: 10px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 175px;
  position: relative;
  transition: all var(--transition);
  cursor: pointer;
}
.team-slot.filled { border-style: solid; border-color: var(--border-bright); }
.team-slot.filled:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.team-slot-num {
  position: absolute; top: 6px; left: 8px;
  font-size: 9px; color: var(--text-muted); font-weight: 700;
}
.team-slot img {
  width: 72px; height: 58px;
  object-fit: contain;
  image-rendering: pixelated;
  margin-top: 4px;
}
.team-slot .slot-name   { font-size: 11px; font-weight: 700; text-align: center; color: var(--text); }
.team-slot .slot-item   { font-size: 9px; color: var(--text-dim); text-align: center; }
.team-slot .slot-role   { font-size: 9px; color: var(--text-muted); display:none; }

.team-slot .slot-remove {
  position: absolute; top: 5px; right: 5px;
  background: var(--accent-dim); border: none; color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition);
  z-index: 2;
}
.team-slot.filled:hover .slot-remove { opacity: 1; }

/* Set selector inline dentro del slot */
.team-slot .slot-set-select {
  width: 100%;
  font-size: 9px;
  background: var(--bg-card3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 4px;
  margin-top: 2px;
  cursor: pointer;
  text-align: center;
}

/* Botón editar set dentro del slot */
.team-slot .slot-edit-btn {
  width: 100%;
  font-size: 9px;
  background: rgba(76,201,240,0.08);
  color: var(--accent2-light);
  border: 1px solid rgba(76,201,240,0.2);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
}
.team-slot .slot-edit-btn:hover {
  background: rgba(76,201,240,0.18);
  color: #4cc9f0;
}

.team-slot .slot-empty-label {
  font-size: 11px; color: var(--text-muted);
  text-align: center; margin: auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}

.slot-add-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  letter-spacing: .3px;
}
.slot-add-btn:hover { background: var(--accent-dim); transform: translateY(-1px); }

/* ===== POKEMON SEARCH RESULTS ===== */
.search-result-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.search-result-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.search-result-card.in-team {
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}
.team-slot .slot-types {
  display: flex; gap: 2px; flex-wrap: wrap; justify-content: center;
}

/* ===== TYPE COVERAGE ===== */
.coverage-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}

.coverage-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2); border: 1px solid var(--border);
  font-size: 9px; text-align: center;
}
.coverage-cell.weak2 { background: rgba(224,48,48,0.18); border-color: rgba(224,48,48,0.38); }
.coverage-cell.weak4 { background: rgba(224,48,48,0.36); border-color: rgba(224,48,48,0.65); }
.coverage-cell.res2  { background: rgba(74,85,104,0.18); border-color: rgba(74,85,104,0.35); }
.coverage-cell.res4  { background: rgba(74,85,104,0.32); border-color: rgba(74,85,104,0.55); }
.coverage-cell.immune{ background: rgba(90,90,90,0.14);  border-color: rgba(90,90,90,0.28); }
.coverage-cell .cc-type  { font-size: 9px; color: var(--text-dim); }
.coverage-cell .cc-count { font-size: 14px; font-weight: 900; line-height: 1; }
.coverage-cell .cc-label { font-size: 8px; color: var(--text-muted); }

/* ===== DETAIL PANEL ===== */
#pokemon-detail {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 340px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
}
#pokemon-detail.open { transform: translateX(0); }

.detail-header {
  padding: 14px 16px;
  position: sticky; top: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
}
.detail-header h3 { font-size: 15px; font-weight: 700; }
.detail-close {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px;
  transition: color var(--transition);
}
.detail-close:hover { color: var(--accent); }

.detail-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }

.detail-sprite-row {
  display: flex; align-items: center; gap: 14px;
}
.detail-sprite {
  width: 90px; height: 74px;
  object-fit: contain;
  image-rendering: pixelated;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.detail-info { flex: 1; }
.detail-tier-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 4px; margin-bottom: 5px;
}
.detail-role { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ===== SET CARDS ===== */
.set-card {
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 10px;
  margin-bottom: 6px;
}
.set-name {
  font-size: 11px; font-weight: 700;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: 6px;
}
.set-item {
  display: flex; justify-content: space-between;
  font-size: 11px; margin-bottom: 3px;
}
.set-item .si-label { color: var(--text-muted); }
.set-item .si-value { color: var(--text); font-weight: 500; text-align: right; }

.moves-list { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.move-item {
  background: var(--bg-card3);
  border-radius: 4px; padding: 3px 8px;
  font-size: 11px; color: var(--text);
  border-left: 3px solid var(--accent2);
}

.detail-add-btn {
  width: 100%; padding: 10px;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background var(--transition);
}
.detail-add-btn:hover { background: var(--accent-dim); }
.detail-add-btn.in-team { background: var(--text-muted); cursor: not-allowed; }

/* ===== ANALYSIS ===== */
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.type-matrix { border-collapse: collapse; font-size: 10px; min-width: 100%; }
.type-matrix th, .type-matrix td {
  padding: 3px 4px; text-align: center;
  border: 1px solid var(--border); white-space: nowrap;
}
.type-matrix th { background: var(--bg-card2); font-size: 9px; color: var(--text-dim); font-weight: 600; }
.type-matrix td.mult-0   { background: rgba(80,80,80,0.2); color: var(--text-muted); }
.type-matrix td.mult-0_5 { background: rgba(74,85,104,0.2); color: var(--accent2-light); }
.type-matrix td.mult-2   { background: rgba(224,48,48,0.18); color: #ff8888; }
.type-matrix td.mult-4   { background: rgba(224,48,48,0.38); color: #ff5555; font-weight: 700; }
.type-matrix td.mult-1   { color: var(--text-muted); opacity: 0.4; }

.weakness-chart { display: flex; flex-direction: column; gap: 4px; }
.weakness-row { display: flex; align-items: center; gap: 8px; }
.weakness-row .wr-type { width: 66px; font-size: 11px; }
.weakness-bar-wrap {
  flex: 1; height: 15px;
  background: var(--bg-card3);
  border-radius: 4px; overflow: hidden;
}
.weakness-bar {
  height: 100%; border-radius: 4px; min-width: 4px;
  transition: width 0.3s ease;
  display: flex; align-items: center;
  padding: 0 4px; font-size: 9px;
  color: rgba(255,255,255,0.8); font-weight: 700;
}
.weakness-row .wr-count { font-size: 11px; font-weight: 700; width: 20px; text-align: right; }
.wr-weak .weakness-bar   { background: linear-gradient(90deg, #e03030, #f06060); }
.wr-resist .weakness-bar { background: linear-gradient(90deg, #4a5568, #718096); }

/* ===== BLITZ TIPS ===== */
.blitz-section { display: flex; flex-direction: column; gap: 6px; }
.blitz-tip {
  background: var(--bg-card2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  padding: 9px 12px; font-size: 12px;
}
.blitz-tip.info   { border-left-color: var(--accent2-light); }
.blitz-tip.good   { border-left-color: #32b850; }
.blitz-tip.warn   { border-left-color: var(--gold); }
.blitz-tip.danger { border-left-color: var(--accent); }
.blitz-tip-title  { font-size: 11px; font-weight: 700; margin-bottom: 3px; color: var(--text); }
.blitz-tip-body   { color: var(--text-dim); line-height: 1.4; }

/* ===== PASTE ===== */
.paste-area {
  width: 100%; min-height: 110px;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 10px; font-size: 11px;
  font-family: 'Consolas', monospace;
  resize: vertical; outline: none;
  transition: border-color var(--transition);
}
.paste-area:focus { border-color: var(--accent); }

/* ===== PROFILE ===== */
.profile-header { display: flex; align-items: center; gap: 18px; }
.profile-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: #fff;
  border: 3px solid var(--border-bright); flex-shrink: 0;
  text-transform: uppercase; letter-spacing: -1px;
  user-select: none;
}
.profile-name {
  font-size: 22px; font-weight: 700; color: var(--text);
}
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-box {
  background: var(--bg-card2); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 12px; text-align: center;
}
.stat-value  { font-size: 24px; font-weight: 900; color: var(--accent); }
.stat-label  { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.saved-teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px; }
.saved-team-card {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
  transition: all var(--transition);
}
.saved-team-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.saved-team-name { font-size: 13px; font-weight: 700; margin-bottom: 6px; }

.profile-input {
  background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 12px;
  border-radius: var(--radius-sm); font-size: 14px;
  outline: none; width: 200px;
  transition: border-color var(--transition);
}
.profile-input:focus { border-color: var(--accent); }

/* ===== SYNERGY ===== */
.synergy-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: var(--bg-card2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  margin-bottom: 4px;
}
.synergy-mon  { font-size: 12px; font-weight: 600; width: 130px; }
.synergy-types { display: flex; gap: 3px; }
.synergy-bar-row { display: flex; gap: 2px; flex-wrap: wrap; }
.synergy-mult {
  font-size: 9px; padding: 2px 5px; border-radius: 3px; font-weight: 700;
}
.synergy-mult.x4   { background: rgba(224,48,48,0.38); color: #ff5555; }
.synergy-mult.x2   { background: rgba(224,48,48,0.2);  color: #ff9999; }
.synergy-mult.x0_5 { background: rgba(74,85,104,0.2);  color: var(--accent2-light); }
.synergy-mult.x0_25{ background: rgba(74,85,104,0.38); color: var(--accent2-light); }
.synergy-mult.x0   { background: rgba(80,80,80,0.2);   color: var(--text-muted); }

/* ===== BADGES ===== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  background: var(--bg-card3); color: var(--text-dim);
}
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.empty-state {
  padding: 36px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}
.empty-state .es-icon { font-size: 32px; margin-bottom: 10px; display: block; }

/* ===== ADVISOR ===== */
.rec-card { transition: border-color 0.15s, transform 0.15s; }
.rec-card:hover { transform: translateY(-2px); }
#advisor-recommendations { min-height: 80px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== TOAST ===== */
#toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card2);
  border: 1px solid var(--border-bright);
  color: var(--text); padding: 9px 20px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  z-index: 9999; transition: transform 0.25s ease;
  white-space: nowrap; box-shadow: var(--shadow);
}
#toast.show    { transform: translateX(-50%) translateY(0); }
#toast.success { border-color: #32b850; color: #66dd88; }
#toast.error   { border-color: var(--accent); color: #ff8888; }
#toast.info    { border-color: var(--accent2-light); color: var(--accent2-light); }

/* ===== MOVE EDITOR OVERLAY ===== */
#move-editor-overlay input[type=number]::-webkit-inner-spin-button,
#move-editor-overlay input[type=number]::-webkit-outer-spin-button { opacity: 1; }

/* ===== DRAWER NAV BUTTONS ===== */
.drawer-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-align: left;
}
.drawer-nav-btn:hover { background: var(--bg-card2); color: var(--text); }
.drawer-nav-btn.active {
  background: var(--bg-card2);
  color: var(--accent);
  border-left-color: var(--accent);
}
.drawer-nav-btn span:first-child { font-size: 18px; width: 22px; text-align: center; }

/* ===================================================
   RESPONSIVE
   =================================================== */

/* ── TABLET (≤900px) ── */
@media (max-width: 900px) {
  #hamburger-btn { display: flex !important; }

  #sidebar { width: 56px; min-width: 56px; }
  .sidebar-logo, .nav-section-label, .nav-btn span:not(.nav-icon),
  .sidebar-team-preview, .logo-tagline, .sidebar-user-details,
  .sidebar-user-name, .sidebar-user-role, .sidebar-logout-btn,
  #theme-toggle { display: none; }
  .sidebar-user { justify-content: center; padding: 8px; }
  .nav-btn { justify-content: center; padding: 13px 8px; border-left: 3px solid transparent; }
  .nav-btn .nav-icon { font-size: 18px; width: auto; }
  .team-slots { grid-template-columns: repeat(3, 1fr); }
  .coverage-grid { grid-template-columns: repeat(6, 1fr); }
  .analysis-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  #pokemon-detail { width: 300px; }
}

/* ── MOBILE (≤600px) ── */
@media (max-width: 600px) {
  html, body { overflow: hidden; }

  /* Layout: sidebar se convierte en bottom nav */
  #app { flex-direction: column; }

  #sidebar {
    width: 100%;
    min-width: 100%;
    height: 56px;
    flex-direction: row;
    order: 2;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
  }

  /* Ocultar todo excepto los botones de nav */
  .sidebar-logo, .nav-section-label, .sidebar-team-preview,
  .sidebar-user, #theme-toggle, .logo-tagline { display: none !important; }

  /* Sección de navegación en row */
  .nav-section:first-of-type {
    display: flex;
    flex-direction: row;
    padding: 0;
    flex: 1;
    width: 100%;
  }

  /* Sección de abajo (theme + user) oculta en mobile */
  .nav-section[style*="margin-top: auto"] { display: none !important; }

  .nav-btn {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: 9px;
    border-left: none !important;
    border-top: 3px solid transparent;
    border-bottom: none;
    justify-content: center;
    align-items: center;
    height: 56px;
  }
  .nav-btn span:not(.nav-icon) { font-size: 9px; display: block; }
  .nav-btn .nav-icon { font-size: 17px; width: auto; }
  .nav-btn.active { border-top-color: var(--accent); background: var(--bg-card2); }

  /* Main ocupa todo */
  #main { order: 1; flex: 1; min-height: 0; overflow: hidden; }

  .tab-content { padding: 12px 10px; gap: 10px; }

  /* Page header compacto */
  .page-header { gap: 8px; }
  .page-title { font-size: 16px; }
  .page-header > div:last-child { flex-wrap: wrap; gap: 4px; }

  /* Team slots: 2 columnas en móvil */
  .team-slots { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .team-slot { min-height: 110px; }
  .team-slot img { width: 52px; height: 42px; }

  /* Coverage: 3 col */
  .coverage-grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }

  /* Stats: 2 col */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Analysis: 1 col */
  .analysis-grid { grid-template-columns: 1fr; }

  /* Detail panel: full width */
  #pokemon-detail {
    width: 100%;
    top: auto;
    bottom: 56px; /* sobre la navbar */
    height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border);
    transform: translateY(100%);
  }
  #pokemon-detail.open { transform: translateY(0); }

  /* Filter bar: wrap */
  .filter-bar { flex-direction: column; gap: 6px; }
  .filter-bar .search-input,
  .filter-bar .filter-select { width: 100%; min-width: unset; }

  /* Advisor grid: 1 col */
  #advisor-recommendations { grid-template-columns: 1fr !important; }

  /* Tier list: cards más pequeñas */
  .poke-card { width: 62px; }
  .poke-card img { width: 44px; height: 34px; }

  /* Cards padding reducido */
  .card { padding: 10px 12px; }

  /* Profile header: columna */
  .profile-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .profile-input { width: 100%; }

  /* Saved teams: 1 col */
  .saved-teams-grid { grid-template-columns: 1fr; }

  /* Paste area más pequeña */
  .paste-area { min-height: 80px; }

  /* Move editor: ocupa casi toda la pantalla */
  #move-editor-overlay { padding-top: 0 !important; align-items: flex-end !important; }
  #move-editor-modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    max-height: 92vh !important;
  }

  /* Pokemon search modal */
  #poke-search-overlay { padding-top: 0 !important; align-items: flex-end !important; }
  #poke-search-overlay > div {
    width: 100% !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    max-height: 88vh !important;
  }

  /* Toast arriba del bottom nav */
  #toast { bottom: 68px; }

  /* Advisor 2-col grid → 1 col */
  #tab-advisor > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Synergy row responsive */
  .synergy-mon { width: 90px; font-size: 11px; }

  /* Btn más accesibles en táctil */
  .btn { padding: 9px 14px; }
  .btn-sm { padding: 6px 10px; }
  .slot-add-btn { padding: 8px 14px; }
}

/* ── SMALL MOBILE (≤380px) ── */
@media (max-width: 380px) {
  .team-slots { grid-template-columns: repeat(2, 1fr); }
  .poke-card { width: 56px; }
  .poke-card img { width: 40px; height: 30px; }
  .coverage-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-btn span:not(.nav-icon) { display: none; }
  .nav-btn { padding: 8px 2px; }
}
