/* --- Variables Globales Aero --- */
:root {
    /* Paleta de colores Frutiger Aero */
    --aero-bg: linear-gradient(135deg, #012D3B, #008A7C, #8DEB56);
    --aero-text: #1E2A3A;

    /* --- SOLUCIÓN: Colores de Pokébola de Cristal más Intensos --- */
    --pokeball-red-glass: linear-gradient(135deg, rgba(255, 85, 85, 0.85), rgba(212, 0, 0, 0.85));
    --pokeball-white-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(224, 224, 224, 0.85));
    --pokeball-divider-color: #212121;

    /* Colores de Tipos para Vidrio Translúcido */
    --type-glass-normal: rgba(168, 167, 122, 0.8);
    --type-glass-fire: rgba(238, 129, 48, 0.8);
    --type-glass-water: rgba(99, 144, 240, 0.8);
    --type-glass-grass: rgba(122, 199, 76, 0.8);
    --type-glass-electric: rgba(247, 208, 44, 0.8);
    --type-glass-ice: rgba(150, 217, 214, 0.8);
    --type-glass-fighting: rgba(194, 46, 40, 0.8);
    --type-glass-poison: rgba(163, 62, 161, 0.8);
    --type-glass-ground: rgba(226, 191, 101, 0.8);
    --type-glass-flying: rgba(169, 143, 243, 0.8);
    --type-glass-psychic: rgba(249, 85, 135, 0.8);
    --type-glass-bug: rgba(166, 185, 26, 0.8);
    --type-glass-rock: rgba(182, 161, 54, 0.8);
    --type-glass-ghost: rgba(115, 87, 151, 0.8);
    --type-glass-dragon: rgba(111, 53, 241, 0.8);
    --type-glass-dark: rgba(112, 87, 70, 0.8);
    --type-glass-steel: rgba(183, 183, 206, 0.8);
    --type-glass-fairy: rgba(214, 133, 173, 0.8);
}

/* --- Reset y Estilos Base --- */
body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    margin: 0;
    background: var(--aero-bg) fixed;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative; /* Necesario para el pseudo-elemento */
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1; /* Detrás del contenido */
    background: 
        linear-gradient(to bottom, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 20%),
        radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.3), transparent 60%);
    pointer-events: none; /* No interfiere con el mouse */
}

/* --- Contenedor y Header --- */
.aero-container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.aero-header { text-align: center; margin-bottom: 2rem; color: white; text-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.aero-title { font-size: 2.8rem; font-weight: 700; }

/* --- Grid de Pokémon (Forzado a 3 columnas) --- */
.pokedex-container { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 1.5rem; 
    justify-content: center; 
    max-width: 980px; /* Ancho máximo para 3 columnas */
    margin: 0 auto; /* Centra el contenedor */
}

/* --- Tarjeta Pokémon v15 (Estilo Vista) --- */
.pokemon-card {
    position: relative; /* CRÍTICO: Establece el contexto de apilamiento */
    width: 280px; height: 280px;
    border-radius: 50%;
    overflow: hidden;
    /* --- SOLUCIÓN: Borde de cristal --- */
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4), inset 0 0 1px 1.5px rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, opacity 0.3s ease-in-out;
}

/* --- JERARQUÍA DE CAPAS (Z-INDEX) --- */
.pokeball-top, .pokeball-bottom, .pokeball-divider, .pokeball-button { position: absolute; z-index: 1; }
.card-reflection { position: absolute; z-index: 2; }
.sprite-container { position: absolute; z-index: 3; }
.pokemon-number, .info-panel { position: absolute; z-index: 4; }

/* --- Efecto de Vidrio en la Pokébola --- */
.pokeball-top {
    top: 0; left: 0; width: 100%; height: 50%;
    background: var(--pokeball-red-glass);
    backdrop-filter: blur(8px);
}
.pokeball-bottom {
    bottom: 0; left: 0; width: 100%; height: 50%;
    background: var(--pokeball-white-glass);
    backdrop-filter: blur(8px);
}

