/* General Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: white;
    margin: 0;
    padding: 0;
}

/* Header Styles */

.animated-heading {
    animation: color-change 3s infinite, bounce 1s infinite;
}

/* Keyframes for color change */
@keyframes color-change {
    0% {
        color: #ff6347; /* Tomato */
    }
    50% {
        color: #4682b4; /* Steel Blue */
    }
    100% {
        color: #ff6347;
    }
}

nav {
    background-color: #1f1f1f;
    padding: 14px 20px;
    display: flex;
    position:sticky;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    top: 1px; 
    z-index: 10; 
}

/* Ensure elements marked hidden truly don't render */
[hidden] { display: none !important; }

.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-center { flex: 1; display: flex; justify-content: center; }
.nav-right { display: flex; align-items: center; gap: 10px; }

h1 {
    margin: 0;
    color: yellow;
}

/* Pikachu GIF to the right of the heading */
.gif-container {
    width: 60px;
    height: 60px;
    background-image: url(img/pikachu-pokemon.gif);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
    margin-left: 8px;
    position: relative;
    top: -13px;   /* nudge up */
    left: -30px;  /* nudge left */
}
/* Header Styles */#pokemon-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 10px;
    padding: 20px;
}

.pokemon-card {
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(18,18,18,1) 70%);
    border-radius: 10px;
    text-align: center;
    padding: 20px;
    width: 160px;   
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
    position: relative;
}

.pokemon-card:hover {
    transform: scale(1.05);
}

.pokemon-card.flipped {
    transform: rotateY(180deg);
}

.pokemon-card .front, .pokemon-card .back {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

.pokemon-card .front {
    z-index: 2;
}

.pokemon-card .back {
    transform: rotateY(180deg);
    z-index: 1;
}

.card-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30%;
    overflow: hidden;
    border: 3px solid transparent;
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: none !important;
}

#search {
    padding: 10px 15px;
    border: 1px solid #333;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    background-color: #232323;
    color: #fff;
    outline: none;
    position: relative;
    transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
}
  
#search:placeholder {
    color: #999;
}

#search:hover {
    background-color: #2b2b2b;
    cursor: text;
    box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.15);
}

/* Filter Buttons */
#filter-btn, #clear-filters-btn, #apply-filters, .filter-close {
    background: transparent;
    color: #ffcb05;
    border: 1px solid #ffcb05;
    padding: 8px 14px;
    border-radius: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

#filter-btn:hover, #clear-filters-btn:hover, #apply-filters:hover {
    background-color: #ffcb05;
    color: #1f1f1f;
}

#clear-filters-btn[hidden] { display: none !important; }

/* Filter Modal */
.filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 900;
}

.filter-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: #2a2a2a;
    border: 2px solid #ffcb05;
    border-radius: 12px;
    z-index: 901;
    overflow: hidden;
}

