/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    font-size: 18px;
    line-height: 1.4;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Accessibility - Uppercase by default */
.uppercase {
    text-transform: uppercase;
}

/* Header Controls */
header {
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

/* Search Container */
.search-container {
    display: flex;
    gap: 10px;
    max-width: 800px;
    margin: 15px auto 0;
    align-items: center;
}

#search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 3px solid #4a90e2;
    border-radius: 12px;
    outline: none;
}

#search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#search-btn, #filter-toggle {
    padding: 12px 16px;
    font-size: 20px;
    border: 3px solid #4a90e2;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-btn:hover, #filter-toggle:hover {
    background: #4a90e2;
    transform: scale(1.05);
}

#filter-toggle.active {
    background: #4a90e2;
    color: white;
}

/* Filters Panel */
.filters-panel {
    max-width: 800px;
    margin: 15px auto 0;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 3px solid #4a90e2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    transition: all 0.3s ease;
}

.filters-panel.hidden {
    display: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.filter-group select {
    padding: 10px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.filter-group select:focus {
    border-color: #4a90e2;
    outline: none;
}

.clear-filters-btn {
    grid-column: 1 / -1;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    background: white;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: #e74c3c;
    color: white;
}

#language-selector {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: bold;
    border: 3px solid #4a90e2;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    min-width: 80px;
}

#accessibility-toggle, #advanced-toggle, #pdf-export {
    padding: 12px 16px;
    font-size: 20px;
    font-weight: bold;
    border: 3px solid #4a90e2;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    min-width: 60px;
    transition: all 0.3s ease;
    margin-left: 10px;
}

#accessibility-toggle:hover, #advanced-toggle:hover {
    background: #4a90e2;
    color: white;
}

