
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    background-attachment: fixed;
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}


.controls {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.search-section {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

#searchInput {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-section button {
    padding: 12px 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

#searchInput:focus {
    outline: none;
    border-color: #4a6fa5;
}

button {
    padding: 12px 20px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #3a5a8a;
}


.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #444;
}

select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

select:focus {
    outline: none;
    border-color: #4a6fa5;
}
/* Contenedor de la tabla */
.table-container {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    max-height: 600px;
    overflow-y: auto;
}

/* Estilos de la tabla */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #4a6fa5;
    color: white;
    padding: 15px;
    text-align: left;
    position: sticky;
    top: 0;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f5fd;
}

/* Imágenes de Pokémon */
.pokemon-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.pokemon-name {
    font-weight: bold;
    text-transform: capitalize;
}

/* Mensaje de carga */
.loading {
    text-align: center;
    padding: 30px;
    font-size: 1.2rem;
    color: white;
    display: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.pokeball-spinner {
    width: 80px;
    height: 80px;
    background: linear-gradient(red 0%, red 48%, black 48%, black 52%, white 52%, white 100%);
    border-radius: 50%;
    border: 4px solid black;
    position: relative;
    animation: spin 1s linear infinite;
}

.pokeball-spinner::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border: 4px solid black;
    border-radius: 50%;
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1.2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Badges de tipos de Pokémon */
.type-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
    margin-right: 5px;
    text-transform: capitalize;
    font-weight: 500;
}

/* Controles de paginación */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination-controls button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #4a6fa5;
    border: 2px solid #4a6fa5;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.pagination-controls button:hover:not(:disabled) {
    background: #4a6fa5;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 111, 165, 0.3);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
    border-color: #999;
    color: #666;
    transform: none;
    box-shadow: none;
}

.pagination-arrow {
    font-size: 1.2rem;
    font-weight: bold;
}

#pageInfo {
    color: white;
    font-weight: bold;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    min-width: 120px;
    text-align: center;
}


/* Mensajes de estado */
.status-message {
    text-align: center;
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    font-weight: bold;
}

.status-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.status-success {
    background-color: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Contador de resultados */
.results-count {
    text-align: center;
    color: white;
    margin-bottom: 10px;
    font-size: 1rem;
    opacity: 0.9;
}

.total-count {
    text-align: center;
    color: white;
    margin-top: 5px;
    opacity: 0.8;
}

/* Colores para los tipos de Pokémon */
.normal { background-color: #A8A878; }
.fire { background-color: #F08030; }
.water { background-color: #6890F0; }
.electric { background-color: #F8D030; }
.grass { background-color: #78C850; }
.ice { background-color: #98D8D8; }
.fighting { background-color: #C03028; }
.poison { background-color: #A040A0; }
.ground { background-color: #E0C068; }
.flying { background-color: #A890F0; }
.psychic { background-color: #F85888; }
.bug { background-color: #A8B820; }
.rock { background-color: #B8A038; }
.ghost { background-color: #705898; }
.dragon { background-color: #7038F8; }
.dark { background-color: #705848; }
.steel { background-color: #B8B8D0; }
.fairy { background-color: #EE99AC; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

.close:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Contenido del modal */
.modal-pokemon {
    padding: 30px;
    color: white;
    text-align: center;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-pokemon-id {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.modal-pokemon-name {
    font-size: 2rem;
    font-weight: bold;
    text-transform: capitalize;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-pokemon-image {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.modal-pokemon-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-types {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Botón cargar más */
.load-more-container {
    text-align: center;
    margin-top: 20px;
}

#loadMoreBtn {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#loadMoreBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#loadMoreBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Indicador de búsqueda en tiempo real */
.search-indicator {
    text-align: center;
    color: white;
    font-style: italic;
    margin-top: 5px;
    font-size: 0.9rem;
    opacity: 0.8;
    display: none;
}

/* Mejoras a la tabla para hacer filas clickeables */
.pokemon-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.pokemon-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Spinner de carga */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a6fa5;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

.results-info {
    text-align: center;
    margin: 15px 0;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
}

.results-info span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    display: inline-block;
    max-width: 90%;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Para móviles pequeños */
@media (max-width: 480px) {
    .results-info {
        margin: 10px 0;
    }
    
    .results-info span {
        font-size: 0.9rem;
        padding: 6px 12px;
        max-width: 95%;
    }
}

/* Para tablets */
@media (max-width: 768px) {
    .results-info span {
        font-size: 1rem;
    }
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mejoras responsive para el modal */
@media (max-width: 600px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-stats {
        grid-template-columns: 1fr;
    }
    
    .modal-pokemon-image {
        width: 150px;
        height: 150px;
    }
    
    .modal-pokemon-name {
        font-size: 1.5rem;
    }
}

/* Efectos de carga skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 700px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
}
@media (max-width: 480px) {
    .pagination-controls {
        gap: 10px;
    }
    
    .pagination-controls button {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    #pageInfo {
        min-width: 100px;
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .table-container {
        max-height: 500px;
    }
    
    .pokemon-img {
        width: 60px;
        height: 60px;
    }
    
    td, th {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}
@media (max-width: 480px) {
    .search-section {
        flex-direction: column;
    }
    
    #searchInput {
        min-width: 100%;
        margin-bottom: 10px;
    }
    
    .search-section button {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Para tablets pequeñas */
@media (max-width: 768px) and (min-width: 481px) {
    .search-section {
        flex-wrap: nowrap;
    }
    
    #searchInput {
        min-width: 150px;
    }
}