.pokeball-divider { top: 50%; left: 0; width: 100%; height: 20px; background: var(--pokeball-divider-color); transform: translateY(-50%); box-shadow: 0 0 10px rgba(0,0,0,0.5); }
.pokeball-button { top: 50%; left: 50%; width: 60px; height: 60px; background: linear-gradient(145deg, #f0f0f0, #cccccc); border: 6px solid var(--pokeball-divider-color); border-radius: 50%; transform: translate(-50%, -50%); box-shadow: inset 0 -4px 8px rgba(0,0,0,0.25), 0 0 0 6px #ffffff; }
.pokeball-button::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 25px; height: 25px; background: linear-gradient(145deg, #e0e0e0, #b0b0b0); border-radius: 50%; border: 2px solid #999999; }

/* --- SOLUCIÓN: Brillo Superior más Sutil --- */
.card-reflection {
    top: 0; left: 0; width: 100%; height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

/* Capa 3: Sprite del Pokémon */
.sprite-container { top: 50%; left: 50%; transform: translate(-50%, -60%); width: 240px; height: 240px; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.4)); transition: transform 0.4s ease; }
.pokemon-sprite { width: 100%; height: 100%; object-fit: contain; }

/* Capa 4: Información */
.pokemon-number { width: auto; top: 30px; right: 50px; font-size: 1.4rem; font-weight: 700; color: white; text-shadow: -1px -1px 0 #444, 1px -1px 0 #444, -1px 1px 0 #444, 1px 1px 0 #444, 0 0 5px rgba(0,0,0,0.5); }

.info-panel { bottom: 20px; left: 50%; transform: translateX(-50%); width: 100%; text-align: center; }
.pokemon-name { font-size: 1.8rem; font-weight: 700; color: #333; text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; margin-bottom: 0; overflow-wrap: break-word; }
.types-container { display: flex; justify-content: center; gap: 8px; }

/* Badges de Vidrio Pulido */
.type-badge { padding: 0.4em 1.2em; border-radius: 20px; color: white; font-weight: 600; font-size: 0.85rem; text-shadow: 0 1px 3px rgba(0,0,0,0.5); border: 1px solid rgba(255, 255, 255, 0.3); background-image: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0.05)); box-shadow: inset 0 -2px 4px rgba(0,0,0,0.2), 0 3px 5px rgba(0,0,0,0.1); backdrop-filter: blur(6px); transition: all 0.3s ease; }

.type-normal { background-color: var(--type-glass-normal); }
.type-fire { background-color: var(--type-glass-fire); }
.type-water { background-color: var(--type-glass-water); }
.type-grass { background-color: var(--type-glass-grass); }
.type-electric { background-color: var(--type-glass-electric); }
.type-ice { background-color: var(--type-glass-ice); }
.type-fighting { background-color: var(--type-glass-fighting); }
.type-poison { background-color: var(--type-glass-poison); }
.type-ground { background-color: var(--type-glass-ground); }
.type-flying { background-color: var(--type-glass-flying); }
.type-psychic { background-color: var(--type-glass-psychic); }
.type-bug { background-color: var(--type-glass-bug); }
.type-rock { background-color: var(--type-glass-rock); }
.type-ghost { background-color: var(--type-glass-ghost); }
.type-dragon { background-color: var(--type-glass-dragon); }
.type-dark { background-color: var(--type-glass-dark); }
.type-steel { background-color: var(--type-glass-steel); }
.type-fairy { background-color: var(--type-glass-fairy); }

/* --- Efectos Hover y Animaciones --- */
.pokemon-card:hover { transform: scale(1.08) translateY(-10px); box-shadow: 0 25px 45px -15px rgba(0,0,0,0.5), inset 0 0 0 4px rgba(255, 255, 255, 1); }
.pokemon-card:hover .sprite-container { transform: translate(-50%, -60%) scale(1.1); }
.pokemon-card:hover .card-reflection { opacity: 0.5; }
.pokemon-card:hover .type-badge { transform: translateY(-3px); box-shadow: inset 0 -2px 4px rgba(0,0,0,0.2), 0 5px 10px rgba(0,0,0,0.2); }

/* --- Skeleton Loader --- */
.pokemon-card-skeleton {
    position: relative;
    width: 280px; height: 280px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4), inset 0 0 1px 1.5px rgba(255, 255, 255, 0.7);
    overflow: hidden;
}

.pokemon-card-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    from { left: -100%; }
    to { left: 100%; }
}

/* Animación de entrada */
.card-entrance { animation: cardEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; opacity: 0; transform: scale(0.8); animation-delay: calc(var(--card-index) * 80ms); }
@keyframes cardEntrance { to { opacity: 1; transform: scale(1); } }

/* --- Footer --- */
.aero-footer { margin-top: 3rem; text-align: center; font-size: 0.9rem; color: white; opacity: 0.8; font-weight: 400; }

/* --- Pagination --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-button {
    padding: 0.8em 1.5em;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.pagination-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-indicator {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Media Queries --- */
@media (max-width: 600px) { 
    .aero-container { padding: 1rem; } 
    .pokedex-container { grid-template-columns: 1fr; gap: 2.5rem; } 
    .pokemon-card { width: 100%; height: auto; padding-bottom: 100%; } 
    .aero-title { font-size: 2.2rem; } 
}

/* --- Filter Controls --- */
.filter-container {
    display: flex; /* Use Flexbox for layout */
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center items horizontally */
    gap: 1.5rem; /* Gap between the stacked filter sections */
    margin-bottom: 2.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    position: relative; /* For positioning autocomplete suggestions */
}