/* Main Content */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* Loading */
.loading {
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Pokemon Container */
.pokemon-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Pokemon Header Layout */
.pokemon-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.pokemon-image-container {
    flex-shrink: 0;
}

.pokemon-info {
    flex: 1;
    text-align: left;
}

.pokemon-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border-radius: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.pokemon-name {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.pokemon-generation {
    font-size: 1.2em;
    color: #7f8c8d;
    font-weight: bold;
    margin-bottom: 15px;
}

/* Basic Stats */
.pokemon-basic-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.stat {
    text-align: center;
}

.stat span:first-child {
    display: block;
    font-weight: bold;
    color: #666;
    margin-bottom: 5px;
}

.stat span:last-child {
    display: inline-block;
    font-size: 0.9em;
    font-weight: bold;
    color: #2c3e50;
}

/* Description Section */
.pokemon-description-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.pokemon-description-section h3 {
    font-size: 1.5em;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.pokemon-description {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    text-align: center;
    font-style: italic;
}

/* Details Section */
.pokemon-details-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: white;
    border-radius: 10px;
}

.detail-label {
    font-weight: bold;
    color: #666;
}

.detail-value {
    font-weight: bold;
    color: #2c3e50;
    text-transform: capitalize;
}

/* Recuadro de color */
.stat .color-box {
    display: inline-block !important;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #333;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Contenedor del color para mantener en línea */
#pokemon-color {
    display: block;
    align-items: center;
    white-space: nowrap;
}

/* Special Badges */
.pokemon-special {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.special-badge {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 0.9em;
    text-align: center;
}

.special-badge.legendary {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #8b4513;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

.special-badge.mythical {
    background: linear-gradient(135deg, #e91e63, #f06292);
    color: white;
    box-shadow: 0 3px 10px rgba(233, 30, 99, 0.3);
}

/* Advanced Mode Styles */
.pokemon-advanced-content {
    display: none;
    margin-top: 30px;
}

.pokemon-container.advanced-mode .pokemon-advanced-content {
    display: block;
}

.pokemon-container.advanced-mode {
    max-width: 1000px;
    margin: 20px auto;
}

.pokemon-stats-section, .pokemon-abilities-section, .pokemon-evolution-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.pokemon-stats-section h3, .pokemon-abilities-section h3, .pokemon-evolution-section h3 {
    font-size: 1.5em;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

/* Evolution Chain */
.evolution-chain {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.evolution-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 15px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-width: 120px;
    cursor: pointer;
}

.evolution-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    background: #f0f8ff;
}

.evolution-item.current {
    background: #e3f2fd;
    border: 3px solid #2196f3;
    transform: scale(1.05);
}

.evolution-item.current:hover {
    transform: scale(1.05) translateY(-2px);
}

.evolution-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.evolution-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
    text-transform: capitalize;
}

.evolution-stage {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.evolution-level {
    font-size: 0.8em;
    color: #4caf50;
    font-weight: bold;
}

.evolution-arrow {
    font-size: 2em;
    color: #666;
    font-weight: bold;
}

.no-evolution {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Stats Bars */
.stat-item {
    display: grid;
    grid-template-columns: 160px 1fr 30px;
    align-items: center;
    margin: 8px 0;
    gap: 15px;
}

.stat-name {
    font-weight: bold;
    color: #555;
    text-align: left;
    font-size: 0.9em;
}

.stat-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.stat-value {
    font-weight: bold;
    color: #2c3e50;
    text-align: right;
    font-size: 0.9em;
}

/* Abilities */
.pokemon-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.ability-item {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border-radius: 25px;
    font-weight: bold;
    text-transform: capitalize;
}

.ability-item.hidden-ability {
    background: #9b59b6;
    position: relative;
}

.ability-item.hidden-ability::after {
    content: attr(data-hidden-text);
    font-size: 0.8em;
    opacity: 0.8;
}

/* Desktop styles - Force original layout */
@media (min-width: 769px) {
    .pokemon-container {
        margin: 20px 0;
        padding: 30px;
        border-radius: 20px;
    }
    
    .pokemon-header {
        display: flex;
        align-items: center;
        gap: 30px;
        margin-bottom: 30px;
    }
    
    .pokemon-info {
        flex: 1;
        text-align: left;
    }
    
    .pokemon-image {
        width: 200px;
        height: 200px;
    }
    
    .pokemon-name {
        font-size: 2.5em;
    }
    
    .pokemon-basic-stats {
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 20px;
        margin: 30px 0;
    }
}

@media (max-width: 768px) {
    .pokemon-container {
        margin: 5px 2px;
        padding: 15px 8px;
        border-radius: 15px;
    }
    
    .pokemon-header {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 15px;
        align-items: center;
    }
    
    .pokemon-info {
        text-align: left;
    }
    
    .pokemon-image {
        width: 150px;
        height: 150px;
    }
    
    .pokemon-name {
        font-size: 1.8em;
        word-break: break-word;
        line-height: 1.2;
    }
    
    .pokemon-basic-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat {
        text-align: center;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .pokemon-special {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .stat-item {
        grid-template-columns: 140px 1fr 25px;
        gap: 10px;
        margin: 6px 0;
    }
    
    .stat-name {
        font-size: 0.85em;
    }
    
    .stat-bar {
        height: 10px;
    }
    
    .evolution-chain {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 10px;
        max-width: 350px;
    }
    
    .evolution-arrow {
        font-size: 1.2em;
    }
    
    .evolution-item {
        min-width: 60px;
    }
    
    .evolution-image {
        width: 50px;
        height: 50px;
    }
}

/* Only rotate arrow on very small screens where wrapping is guaranteed */
@media (max-width: 400px) {
    .evolution-arrow {
        transform: rotate(90deg);
    }
}

/* Pokemon List View */
.pokemon-list-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 20px;
}

.list-header h2 {
    color: #2c3e50;
    font-size: 2em;
    margin: 0;
}

.close-list-btn {
    padding: 10px 20px;
    font-size: 18px;
    font-weight: bold;
    border: 3px solid #e74c3c;
    border-radius: 12px;
    background: #e74c3c;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-list-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.pokemon-list-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 15px;
    background: #f8f9fa;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.pokemon-list-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    background: #e3f2fd;
}

.pokemon-list-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.pokemon-list-id {
    font-weight: bold;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.pokemon-list-name {
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    font-size: 0.9em;
}

/* Responsive for list */
@media (max-width: 768px) {
    .pokemon-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .pokemon-list-item {
        padding: 10px;
    }
    
    .pokemon-list-image {
        width: 60px;
        height: 60px;
    }
    
    .list-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}
.pokemon-types {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.type-badge {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 16px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    min-width: 80px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-icon {
    font-size: 18px;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.3));
}
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.stat span:first-child {
    display: block;
    font-weight: bold;
    color: #6c757d;
    margin-bottom: 5px;
}

.stat span:last-child {
    display: block;
    font-size: 0.9em;
    font-weight: bold;
    color: #2c3e50;
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 15px 25px;
    font-size: 18px;
    font-weight: bold;
    border: 3px solid #4a90e2;
    border-radius: 12px;
    background: white;
    color: #4a90e2;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    min-height: 54px;
}

.nav-btn:hover:not(:disabled) {
    background: #4a90e2;
    color: white;
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.home-btn {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.home-btn:hover {
    background: #218838;
    border-color: #218838;
}

/* Counter */
.pokemon-counter {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 20px;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 1000;
}

.error-message p {
    color: #dc3545;
    font-weight: bold;
    margin-bottom: 20px;
}

#retry-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #dc3545;
    border-radius: 8px;
    background: #dc3545;
    color: white;
    cursor: pointer;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        padding: 10px;
    }
    
    header {
        padding: 15px 10px;
    }
    
    .controls {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    #language-selector {
        padding: 8px 12px;
        font-size: 14px;
        width: auto;
        min-width: 70px;
    }
    
    .button-group {
        display: flex;
        gap: 8px;
    }
    
    #accessibility-toggle, #advanced-toggle, #pdf-export {
        padding: 8px 12px;
        font-size: 16px;
        width: auto;
        min-width: 50px;
    }
    
    .container {
        max-width: 100%;
        margin: 10px;
        padding: 20px 15px;
    }
    
    .pokemon-card {
        padding: 20px 15px;
        margin: 0 auto;
    }
    
    .pokemon-image {
        width: 180px;
        height: 180px;
        margin-bottom: 15px;
    }
    
    .pokemon-name {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    .pokemon-id {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
    
    .pokemon-types {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .type-badge {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .pokemon-description {
        font-size: 16px;
        line-height: 1.5;
        margin-bottom: 15px;
    }
    
    .pokemon-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .stat-item {
        padding: 8px;
        font-size: 14px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .nav-btn {
        width: 100%;
        max-width: none;
        padding: 16px;
        font-size: 16px;
    }
    
    .pokemon-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .pokemon-list-item {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .pokemon-list-item img {
        width: 60px;
        height: 60px;
    }
    
    .evolution-chain {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 8px;
        max-width: 280px;
    }
    
    .evolution-item {
        width: 120px;
    }
}
}

@media (max-width: 480px) {
    .pokemon-container {
        margin: 2px 1px;
        padding: 12px 6px;
        border-radius: 12px;
    }
    
    body {
        font-size: 14px;
        padding: 5px;
    }
    
    .container {
        margin: 5px;
        padding: 15px 10px;
    }
    
    .pokemon-image {
        width: 150px;
        height: 150px;
    }
    
    .pokemon-name {
        font-size: 1.6em;
    }
    
    .pokemon-description {
        font-size: 15px;
    }
    
    .pokemon-stats {
        grid-template-columns: 1fr;
    }
    
    .pokemon-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
        padding: 10px;
    }
    
    .pokemon-list-item img {
        width: 50px;
        height: 50px;
    }
    
    /* Search and filters responsive */
    .search-container {
        flex-direction: column;
        gap: 8px;
    }
    
    #search-input {
        width: 100%;
    }
    
    #search-btn, #filter-toggle {
        width: 100%;
    }
    
    .filters-panel {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 12px;
    }
}
