/* Basic reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root{
  --bg: #fafafa;
  --card: #ffffff;
  --muted: #666;
  --accent: #e53a34;
  --gameboy-width: 360px;
}

/* Type colors (official-ish palette) */
.type-badge { padding: 4px 8px; border-radius: 999px; color: #111; font-weight:600; font-size:0.85rem; display:inline-block; }
.type-fire { background:#F08030; color:#222 }
.type-water { background:#6890F0 }
.type-grass { background:#78C850 }
.type-electric { background:#F8D030 }
.type-ice { background:#98D8D8 }
.type-fighting { background:#C03028; color:white }
.type-poison { background:#A040A0; color:white }
.type-ground { background:#E0C068 }
.type-flying { background:#A890F0 }
.type-psychic { background:#F85888 }
.type-bug { background:#A8B820 }
.type-rock { background:#B8A038 }
.type-ghost { background:#705898; color:white }
.type-dragon { background:#7038F8; color:white }
.type-dark { background:#705848; color:white }
.type-steel { background:#B8B8D0 }
.type-fairy { background:#EE99AC }
.type-normal { background:#A8A878 }

body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; background:var(--bg); color:#111; min-height:100vh; }

.topbar {
  display:flex; 
  flex-direction: column;
  align-items:center; 
  justify-content:center; 
  padding:18px 36px; 
  gap:20px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(33,150,243,0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  display: none;
}

.back-to-top:hover {
  background: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(33,150,243,0.4);
}

.back-to-top.show {
  display: block;
}

/* Mobile hamburger menu */
.mobile-menu-toggle {
  display: none;
  background: #2196f3;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  margin-left: 10px;
}

.mobile-filters {
  display: none;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 10px;
  padding: 15px;
}

.mobile-filters-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-filters select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 16px;
}

.mobile-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-buttons button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-weight: 600;
}

.mobile-buttons button:hover {
  background: #f5f5f5;
}

.logo h1 { 
  font-size:48px; 
  letter-spacing: -2px; 
  color:#111; 
  margin-bottom: 10px;
  font-weight: 800;
}

.search-row { 
  display:flex; 
  flex-direction: column;
  align-items:center; 
  gap:12px; 
  width: 100%;
  max-width: 800px;
}

#searchInput { 
  width: 100%;
  padding:12px 14px; 
  border-radius:12px; 
  border:1px solid #ddd; 
  font-size:16px; 
  background:white; 
  box-shadow:0 1px 0 rgba(0,0,0,0.03); 
}

.filters-inline { 
  display:flex; 
  gap:8px; 
  align-items:center; 
  flex-wrap: wrap;
  justify-content: center;
}

select, button { 
  padding:10px 12px; 
  border-radius:10px; 
  border:1px solid #ddd; 
  background:white; 
  cursor:pointer; 
  font-weight:600; 
  transition: all 0.2s ease;
}

/* Hover effect for required filter */
#filterValue:not([disabled]):hover,
#mobileFilterValue:not([disabled]):hover {
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
  transform: translateY(-1px);
}

/* Required filter indicator */
#filterValue.required,
#mobileFilterValue.required {
  border-color: #ff9800;
  background: #fff3e0;
}

#filterValue.required:hover,
#mobileFilterValue.required:hover {
  border-color: #f57c00;
  box-shadow: 0 0 0 2px rgba(245, 124, 0, 0.2);
}

button#clearFilters { 
  background:#f2f2f2; 
}

.layout { 
  display:flex; 
  gap:20px; 
  padding:24px 36px; 
  align-items:flex-start; 
  justify-content: center;
  max-width: 1400px;
  margin: 0 auto;
  padding-right: 400px; /* Space for Robert */
}

.left-col { 
  flex:1; 
  min-width:360px; 
  max-width:920px; 
  display: flex;
  justify-content: center;
}

.pokemon-list {
  width: 100%;
  max-width: 800px;
}

.right-col { 
  width: var(--gameboy-width); 
  display:flex; 
  justify-content:center; 
  align-items:center; 
  position:fixed;
  top: 250px;
  right: 20px;
  height: fit-content;
  z-index: 100;
}

.pokemon-list { list-style:none; display:flex; flex-direction:column; gap:12px; }
.pokemon-card {
  display:flex; gap:12px; align-items:center; background:var(--card); padding:12px; border-radius:12px;
  box-shadow: 0 2px 6px rgba(12,12,12,0.04); cursor:pointer; transition:transform .12s ease, box-shadow .12s ease;
  border:1px solid #e6e6e6;
  position: relative;
}
.pokemon-card:hover { transform: translateY(-4px); box-shadow: 0 6px 18px rgba(12,12,12,0.06); }
.pokemon-card.selected { 
  background: #e3f2fd; 
  border: 2px solid #2196f3; 
  transform: translateY(-2px); 
  box-shadow: 0 4px 12px rgba(33,150,243,0.2);
}
.poke-thumb { width:56px; height:56px; display:flex; align-items:center; justify-content:center; }
.poke-thumb img { width:56px; height:56px; image-rendering:pixelated; }

.poke-meta { 
  flex:1; 
  display:flex; 
  flex-direction:column; 
  gap:4px; 
  min-width: 150px;
}
.poke-meta h3 { font-size:18px; text-transform:capitalize; }
.poke-meta .extra { color:var(--muted); font-size:14px; }

.pokemon-stats { 
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color:var(--muted); 
  font-size:12px; 
  font-weight:600; 
  text-align: center;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.poke-type { 
  min-width:120px; 
  text-align:right; 
  font-weight:700; 
  font-size:14px; 
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.no-results { padding:18px; background:#fff3f3; border-radius:10px; border:1px solid #ffd6d6; color:#900; text-align:center; font-weight:700; }

/* Gameboy area visuals - Custom CSS Design */
.gameboy-wrap { 
  position:relative; 
  width:100%; 
  max-width:var(--gameboy-width); 
  display:flex; 
  justify-content:center; 
  align-items:center;
}

/* Custom Gameboy Device Design - Reverted to better version */
.gameboy-device {
  width: 300px;
  height: 470px;
  background: linear-gradient(145deg, #d2232a, #b0282f);
  border-radius: 30px 20px 30px 20px;
  position: relative;
  box-shadow: 
    0 20px 40px rgba(0,0,0,0.5),
    inset 0 3px 6px rgba(255,255,255,0.3),
    inset 0 -2px 4px rgba(0,0,0,0.3);
  border: 5px solid #231f20;
  transform: perspective(1000px) rotateX(3deg) rotateY(-2deg);
}

/* Gameboy inner shadow effect */
.gameboy-device::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 25px 15px 25px 15px;
  background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(0,0,0,0.2));
  pointer-events: none;
}

/* Gameboy Screen */
.gameboy-screen {
  position: absolute;
  top: 40px;
  left: 40px;
  right: 40px;
  height: 300px;
  background: #000;
  border-radius: 20px;
  border: 4px solid #231f20;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 
    inset 0 0 30px rgba(0,0,0,0.9),
    0 0 10px rgba(0,0,0,0.5);
}

.gameboy-content { 
  background: transparent; 
  color: #111; 
  width: 100%; 
  height: 100%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-direction: column; 
  gap: 8px; 
  padding: 10px;
}

.gameboy-card { 
  background: #fff; 
  width: 100%; 
  height: 100%; 
  border-radius: 12px; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: space-between; 
  padding: 12px; 
  text-align: center;
  position: relative;
  overflow: hidden;
}

.gameboy-sprite { 
  margin-bottom: 10px;
}

.gameboy-sprite img { 
  width: 140px; 
  height: 140px; 
  image-rendering: pixelated; 
}

.gameboy-name { 
  font-weight: 800; 
  font-size: 16px; 
  text-transform: capitalize; 
  margin-bottom: 3px;
  color: #2c3e50;
  line-height: 1.2;
}

.gameboy-types {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
}


.gameboy-extra {
  font-size: 10px;
  color: #666;
  line-height: 1.3;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Gameboy Buttons - Reverted to better version */
.gameboy-buttons {
  position: absolute;
  bottom: 25px;
  left: 25px;
  right: 25px;
  display: flex;
  justify-content: space-around;
  gap: 15px;
}

.gameboy-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ed1c24, #b0282f);
  border: 3px solid #231f20;
  box-shadow: 
    0 4px 8px rgba(0,0,0,0.4),
    inset 0 1px 2px rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gameboy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 12px rgba(0,0,0,0.5),
    inset 0 1px 2px rgba(255,255,255,0.4);
}

.gameboy-btn.secondary {
  background: linear-gradient(145deg, #00aeef, #0078a3);
  border-color: #231f20;
}



/* small screens: Gameboy goes to top */
@media (max-width: 900px) {
  .layout { 
    flex-direction:column; 
    padding:0 12px 16px; 
    align-items: center;
  }
  
  .left-col { 
    width: 100%; 
    max-width: 100%;
    order: 2;
  }
  
  .right-col { 
    width:100%; 
    display:flex; 
    justify-content:center; 
    margin: 0 0 12px 0;
    order: 1;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    z-index: auto !important;
    background: var(--bg);
    padding: 0;
    box-shadow: none;
  }
  
  .right-col.show {
    display: flex;
    position: static !important;
    background: var(--bg);
    padding: 0;
    margin-bottom: 12px;
    box-shadow: none;
  }
  
  .layout {
    padding-bottom: 80px;
  }
  
  .gameboy-device {
    width: 250px;
    height: 350px;
    transform: none;
  }
  
  .gameboy-screen {
    height: 200px;
    top: 25px;
    left: 25px;
    right: 25px;
  }
  
  .gameboy-sprite img {
    width: 70px;
    height: 70px;
  }
  
  .gameboy-name {
    font-size: 13px;
  }
  
  .gameboy-extra {
    font-size: 9px;
  }
  
  /* Hide pokemon stats on mobile cards */
  .pokemon-stats {
    display: none;
  }
  
  .topbar { 
    padding:12px; 
  }
  
  .search-row {
    max-width: 100%;
  }
  
  .filters-inline {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .mobile-filters.show {
    display: block;
  }
}

/* badge helper */
.badge { padding:6px 10px; border-radius:999px; font-weight:700; }
