:root {
    --bg-color: #2b2b2b;
    --text-color: #f0f0f0;
    --card-bg: #4a4a4a;
    --primary: #e3350d; /* Pokedex red */
    --accent: #ffcc00; /* Pokemon yellow */
    --border-color: #ffffff;
    --font-stack: 'Press Start 2P', cursive;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-stack);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 10px; /* Base for 8-bit font */
}

h1, h2, h3 {
    text-align: center;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 2px 2px 0px #000;
}

header {
    background-color: var(--primary);
    padding: 10px 20px;
    border-bottom: 4px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.header-brand {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 60px;
    width: auto;
    image-rendering: pixelated;
    border: 2px solid var(--accent);
    border-radius: 4px;
}

/* Footer styles */
footer {
    background-color: #111;
    border-top: 4px solid var(--border-color);
    padding: 20px;
    margin-top: 40px;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.footer-author {
    font-size: 10px;
    color: var(--accent);
    margin-bottom: 8px;
}

.footer-api {
    font-size: 8px;
    color: #aaa;
    margin-bottom: 8px;
}

.footer-api a {
    color: var(--accent);
    text-decoration: none;
}

.footer-api a:hover {
    text-decoration: underline;
}

.footer-disclaimer {
    font-size: 7px;
    color: #666;
    line-height: 1.8;
    margin: 0;
}


nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 10px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

nav a:hover, nav a.active {
    border-color: var(--accent);
    background-color: rgba(255, 204, 0, 0.2);
}

main {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Grid for Pokemon Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pokemon-card {
    background-color: var(--card-bg);
    border: 4px solid var(--border-color);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.pokemon-card:hover {
    transform: scale(1.05);
    box-shadow: 4px 4px 0px var(--accent);
    border-color: var(--accent);
}

.pokemon-card img {
    image-rendering: pixelated; /* Crucial for 8-bit look */
    width: 96px;
    height: 96px;
}

.pokemon-card h3 {
    font-size: 10px;
    margin: 10px 0;
    color: white;
}

/* Forms & Inputs */
input, select, button {
    font-family: var(--font-stack);
    font-size: 10px;
    padding: 10px;
    margin: 5px;
    border: 2px solid var(--border-color);
    background-color: #000;
    color: #0f0; /* Retro terminal green for inputs */
    outline: none;
}

button {
    background-color: var(--accent);
    color: #000;
    cursor: pointer;
}

button:hover:not(:disabled) {
    background-color: #fff;
    color: #000;
}

button:disabled {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
    border-color: #555;
}

/* Search page */
.search-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
}

/* Types colors */
.type-badge {
    display: inline-block;
    padding: 5px 10px;
    font-size: 8px;
    border: 2px solid #fff;
    margin: 2px;
}
.type-fire { background: #f08030; }
.type-water { background: #6890f0; }
.type-grass { background: #78c850; }
.type-electric { background: #f8d030; color: #000; }
.type-normal { background: #a8a878; }
.type-ice { background: #98d8d8; color: #000; }
.type-fighting { background: #c03028; }
.type-poison { background: #a040a0; }
.type-ground { background: #e0c068; color: #000; }
.type-flying { background: #a890f0; }
.type-psychic { background: #f85888; }
.type-bug { background: #a8b820; }
.type-rock { background: #b8a038; }
.type-ghost { background: #705898; }
.type-dragon { background: #7038f8; }
.type-dark { background: #705848; }
.type-steel { background: #b8b8d0; color: #000; }
.type-fairy { background: #ee99ac; color: #000; }

/* Battle Arena */
.battle-arena {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-top: 20px;
}

.pokemon-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vs-badge {
    display: flex;
    align-items: center;
    font-size: 24px;
    color: var(--accent);
    padding: 0 20px;
}

.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    font-size: 30px;
    color: #888;
}

.battle-controls {
    text-align: center;
    margin-top: 30px;
}

#battle-btn {
    font-size: 16px;
    padding: 15px 30px;
    background-color: var(--primary);
    color: white;
}

#battle-btn:hover:not(:disabled) {
    background-color: #ff5555;
}

.battle-result {
    margin-top: 30px;
    padding: 20px;
    border: 4px dashed var(--accent);
    background-color: #000;
    text-align: center;
}

.hidden {
    display: none;
}

/* Stats bars */
.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 8px;
}
.stat-name {
    width: 60px;
    text-align: right;
    margin-right: 10px;
}
.stat-bar-bg {
    flex: 1;
    background-color: #333;
    height: 10px;
    border: 1px solid #fff;
}
.stat-bar-fill {
    height: 100%;
    background-color: #0f0;
}

/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {
    /* Header and Navigation */
    header {
        padding: 8px 10px;
        flex-direction: column;
        align-items: center;
    }

    .header-logo {
        height: 45px;
    }
    
    nav {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-top: 10px;
    }
    
    nav a {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    /* Battle Arena */
    .battle-arena {
        flex-direction: column;
        align-items: center;
    }

    .pokemon-side {
        width: 100%;
        max-width: 300px;
        margin-bottom: 20px;
    }

    .vs-badge {
        padding: 10px 0;
        margin-bottom: 10px;
    }

    /* Adjust inputs and buttons to fit better on small screens */
    input[type="text"] {
        width: 80%;
        box-sizing: border-box;
    }

    .battle-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    #reset-btn {
        margin-left: 0 !important;
    }
    
    /* Search Controls */
    .search-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .search-controls input, .search-controls select, .search-controls button {
        width: 100%;
        max-width: 300px;
        box-sizing: border-box;
    }
}
