/* ==========================
   :root Variables
   ========================== */
:root {
    /* Color Palette */
    --bg1: #f1e5da;
    --bg2: #e3d3c6;
    --bg3: #faf0e7;
    --bg-dark: #2e2e2f;

    --accent1: #f87545;
    --accent2: #deb66d;
    --accent3: #c8a592;
    --accent4: #dcbda3;
    --accent5: #128884;
    --accent6: #674f45;

    --main-text: #004d4c;
    --second-text: #507e77;

    --shadow: rgba(0, 0, 0, 0.308);
    --animation-delay: 0s;
}


/* ==========================
   Global Styles
   ========================== */
body {
    font-family: "Faculty Glyphic", sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 8rem;
    overflow-x: hidden;
    background-image: url('assets/Bg_Light.svg');
    background-repeat: repeat;
    transition: background-color 0.4s ease, color 0.4s ease;
    height: 100%;
}

h1, h2, h3 {
    font-family: "Faculty Glyphic", sans-serif;
    margin: 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 5rem);
    color: var(--bg3);
    text-align: left;
}

h2 {
    font-size: clamp(3rem, 5vw, 4rem);
    color: var(--main-text);
    text-align: left;
    transition: color 0.4s ease;
}

h3 {
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--main-text);
    margin: 1rem;
    transition: color 0.4s ease;
}

p {
    margin: 0;
}


/* ==========================
   Containers & Layouts
   ========================== */

.pokemon-card-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    margin-top: -4rem;
}


/* Left side */
.pokemon-card-left {
    display: flex; /* now it’s actually a flexbox */
    flex-direction: column; /* stack its children vertically */
    flex: 1 1 70%; /* take up 60% of the parent row */
    max-width: 70%;
    justify-content: center;
    align-items: center; /* center contents horizontally */
    padding: 1rem;
}

.pokemon-card-right {
    flex-direction: column;
    padding: 2rem;
    align-items: baseline;
    flex: 1;
    align-content: center;
    max-width: 60%;
    justify-content: space-between;
}


#card-page {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
    margin-top: 1rem;
    box-sizing: border-box;
    background-color: var(--bg1);
    background-image: url('assets/Bg_Light.svg');
    overflow-y: scroll;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 97vw;
    margin: 1rem;
}

#pokedex {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 1.5rem;
    margin: 0 auto;
    justify-content: center;
    min-height: 100%;
    max-width: 200rem;


    width: 80%; /* Adjust container width */


}


.title-type-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin: 3rem 0 0 1rem;
    width: auto;
    justify-items: center;
    flex-wrap: wrap;
    position: relative;
}

#pokemonTitleTypeContainer {
    position: relative;
    z-index: 5;
}


.footer {
    background-color: var(--bg2);
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--second-text);
    position: relative;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: -1rem;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.footer p {
    margin: 0;
}

/* ==========================
   Search & Filter Bar
   ========================== */
.search-filter-bar {
    position: sticky;
    top: 6.6rem;
    z-index: 900;
    background: var(--bg2);
    width: calc(100% - 10rem);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    /* Collapsed by default */
    max-height: 0;
    overflow: hidden;
    padding: 0 1.5rem;
    transition: max-height 0.35s ease, padding 0.35s ease, box-shadow 0.35s ease, background-color 0.4s ease, border-color 0.4s ease;
    border-radius: 1rem 1rem 1rem 1rem;
}

.search-filter-bar.open {
    max-height: 14rem;
    padding: 0.7rem 2.5rem 1.4rem 1.5rem;
    box-shadow: 0 0.3rem 0.6rem var(--shadow);
    margin-bottom: 1rem;
}