.filter-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #1f1f1f; }
.filter-header h2 { margin: 0; color: #ffcb05; font-size: 1.2rem; }
.filter-close {
    border-radius: 50%;
    padding: 0;
    line-height: 1;
    color: transparent;
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.filter-close::before {
    content: 'X';
    color: #ffcb05;
    font-weight: 700;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}
.filter-close:hover { background-color: #ffcb05; color: transparent !important; }
.filter-close:hover::before { color: #1f1f1f; }
.filter-body { padding: 10px 14px; overflow: auto; }
.filter-footer { padding: 12px 14px; border-top: 1px solid #3a3a3a; display: flex; justify-content: flex-end; gap: 10px; }

.filter-section { margin-bottom: 8px; }
.filter-accordion {
    width: 100%;
    text-align: left;
    background: #3a3a3a;
    color: #ffcb05;
    border: 1px solid #4a4a4a;
    padding: 10px 12px;
    border-radius: 8px;
}
.filter-accordion:hover { background: #444; }
.filter-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    padding: 10px 12px 4px;
}
.filter-options label { display: flex; align-items: center; gap: 8px; color: #e0e0e0; }
.filter-options input { accent-color: #ffcb05; }

/* Responsive */
@media (max-width: 700px) {
  nav { flex-wrap: wrap; }
  .nav-left { width: 100%; justify-content: center; }
  .nav-center { order: 3; width: 100%; }
  .nav-right { order: 2; margin-left: auto; }
}

/* Two cards per row on small screens */
@media (max-width: 600px) {
  #pokemon-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    justify-items: center;
  }
  .pokemon-card { width: auto; }
}

/* Loading indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0 32px;
  color: #ffcb05;
}
.loading-indicator .spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 203, 5, 0.25);
  border-top-color: #ffcb05;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Back to Top button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2a2a2a;
    border: 2px solid #ffcb05;
    cursor: pointer;
    z-index: 950;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.back-to-top::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid #ffcb05;
}
.back-to-top:hover { background: #ffcb05; }
.back-to-top:hover::before { border-bottom-color: #1f1f1f; }

/* Popup Container */
.pokemon-popup {
    display: flex;
    flex-direction: row-reverse;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background-color: #333;
    border-radius: 10px;
    width: 80%;
    height: 80%;
    z-index: 1000;
    overflow: hidden;
    opacity: 0; /* Initially invisible */
    transition: transform 0.4s ease, opacity 0.5s ease;
}

.pokemon-popup.active {
    transform: translate(-50%, -50%) scale(1); /* Full size */
    opacity: 1;
}

/* Left Section (Details) */
.pokemon-details {
    width: 50%;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1c1c1c, #383838);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 10px 0 0 10px;
    color: white;
}

.moves-list, .abilities-list, .stats-list {
    margin-top: 20px;
}

/* Right Section (Fixed Image) */
.pokemon-image {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #444;
    border-radius: 0 10px 10px 0;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.pokemon-details h3 {
    font-size: 2em;
    color: #ffcb05;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.close-popup-btn {
    position: absolute;
    top: 10px;
    right: 3%;
    font-size: 30px;
    color: white;
    cursor: pointer;
}

.pokemon-details p {
    font-size: 1.2em;
    color: #cfcfcf;
    margin-bottom: 2px;
}

.moves-list h4, .abilities-list h4, .stats-list h4 {
    font-size: 2em;
    color: #ffcb05;
    margin-top: 20px;
}

.moves-list p, .abilities-list p, .stats-list p {
    color: #cfcfcf;
    font-size: 1.1em;
}

#play-cry {
    background-color: #ffcb05;
    color: #3b4cca;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

#play-cry:hover {
    background-color: #ffdd4a;
}

#show-evolution {
    background-color: #3b4cca;
    color: #ffcb05;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 20px;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

#show-evolution:hover {
    background-color: #4a5dcf;
}

#evolution-chain {
    margin-top: 20px;
}

#show-shiny {
    background-color: #f1c40f;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 20px;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

#show-shiny:hover {
    background-color: #f39c12;
}


.pokemon-image img {
    max-width: 80%;
    max-height: 80%;
}

.pokemon-details {
    width: 50%;
    padding: 20px;
    overflow-y: auto;
    color: white;
}

/* Overlay to Close Popup */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.overlay.active {
    opacity: 1;
}

/* Disable scrolling of image */
.pokemon-image img {
    position: fixed;
}

.pokemon-card h3 {
    color: yellow;
}
.pokemon-card h4 {
    color: grey;
}
.pokemon-card.fire-type img {
    box-shadow: 0 0 15px rgba(255, 69, 0, 0.8); /* Red-Orange for Fire-type */
}
.pokemon-card.water-type img {
    box-shadow: 0 0 15px rgba(0, 149, 255, 0.8); /* Blue for Water-type */
}
.pokemon-card.grass-type img {
    box-shadow: 0 0 15px rgba(50, 205, 50, 0.8); /* Green for Grass-type */
}
.pokemon-card.bug-type img {
    box-shadow: 0 0 15px rgba(170, 151, 9, 0.736); /* Green for Grass-type */
}
.pokemon-card.flying-type img {
    box-shadow: 0 0 15px rgba(153, 107, 9, 0.736); /* Green for Grass-type */
}
.pokemon-card.poison-type img {
    box-shadow: 0 0 15px rgba(51, 4, 88, 0.736); /* Green for Grass-type */
}
.pokemon-card.electric-type img {
    box-shadow: 0 0 15px yellow; /* Green for Grass-type */
}
.pokemon-card.ground-type img {
    box-shadow: 0 0 15px grey; /* Green for Grass-type */
}
.pokemon-card.fairy-type img {
    box-shadow: 0 0 15px pink; /* Green for Grass-type */
}
.pokemon-card.psychic-type img {
    box-shadow: 0 0 15px rgb(158, 148, 120); /* Green for Grass-type */
}
.pokemon-card.rock-type img {
    box-shadow: 0 0 15px rgb(153, 153, 153); /* Green for Grass-type */
}
.pokemon-card.ice-type img {
    box-shadow: 0 0 15px rgba(173, 216, 230, 1); /* Green for Grass-type */
}
.pokemon-card.ghost-type img {
    box-shadow: 0 0 15px rgba(72, 61, 139, 1); /* Green for Grass-type */
}
.pokemon-card.dragon-type img {
    box-shadow: 0 0 15px rgb(188, 65, 4); /* Green for Grass-type */
}
.pokemon-card.dark-type img {
    box-shadow: 0 0 15px rgb(42, 34, 104); /* Green for Grass-type */
}
.pokemon-card.steel-type img {
    box-shadow: 0 0 15px rgb(144, 150, 152); /* Green for Grass-type */
}


/* Footer Styles */
footer {
    text-align: center;
    padding: 1px;
    background-color: #1f1f1f;
    color: #ffcb05;
    width: 100%;
    bottom: 0;
}
  
/* Global scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #2a2a2a; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #ffcb05; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb:hover { background: #ffd84e; }

/* Filter modal scrollbar */
.filter-body { scrollbar-color: #ffcb05 #2a2a2a; scrollbar-width: thin; }
.filter-body::-webkit-scrollbar { width: 10px; }
.filter-body::-webkit-scrollbar-track { background: #2a2a2a; }
.filter-body::-webkit-scrollbar-thumb { background: #ffcb05; border-radius: 10px; }
.filter-body::-webkit-scrollbar-thumb:hover { background: #ffd84e; }

html, body {
    overflow-x: hidden;
}
/* Type-based border color around image */
.pokemon-card.fire-type .card-image { border-color: #FF7A33; box-shadow: 0 0 12px 2px rgba(255,69,0,0.6); }
.pokemon-card.water-type .card-image { border-color: #4DB5FF; box-shadow: 0 0 12px 2px rgba(0,149,255,0.6); }
.pokemon-card.grass-type .card-image { border-color: #7DE87D; box-shadow: 0 0 12px 2px rgba(50,205,50,0.55); }
.pokemon-card.bug-type .card-image { border-color: #D4C32F; box-shadow: 0 0 12px 2px rgba(170,151,9,0.6); }
.pokemon-card.flying-type .card-image { border-color: #CDAA39; box-shadow: 0 0 12px 2px rgba(153,107,9,0.6); }
.pokemon-card.poison-type .card-image { border-color: #6E49A0; box-shadow: 0 0 12px 2px rgba(51,4,88,0.6); }
.pokemon-card.electric-type .card-image { border-color: #FFEA66; box-shadow: 0 0 12px 2px rgba(255,215,0,0.6); }
.pokemon-card.ground-type .card-image { border-color: #B3B3B3; box-shadow: 0 0 12px 2px rgba(128,128,128,0.6); }
.pokemon-card.fairy-type .card-image { border-color: #FFD6DD; box-shadow: 0 0 12px 2px rgba(255,192,203,0.6); }
.pokemon-card.psychic-type .card-image { border-color: #C9C0A5; box-shadow: 0 0 12px 2px rgba(158,148,120,0.6); }
.pokemon-card.rock-type .card-image { border-color: #C2C2C2; box-shadow: 0 0 12px 2px rgba(153,153,153,0.6); }
.pokemon-card.ice-type .card-image { border-color: #D2EEF6; box-shadow: 0 0 12px 2px rgba(173,216,230,0.6); }
.pokemon-card.ghost-type .card-image { border-color: #7A73B1; box-shadow: 0 0 12px 2px rgba(72,61,139,0.6); }
.pokemon-card.dragon-type .card-image { border-color: #E0703B; box-shadow: 0 0 12px 2px rgba(188,65,4,0.6); }
.pokemon-card.dark-type .card-image { border-color: #5B56A0; box-shadow: 0 0 12px 2px rgba(42,34,104,0.6); }
.pokemon-card.steel-type .card-image { border-color: #BCC2C4; box-shadow: 0 0 12px 2px rgba(144,150,152,0.6); }
.pokemon-card.normal-type .card-image { border-color: #D0CF9F; box-shadow: 0 0 12px 2px rgba(168,167,122,0.6); }
.pokemon-card.fighting-type .card-image { border-color: #E0625D; box-shadow: 0 0 12px 2px rgba(194,46,40,0.6); }

.loading-indicator.active { visibility: visible; }
