* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.search-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* DOM MANIPULATION: Styling for interactive search elements */
.search-input {
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    min-width: 300px;
    outline: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* DOM MANIPULATION: Button styling with hover effects */
.search-btn, .random-btn, .retry-btn {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

.search-btn {
    background: #4CAF50;
    color: white;
}

.random-btn {
    background: #FF9800;
    color: white;
}

.retry-btn {
    background: #2196F3;
    color: white;
    margin-top: 15px;
}

/* DOM MANIPULATION: Interactive hover effects */
.search-btn:hover, .random-btn:hover, .retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* LOADING STATES: CSS animations for loading spinner */
.loading-spinner {
    text-align: center;
    padding: 50px;
    color: white;
}

/* LOADING STATES: Animated spinner element */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* LOADING STATES: Keyframe animation for spinner rotation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ERROR HANDLING: Error message container styling */
.error-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* ERROR HANDLING: Error icon styling */
.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ERROR HANDLING: Error message text styling */
.error-message h3 {
    color: #e74c3c;
    margin-bottom: 10px;
}

/* DOM MANIPULATION: Pokemon card with animation */
.pokemon-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    animation: fadeInUp 0.5s ease-out; /* DOM MANIPULATION: Entry animation */
}

/* DOM MANIPULATION: Fade-in animation for Pokemon cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* DOM MANIPULATION: Responsive layout for Pokemon header */
.pokemon-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* DOM MANIPULATION: Dynamic Pokemon image styling */
.pokemon-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 20px;
}

/* DOM MANIPULATION: Pokemon name styling */
.pokemon-basic-info h2 {
    font-size: 2.5rem;
    color: #2c3e50;
    text-transform: capitalize;
    margin-bottom: 10px;
}

/* DOM MANIPULATION: Pokemon ID styling */
.pokemon-id {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 15px;
}

/* DOM MANIPULATION: Type badges container */
.pokemon-types {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* DOM MANIPULATION: Dynamic type badge styling */
.type-badge {
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    text-transform: capitalize;
    font-size: 0.9rem;
}

/* DOM MANIPULATION: Dynamic type-specific colors applied via JavaScript */
.type-normal { background: #A8A878; }
.type-fire { background: #F08030; }
.type-water { background: #6890F0; }
.type-electric { background: #F8D030; }
.type-grass { background: #78C850; }
.type-ice { background: #98D8D8; }
.type-fighting { background: #C03028; }
.type-poison { background: #A040A0; }
.type-ground { background: #E0C068; }
.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; }
.type-fairy { background: #EE99AC; }

/* DOM MANIPULATION: Stats section styling */
.pokemon-stats {
    margin-bottom: 30px;
}

.pokemon-stats h3, .pokemon-abilities h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* DOM MANIPULATION: Individual stat item layout */
.stat-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

/* DOM MANIPULATION: Stat name styling */
.stat-name {
    min-width: 120px;
    font-weight: 600;
    text-transform: capitalize;
    color: #34495e;
}

/* DOM MANIPULATION: Animated stat bar container */
.stat-bar {
    flex: 1;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 15px;
}

/* DOM MANIPULATION: Animated stat fill with gradient */
.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c 0%, #f39c12 50%, #27ae60 100%);
    border-radius: 10px;
    transition: width 0.8s ease-out; /* DOM MANIPULATION: Smooth animation */
}

/* DOM MANIPULATION: Stat value display */
.stat-value {
    min-width: 50px;
    font-weight: 600;
    color: #2c3e50;
}

/* DOM MANIPULATION: Responsive grid for Pokemon details */
.pokemon-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* DOM MANIPULATION: Individual detail item styling */
.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.label {
    font-weight: 600;
    color: #495057;
}

/* DOM MANIPULATION: Abilities container */
.abilities-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* DOM MANIPULATION: Dynamic ability badges */
.ability-badge {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border-radius: 20px;
    font-weight: 600;
    text-transform: capitalize;
}

/* DOM MANIPULATION: Pokemon history section */
.pokemon-history {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
}

.pokemon-history h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

/* DOM MANIPULATION: Scrollable history container */
.history-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0;
}

/* DOM MANIPULATION: Interactive history items */
.history-item {
    min-width: 120px;
    text-align: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: transform 0.2s;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* DOM MANIPULATION: Hover effect for history items */
.history-item:hover {
    transform: scale(1.05);
}

.history-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.history-item p {
    margin-top: 8px;
    font-weight: 600;
    color: #2c3e50;
    text-transform: capitalize;
}

/* LOADING STATES: Hidden class for state management */
.hidden {
    display: none !important;
}

/* DOM MANIPULATION: Responsive design for mobile devices */
@media (max-width: 768px) {
    .pokemon-header {
        flex-direction: column;
        text-align: center;
    }
    
    .search-input {
        min-width: 250px;
    }
    
    .pokemon-details {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .stat-bar {
        width: 100%;
        margin: 0;
    }
}
