:root {
  --color-bg: #f0f0f0;
  --color-surface: #0d0d0d;
  --color-surface2: #1a1a1a;
  --color-primary: #f5c400;
  --color-primary-dark: #c9a000;
  --color-text-light: #f0f0f0;
  --color-text-muted: #888;
  --color-border: #2a2a2a;
  --color-border-light: #3a3a3a;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px rgba(245,196,0,0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --nav-height: 68px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: var(--nav-height);
}

/* ===== HEADER ===== */
.app-header {
  background-color: var(--color-surface);
  color: var(--color-text-light);
  padding: 1.25rem 1.5rem;
  border-bottom: 3px solid var(--color-primary);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 2px;
}

.app-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--color-primary);
  text-transform: uppercase;
}

.app-header > p {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
}

/* Pokéball decorativa */
.pokeball-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--color-primary);
  background: linear-gradient(
    to bottom,
    #ffffff 0%, #ffffff 38%,
    #f5c400 38%, #f5c400 47%,
    #0d0d0d 47%, #0d0d0d 53%,
    #f5c400 53%, #f5c400 62%,
    #ffffff 62%, #ffffff 100%
  );
  position: relative;
  flex-shrink: 0;
}
.pokeball-icon::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 7px; height: 7px;
  background: #0d0d0d;
  border: 2px solid var(--color-primary);
  border-radius: 50%;
}

/* ===== MAIN ===== */
.app-container {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
  width: 100%;
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== CARDS ===== */
.pokemon-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  color: var(--color-text-light);
  position: relative;
  overflow: visible;   /* IMPORTANTE: não cortar o dropdown autocomplete */
  margin-bottom: 1rem;
  transition: box-shadow 0.3s ease;
}
.pokemon-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 4px;
  background: var(--color-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.pokemon-card:hover { box-shadow: var(--shadow-glow); }

.pokemon-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-light);
}
.pokemon-card h2 i { color: var(--color-primary); font-size: 1rem; }

/* ===== SEARCH ===== */
.search-container {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  position: relative;
  overflow: visible;  /* não cortar dropdown filho */
}
.autocomplete-wrapper {
  flex: 1;
  position: relative;
  overflow: visible;  /* necessário para o dropdown aparecer abaixo */
}

input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background: var(--color-surface2);
  color: var(--color-text-light);
  font-size: 0.95rem;
  font-family: 'Outfit', sans-serif;
  transition: border-color 0.25s, box-shadow 0.25s;
}
input[type="text"]::placeholder { color: #555; }
input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(245,196,0,0.15);
}

/* ===== AUTOCOMPLETE DROPDOWN ===== */
.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #111;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 9999;  /* acima de tudo */
  list-style: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) #111;
}
.suggestions-dropdown::-webkit-scrollbar { width: 5px; }
.suggestions-dropdown::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 3px; }

.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text-light);
  text-transform: capitalize;
  border-bottom: 1px solid #1e1e1e;
  transition: background 0.15s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active {
  background: var(--color-primary);
  color: var(--color-surface);
  font-weight: 600;
}

/* ===== BUTTONS ===== */
button {
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-primary);
  color: var(--color-surface);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
button:hover {
  background: #fff;
  color: var(--color-surface);
  transform: scale(1.04);
}
button:active { transform: scale(0.96); }

.primary-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  background: var(--color-surface);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  justify-content: center;
}
.primary-btn:hover {
  background: var(--color-primary);
  color: var(--color-surface);
  box-shadow: var(--shadow-glow);
}

/* ===== MOVE SELECTION ===== */
.move-selection { margin-top: 0.75rem; }
.move-selection label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #bbb;
}
.move-selection label i { color: var(--color-primary); }

/* ===== VS DIVIDER ===== */
.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0 1rem;
}
.vs-divider::before,
.vs-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.vs-divider span {
  background: var(--color-surface);
  color: var(--color-primary);
  padding: 6px 18px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.9rem;
  margin: 0 14px;
  border: 2px solid var(--color-primary);
}

/* ===== SPRITE PREVIEW ===== */
.preview-container {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #111;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  border: 1px solid #222;
  animation: fadeIn 0.35s ease-out;
}
.preview-container img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
  flex-shrink: 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}
.stat-badge {
  background: #1e1e1e;
  padding: 5px 4px;
  border-radius: 6px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #aaa;
  border-left: 2px solid var(--color-primary);
}
.stat-badge span {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--color-primary);
}

/* ===== RESULT CARD ===== */
.actions-container { margin: 1rem 0; }

.result-card {
  background: var(--color-primary);
  color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-glow);
  animation: slideUp 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
  margin-top: 0.5rem;
}
.result-card h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.result-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
}

/* ===== POKÉDEX VIEW ===== */
.dex-result {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  animation: slideUp 0.4s ease-out;
  margin-top: 0.75rem;
}
.dex-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 1.25rem;
  background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
  border-bottom: 2px solid var(--color-primary);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #2a2a2a;
  color: var(--color-text-light);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  z-index: 10;
}
.close-btn:hover {
  background: var(--color-primary);
  color: var(--color-surface);
  transform: rotate(90deg);
}
.dex-header img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
.dex-info { flex: 1; }
.dex-number {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 700;
  letter-spacing: 1px;
}
.dex-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  text-transform: capitalize;
  margin: 4px 0 8px;
}
.type-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.type-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
}