/* Search toggle button (lives in the banner) */
.search-toggle-btn {
    background: none;
    border: none;
    color: var(--bg3);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    margin-left: auto;
    margin-right: 2rem;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle-btn:hover {
    color: var(--accent2);
}

.search-toggle-btn.active {
    color: var(--accent2);
    background: rgba(255, 255, 255, 0.15);
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 540px;
}

.search-icon {
    color: var(--second-text);
    font-size: 1rem;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    padding: 0.55rem 1rem;
    border-radius: 2rem;
    border: 2px solid var(--bg2);
    background: var(--bg3);
    color: var(--main-text);
    font-family: "Faculty Glyphic", sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.4s ease, color 0.4s ease;
}

.search-input:focus {
    border-color: var(--accent5);
    box-shadow: 0 0 0 3px rgba(18, 136, 132, 0.2);
}

.result-count-badge {
    background: var(--accent5);
    color: var(--bg3);
    font-size: 0.8rem;
    padding: 0.25rem 0.7rem;
    border-radius: 2rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.type-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.type-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 2rem;
    border: 1.5px solid var(--bg2);
    background: var(--bg3);
    color: var(--main-text);
    font-family: "Faculty Glyphic", sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.type-filter-btn img {
    height: 1rem;
    width: auto;
}

.type-filter-btn:hover:not(.active) {
    background: var(--bg2);
    border-color: var(--accent3);
}

.type-filter-btn.active {
    background: var(--accent5);
    color: var(--bg3);
    border-color: var(--accent5);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--second-text);
    font-size: 1.4rem;
    height: 15rem;
}

/* ==========================
   Back to Top Button
   ========================== */
.back-to-top {
    position: fixed;
    bottom: 0.7rem;
    left: 0.7rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: bold;
    border: none;
    background-color: var(--accent5);
    color: var(--bg3);
    z-index: 10;
    box-shadow: 0 0.5rem 1rem var(--shadow);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background-color: var(--accent1);
    transform: translateY(-2px);
}

/* ==========================
   Shiny Toggle Button
   ========================== */
.shiny-controls {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

.shiny-toggle-btn {
    background: var(--bg3);
    color: var(--second-text);
    border: 2px solid var(--bg2);
    border-radius: 2rem;
    padding: 0.35rem 1rem;
    font-family: "Faculty Glyphic", sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
    filter: drop-shadow(2px 2px 4px var(--shadow));
}

.shiny-toggle-btn:hover {
    border-color: var(--accent2);
    color: var(--main-text);
}

.shiny-toggle-btn.shiny-active {
    background: var(--accent2);
    color: var(--bg3);
    border-color: var(--accent1);
}

/* ==========================
   Pokemon Measurements
   ========================== */
.pokemon-measurements {
    display: flex;
    gap: 1rem;
    justify-content: center;
    color: var(--second-text);
    font-size: 0.95rem;
    font-style: italic;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.measurement-pill {
    background: var(--bg3);
    border: 1.5px solid var(--bg2);
    border-radius: 2rem;
    padding: 0.2rem 0.7rem;
    filter: drop-shadow(1px 1px 3px var(--shadow));
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

/* ==========================
   Animations
   ========================== */
@keyframes fadeInSlide {
    0% {
        opacity: 0;
        transform: translateY(1rem);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================
   Pokemon Cards
   ========================== */
.pokemon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: clamp(100rem, 20vw, 100rem);
    max-width: 100%;
    max-height: 100%;
    padding: 0.5rem;
    text-align: center;
    border-radius: 1rem;
    background-color: var(--bg3);
    box-shadow: 0 0.5rem 1rem var(--shadow);
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.5s ease, transform 0.2s ease, box-shadow 0.2s ease, background-color 0.4s ease, color 0.4s ease;
    transition-delay: var(--animation-delay, 0s);
    cursor: pointer;
}

.pokemon.slide-in:hover {
    transform: translateY(-6px);
    box-shadow: 0 1.2rem 2.5rem var(--shadow);
}

.pokemon.slide-in {
    opacity: 1;
    transform: translateY(0);
}

.pokemon-image,
.pokemon-image-large {
    object-fit: cover;
    transition: transform 0.3s ease-in-out;
    z-index: 100;

    filter: drop-shadow(1px 1px 4px var(--shadow)); /* Shadow */

}

.pokemon-image:hover {
    transform: scale(1.1);
}

.pokemon-image-large {
    position: absolute;
    width: 32rem;
    height: 32rem;
    animation: fadeInSlide 0.6s ease-out forwards;


    filter: drop-shadow(20px 12px 10px var(--shadow)); /* Shadow */

    transition: transform 0.3s ease; /* Smooth scaling transition */
    flex: 0 0 200px;
}


.pokemon-image {
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.2s ease-in-out; /* Adds a smooth hover effect */
}


.pokemon-images-container {
    position: relative;
    margin-top: -1rem;
    margin-bottom: -3rem;
    justify-items: center;
    align-items: baseline;
}

.card-shiny-toggle {
    position: absolute;
    top: 2.5rem;
    right: 2.5rem;
    background: none;
    border: none;
    color: var(--accent5);
    cursor: pointer;
    z-index: 10;
    padding: 0.2rem;
    line-height: 1;
    transition: transform 0.25s ease, color 0.25s ease;
}

.card-shiny-toggle .sparkle-icon {
    width: 4rem;
    height: 4rem;
    display: block;
}

.card-shiny-toggle:hover {
    transform: scale(1.2);
    color: var(--accent5);
    filter: brightness(1.3);
}

.card-shiny-toggle.shiny-active {
    color: var(--accent2);
}

.card-shiny-toggle.shiny-active:hover {
    transform: scale(1.2);
    filter: brightness(1.15);
}


.circle-background {
    display: flex;
    width: 32rem;
    height: 32rem;
    border: 5rem solid var(--bg3);
    border-radius: 50%;
    overflow: hidden;
    z-index: -1;
}


.name {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--main-text);
    transition: color 0.4s ease;
}


.type-image {
    max-height: 1.2rem; /* Limits the type icon height */
    width: auto;
}


.type-stack {
    left: 0;
    margin-left: 0;
    display: flex;
    flex-direction: column; /* Stack the type bars vertically */
    margin-top: 0;
    filter: drop-shadow(5px 5px 10px var(--shadow));
}

.pokemon-title {
    font-size: clamp(0.7rem, 5vw, 1.4rem);
    font-style: italic;
    color: var(--second-text);
    margin-top: 0;
    margin-left: 1rem;
    position: relative;
    transition: color 0.4s ease;
}


.pokemon-description {
    display: block;
    width: 80%;
    text-align: center;
    box-sizing: border-box;
    padding: 1.4rem;
    color: var(--second-text);
    font-size: 1.2rem;
    margin-top: -1rem;
    background-color: var(--bg3);
    border-radius: 2rem;
    border: 0.8rem solid var(--bg2);
    filter: drop-shadow(5px 5px 10px var(--shadow));
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.pokemon-sigmove {
    align-content: center;
    text-align: center;
    padding: 0.7rem;
    color: var(--main-text);
    font-weight: bold;
    font-size: 1.2rem;
    background-color: var(--bg3);
    border-radius: 2rem;
    border: 0.8rem solid var(--accent5);
    display: flex;
    flex-direction: column;
    filter: drop-shadow(5px 5px 10px var(--shadow));
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}


.pokemon-sigmove-description {
    font-weight: normal;
    color: var(--second-text);
    margin-top: 0.3rem;
}


.pokemon-ability {
    width: auto;
    align-content: center;
    text-align: center;
    flex: 1; /* Share the remaining space evenly */
    padding: 0.4rem;
    color: var(--main-text);
    font-weight: bold;
    border-radius: 2rem; /* Rounded corners */

    position: relative;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
}

.lacadia-ability {
    color: var(--accent1);
    font-weight: bold;
}

.ability-description {
    justify-content: center;
    font-weight: normal;
    color: var(--second-text);
}

.pokemon-details {
    display: flex; /* Use flexbox */

    justify-content: center; /* Center items vertically */
    align-items: center; /* Center items horizontally */
    text-align: center; /* Ensure text inside children is centered */
    gap: 1rem; /* Add spacing between the description and stats */
    height: 100%; /* Optional: Fill the height of the container */
    filter: drop-shadow(0px 0px 10px var(--shadow));
}

.pokemon-stats {
    margin-right: 1.25rem;
    color: var(--second-text);
    right: 1rem;
}

/* ==========================
   Stat Bars
   ========================== */
.stat-bar {
    display: inline-flex;
    align-items: center;
    align-content: center;
    justify-content: center;
    margin-bottom: 0.2rem;
    filter: drop-shadow(3px 3px 5px var(--shadow));
    width: 100%;
}

.stat-name {
    width: 3rem;
    text-align: right;
    margin-right: 0.6rem;
    font-weight: bold;
}

.stat-value {
    width: 2.5rem;
    text-align: right;
}

.bar-container {
    width: 10rem;
    height: 1rem;
    background-color: var(--bg3);
    border-radius: 1rem;
    overflow: hidden;
    transition: background-color 0.4s ease;
}

.bar-fill {
    height: 100%;
    width: 0;
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);

    background-image: repeating-linear-gradient(
            -60deg,
            rgba(255, 255, 255, 0.2) 0px,
            rgba(255, 255, 255, 0.2) 6px,
            rgba(255, 255, 255, 0.05) 6px,
            rgba(255, 255, 255, 0.05) 12px
    );
}


.arrow-left {
    display: flex;
    justify-content: center;
    align-items: center;
    top: 50%; /* Center it vertically */
    padding-left: 0.5rem;
}

.arrow-right {
    display: flex;
    justify-content: center;
    align-items: center; /* Vertically centers the content */
    padding-right: 1rem;
    top: 50%; /* Center it vertically */
}


.arrow {
    color: var(--bg3);
    font-size: 1.7rem;
    cursor: pointer;
    transition: color 0.3s ease
}

.arrow:hover {
    color: var(--accent2);
}

.pokemon-info {
    text-align: center;
    flex-grow: 1;
}

.types-stacked {
    display: flex;
    flex-direction: column; /* Stacks the type bars vertically */
    align-items: center; /* Centers the bars horizontally */
    gap: 0.5rem; /* Adds space between the type bars */
    margin-top: 66rem; /* Adds some space above the type bars */
}

.type-bar {
    width: 6rem; /* Adjust the width as needed */
    height: auto;
    gap: 1rem;
    object-fit: contain; /* Ensures the type bar image scales properly */
    margin-top: 0.4rem;
}


/* Optional: Make sure the arrows are aligned nicely with the text */
#previousPokemonInfo, #nextPokemonInfo {
    font-weight: bold;
    font-size: 1rem;
}


/* ==========================
   Buttons
   ========================== */
.form-switch-button,
.exit-button,
.toggle-dark-mode,
.toggle-dark-mode-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-switch-button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1.1rem;
    margin-top: 0.2rem;
    margin-bottom: -3.4rem;
    border-radius: 5%;
    border: 0.3rem solid transparent;
    background-color: var(--accent2);
    color: var(--second-text);
    font-size: 1rem;
    font-family: "Faculty Glyphic", sans-serif;
    width: auto;
    height: auto;
    cursor: pointer;
    transition: background-color 0.3s ease;
    filter: drop-shadow(5px 5px 5px var(--shadow));

}

.form-switch-button:hover {
    background-color: var(--accent1);
}

.exit-button {
    position: fixed;
    bottom: 0.7rem;
    right: 0.7rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: bold;
    border: none;
    background-color: var(--accent2);
    color: var(--bg3);
    z-index: 10;
    box-shadow: 0 1rem 1rem var(--shadow);
}

.exit-button:hover {
    background-color: var(--accent1);
}

/* Add a button to toggle dark mode */
.toggle-dark-mode {
    position: fixed;
    bottom: 0.58rem;
    right: 0.3rem;
    background-color: rgb(0, 0, 0, 0);
    color: var(--accent2);
    font-size: 4rem;
    padding: 0.5rem 0.6rem;
    border: none;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s ease;
}

.toggle-dark-mode:hover,
.toggle-dark-mode-card:hover {
    color: var(--accent1);
}


.toggle-dark-mode-card {
    background-color: rgb(0, 0, 0, 0);
    color: var(--accent2);
    font-size: 3rem; /* Increase font size for the icon */
    padding: 0.5rem 0.6rem;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;

    position: fixed;
    bottom: 4.25rem;
    right: 0.7rem;
    font-weight: bold;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}


/* ==========================
   Banners
   ========================== */
.banner-main,
.banner-card {
    display: flex;
    align-items: center;
    width: 100%;
    position: fixed;
    left: 0;
    z-index: 1000;
    box-shadow: 0 .5rem .5rem var(--shadow);
}

.banner-main {
    top: 0;
    padding: 1.3rem;
    height: 4rem;
    background: linear-gradient(120deg, var(--accent1), var(--accent2), var(--accent5));

}

.banner-card {
    top: 0;
    justify-content: space-between;
    padding: 0.3rem;
    background: linear-gradient(240deg, var(--accent1), var(--accent2), var(--accent5));
    color: var(--bg1);
    box-shadow: 0 0.2rem 0.5rem var(--shadow);
    height: 3rem;
}

/* ==========================
   Scrollbar Customization
   ========================== */
::-webkit-scrollbar {
    width: 0.8rem;
    height: 0.8rem;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--accent5);
    border-radius: 1rem;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent2);
}