.search-container {
    width: 100%;
    max-width: 500px; /* Adjusted width */
    position: relative;
    display: flex; /* Use flexbox for alignment */
    align-items: center;
    gap: 10px; /* Space between input and button */
}

.aero-input {
    flex-grow: 1; /* Allow input to take available space */
    width: 100%;
    padding: 0.8em 1.2em;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.15);
    color: white; /* Ensure text is always visible */
    font-weight: 600;
    transition: all 0.3s ease;
    box-sizing: border-box; /* Include padding in width */
}

.aero-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.aero-input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.aero-button {
    padding: 0.8em 1.2em; /* More horizontal padding */
    height: 45px; /* Match height */
    /* width: 45px; */ /* Remove fixed width */
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px; /* Rounded rectangle */
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600; /* Adjusted font weight */
    font-size: 0.9rem; /* Adjusted font size */
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap; /* Prevent text wrapping */
}

.aero-button:hover {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* --- Custom Aero Select (Dropdown) --- */
.custom-select-container {
    position: relative;
    width: 100%;
    max-width: 400px; /* Match search bar width */
}

.aero-select {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8em 1.2em;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.aero-select:focus, .aero-select.open {
    outline: none;
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.dropdown-arrow {
    width: 20px;
    height: 20px;
    stroke: white;
    transition: transform 0.3s ease;
}

.aero-select.open .dropdown-arrow {
    transform: rotate(180deg);
}

.aero-options {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5); /* Fondo oscuro translúcido */
    backdrop-filter: blur(10px); /* El efecto de cristal */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.aero-options.show {
    display: block; /* Shown with JS */
}

.aero-option {
    padding: 0.8em 1.2em;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.aero-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.aero-option.selected {
    background-color: rgba(141, 235, 86, 0.3); /* Highlight selected option */
    font-weight: 700;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%; /* Position below the input */
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 100; /* Ensure it's above other content */
    max-height: 200px; /* Limit height and add scroll */
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.autocomplete-suggestion-item {
    padding: 0.8em 1.2em;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.autocomplete-suggestion-item:hover,
.autocomplete-suggestion-item.active {
    background-color: rgba(255, 255, 255, 0.1);
}

#type-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px; /* Aumentado para mayor claridad */
    max-width: 800px;
    margin: 0 auto;
}

.type-filter-btn {
    padding: 0.6em 1.4em;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    opacity: 0.65;
    filter: saturate(0.8);
}

.type-filter-btn.type-normal { background-color: var(--type-glass-normal); }
.type-filter-btn.type-fire { background-color: var(--type-glass-fire); }
.type-filter-btn.type-water { background-color: var(--type-glass-water); }
.type-filter-btn.type-grass { background-color: var(--type-glass-grass); }
.type-filter-btn.type-electric { background-color: var(--type-glass-electric); }
.type-filter-btn.type-ice { background-color: var(--type-glass-ice); }
.type-filter-btn.type-fighting { background-color: var(--type-glass-fighting); }
.type-filter-btn.type-poison { background-color: var(--type-glass-poison); }
.type-filter-btn.type-ground { background-color: var(--type-glass-ground); }
.type-filter-btn.type-flying { background-color: var(--type-glass-flying); }
.type-filter-btn.type-psychic { background-color: var(--type-glass-psychic); }
.type-filter-btn.type-bug { background-color: var(--type-glass-bug); }
.type-filter-btn.type-rock { background-color: var(--type-glass-rock); }
.type-filter-btn.type-ghost { background-color: var(--type-glass-ghost); }
.type-filter-btn.type-dragon { background-color: var(--type-glass-dragon); }
.type-filter-btn.type-dark { background-color: var(--type-glass-dark); }
.type-filter-btn.type-steel { background-color: var(--type-glass-steel); }
.type-filter-btn.type-fairy { background-color: var(--type-glass-fairy); }

.type-filter-btn:hover:not(.active) {
    opacity: 1;
    transform: translateY(-2px);
}

.type-filter-btn.active {
    opacity: 1;
    filter: saturate(1);
    font-weight: 700;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.8);
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- Special button styles --- */
#see-all-btn {
    background-color: rgba(255, 255, 255, 0.15);
}

#see-all-btn.active {
    background-color: rgba(255, 255, 255, 0.3);
}

/* --- Grid Messages (No results, errors) --- */
.grid-message {
    grid-column: 1 / -1; /* Span all columns */
    text-align: center;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.filter-section-disabled {
    opacity: 0.5;
    /* pointer-events: none; <- This was the error, removing it */
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.no-results-img {
    width: 150px;
    height: auto;
    opacity: 0.8;
    image-rendering: pixelated; /* Keeps the pixel art sharp */
}

.no-results-text {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.no-results-text small {
    font-size: 0.9rem;
    opacity: 0.8;
}