/* Type colors */
.type-fire    { background: #FF7C00; }
.type-water   { background: #6390F0; }
.type-grass   { background: #7AC74C; }
.type-electric{ background: #F7D02C; color: #000; }
.type-psychic { background: #F95587; }
.type-ice     { background: #96D9D6; color: #000; }
.type-dragon  { background: #6F35FC; }
.type-dark    { background: #705746; }
.type-fairy   { background: #D685AD; }
.type-fighting{ background: #C22E28; }
.type-flying  { background: #A98FF3; }
.type-poison  { background: #A33EA1; }
.type-ground  { background: #E2BF65; color: #000; }
.type-rock    { background: #B6A136; }
.type-bug     { background: #A6B91A; }
.type-ghost   { background: #735797; }
.type-steel   { background: #B7B7CE; color: #000; }
.type-normal  { background: #A8A878; }

.dex-section {
  padding: 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.dex-section:last-child { border-bottom: none; }
.dex-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Stat bars */
.stat-row { margin-bottom: 8px; }
.stat-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #bbb;
  margin-bottom: 4px;
  font-weight: 600;
}
.stat-row-header strong { color: var(--color-primary); }
.stat-bar-bg {
  height: 8px;
  background: #1e1e1e;
  border-radius: 4px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Abilities */
.abilities-container { display: flex; gap: 8px; flex-wrap: wrap; }
.ability-badge {
  background: var(--color-surface2);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
  transition: all 0.2s;
}
.ability-badge.hidden-ability {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--color-surface);
  border-top: 2px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  transform: none;
}
.nav-btn i { font-size: 1.3rem; transition: all 0.2s; }
.nav-btn:hover {
  background: none;
  color: var(--color-text-light);
  transform: none;
}
.nav-btn.active { color: var(--color-primary); }
.nav-btn.active i {
  filter: drop-shadow(0 0 6px rgba(245,196,0,0.6));
  transform: scale(1.1);
}

/* ===== POKÉDEX MOVES ===== */
.moves-gen-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.moves-group {
  margin-bottom: 1rem;
}
.moves-group:last-child { margin-bottom: 0; }
.moves-group-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #888;
  margin-bottom: 6px;
}
.moves-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.move-badge {
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #1a1a1a;
  color: var(--color-text-light);
  border: 1px solid var(--color-border-light);
  text-transform: capitalize;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all 0.15s ease;
  line-height: 1.3;
}
.move-badge:hover {
  background: var(--color-primary);
  color: var(--color-surface);
  border-color: var(--color-primary);
  transform: scale(1.04);
}
.move-badge em {
  font-style: normal;
  font-size: 0.68rem;
  opacity: 0.7;
  margin-left: 3px;
}
/* Cores por método de aprendizado */
.move-level   { border-color: #4FC14E; }
.move-machine { border-color: #6890F0; }
.move-egg     { border-color: #F85888; }
.move-tutor   { border-color: #F7D02C; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== GEN SELECTOR ===== */
.gen-selector-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.gen-selector-card > label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.gen-selector-card > label i { color: var(--color-primary); }

.gen-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.gen-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--color-border-light);
  background: #1a1a1a;
  color: #888;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all 0.18s ease;
  min-width: 36px;
  text-align: center;
  white-space: nowrap;
}
.gen-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(245,196,0,0.08);
  transform: none;
}
.gen-btn.active {
  background: var(--color-primary);
  color: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(245,196,0,0.35);
}

/* ===== POKÉDEX FEATURED ===== */
.dex-featured {
  margin-top: 1rem;
}
.dex-featured h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0.25rem;
}
.dex-featured h3 i { font-size: 0.8rem; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.featured-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.featured-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--color-border);
  transition: background 0.2s;
}
.featured-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 6px 20px rgba(245,196,0,0.2);
}
.featured-card:hover::before { background: var(--color-primary); }
.featured-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.featured-card span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-light);
  line-height: 1.2;
}

/* Skeleton loader para o featured grid */
.featured-skeleton {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  height: 120px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

/* Type border colors no featured-card */
.type-border-fire::before    { background: #FF7C00; }
.type-border-water::before   { background: #6390F0; }
.type-border-grass::before   { background: #7AC74C; }
.type-border-electric::before{ background: #F7D02C; }
.type-border-psychic::before { background: #F95587; }
.type-border-ice::before     { background: #96D9D6; }
.type-border-dragon::before  { background: #6F35FC; }
.type-border-dark::before    { background: #705746; }
.type-border-fairy::before   { background: #D685AD; }
.type-border-fighting::before{ background: #C22E28; }
.type-border-flying::before  { background: #A98FF3; }
.type-border-poison::before  { background: #A33EA1; }
.type-border-ground::before  { background: #E2BF65; }
.type-border-rock::before    { background: #B6A136; }
.type-border-bug::before     { background: #A6B91A; }
.type-border-ghost::before   { background: #735797; }
.type-border-steel::before   { background: #B7B7CE; }
.type-border-normal::before  { background: #A8A878; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== MOBILE 360px ===== */
@media (max-width: 400px) {
  .app-header { padding: 1rem; }
  .app-header h1 { font-size: 1.6rem; }
  .app-container { padding: 1rem 0.75rem; }
  .pokemon-card { padding: 1.2rem; }
  .preview-container img { width: 64px; height: 64px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dex-header img { width: 80px; height: 80px; }
  .dex-info h3 { font-size: 1.3rem; }
  .primary-btn { padding: 14px; font-size: 0.95rem; }
  .nav-btn { padding: 8px 16px; }
  input[type="text"] { font-size: 0.88rem; padding: 10px 12px; }
  button { padding: 10px 14px; font-size: 0.88rem; }
  .suggestion-item { padding: 9px 12px; font-size: 0.85rem; }
  .gen-selector-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .gen-btn { padding: 5px 10px; font-size: 0.75rem; min-width: 32px; }
  .featured-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .featured-card img { width: 56px; height: 56px; }
  .featured-card span { font-size: 0.68rem; }
}