::-webkit-scrollbar-thumb:active {
    background: var(--accent1);
}

/* ==========================
   Dark Mode
   ========================== */
/* Apply root variables to both HTML and BODY tags */
html.dark-mode,
body.dark-mode {
    --bg1: #1a1a1f;
    --bg2: #3a3a42;
    --bg3: #2b2b2c;

    --accent1: #49ffb7;
    --accent2: #8ea2ff;
    --accent5: #8d00ff;

    --main-text: #d2bdfd;
    --second-text: #ded7fc;
    --shadow: rgba(0, 0, 0, 0.8);

    background-image: url('assets/Bg_Dark.svg');
}

#card-page.dark-mode {
    background-image: url('assets/Bg_Dark.svg');
}

.ability-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg2);
    border-radius: 1.2rem;
    border: 0.8rem solid var(--bg3);
    padding: 1rem 0.5rem;
    align-items: center;
    box-shadow: 2px 2px 12px var(--shadow);
    margin: 4rem 3rem;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}


.pokemon-ability:hover, .pokemon-ability:focus {
    background: var(--accent2);
}

.ability-description-popup {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: absolute;

    /* FORCE LEFT POSITIONING */
    right: 100%; /* Position outside the right edge of the container (pushes it left) */
    left: auto; /* Override any previous left settings */
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;

    /* Spacing between ability name and popup */
    margin-right: 1rem;

    min-width: 220px;
    max-width: 320px;
    background: var(--bg3);
    color: var(--second-text);
    border: 1px solid var(--accent2);
    border-radius: 0.7rem;
    box-shadow: 0 2px 12px var(--shadow);
    padding: 0.7rem 1rem;
    z-index: 100;
    font-size: 1rem;
    white-space: normal;
    text-align: left;
}

/* Show the popup on hover/focus */
.pokemon-ability:hover .ability-description-popup,
.pokemon-ability:focus .ability-description-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}


.ability-description-popup.left {
    left: auto;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(0);
}

.pokemon-ability:hover .ability-description-popup.left,
.pokemon-ability:focus .ability-description-popup.left {
    transform: translateY(-50%) translateX(0);
}


