/* Reset y variables CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f59e0b;
    --accent-color: #ec4899;
    --background-dark: #0f172a;
    --background-light: #1e293b;
    --surface-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    --gradient-secondary: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0,0,0); }
    40%, 43% { transform: translate3d(0, -30px, 0); }
    70% { transform: translate3d(0, -15px, 0); }
    90% { transform: translate3d(0, -4px, 0); }
}

/* Container principal */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-light) 100%);
}

/* Header */
.header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-image {
    height: 120px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}


.clickable-logo {
    cursor: pointer;
    transition: all 0.3s ease;
}

.clickable-logo:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Language Selector */
.language-selector {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1000;
}

.language-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.language-btn:hover {
    background: var(--background-light);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.language-btn i {
    font-size: 0.8rem;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    overflow: hidden;
    display: none;
    z-index: 1001;
}

.language-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.language-option {
    width: 100%;
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    text-align: left;
}

.language-option:hover {
    background: var(--background-light);
}

.language-option:first-child {
    border-bottom: 1px solid var(--border-color);
}

.language-option .flag {
    font-size: 1.2rem;
}

.language-option.active {
    background: var(--primary-color);
    color: white;
}

/* Sección de búsqueda */
.search-section {
    padding: 3rem 0;
    animation: fadeIn 1s ease-out 0.2s both;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface-color);
    border-radius: 50px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-right: 1rem;
}

#animeSearch {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 400;
}

#animeSearch::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.search-btn:active {
    transform: scale(0.95);
}

/* Sugerencias de búsqueda */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-radius: 15px;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--background-light);
}

.suggestion-image {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.suggestion-info h4 {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.suggestion-info p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Loading spinner */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    animation: fadeIn 0.5s ease-out;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Contenido principal */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.6s ease-out;
}

.section-title i {
    color: var(--secondary-color);
}

/* Grid de animes */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.anime-card {
    background: var(--surface-color);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.6s ease-out;
}

.anime-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.anime-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.anime-card:hover .anime-image {
    transform: scale(1.05);
}

.anime-info {
    padding: 1.5rem;
}

.anime-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.anime-synopsis {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.anime-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.anime-score {
    background: var(--gradient-secondary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.anime-episodes {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.anime-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.genre-tag {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Botón de recomendaciones */
.anime-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.recommend-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: 25px;
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.recommend-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--gradient-secondary);
}

.recommend-btn:active {
    transform: translateY(0);
}

.recommend-btn i {
    font-size: 0.8rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.4s ease-out 0.1s both;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2.5rem; 
    font-weight: 700; 
    color: var(--text-secondary); 
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    line-height: 1; 
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);    
}

.close:hover {
    color: var(--text-primary);
    transform: scale(1.1); /* Efecto al pasar el mouse */
}
.modal-body {
    padding: 2rem;
}

/* Footer */
.footer {
    background: var(--background-light);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--accent-color);
}

.creator-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.creator-text {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.creator-name {
    color: var(--primary-color);
    font-weight: 600;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-color);
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.social-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.social-link i {
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .logo-image {
        height: 75px;
    }
    
    .language-selector {
        top: 0;
        right: 0;
    }
    
    .language-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .language-dropdown {
        min-width: 120px;
    }
    
    .search-container {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 0 1rem 2rem;
    }
    
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo-image {
        height: 90px;
    }
    
    .anime-grid {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        padding: 0.75rem 1rem;
    }
    
    .anime-info {
        padding: 1rem;
    }
}

/* Estados de error y vacío */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.error-state {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    color: var(--error-color);
    margin: 2rem 0;
}

.error-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Animaciones de entrada */
.anime-card:nth-child(1) { animation-delay: 0.1s; }
.anime-card:nth-child(2) { animation-delay: 0.2s; }
.anime-card:nth-child(3) { animation-delay: 0.3s; }
.anime-card:nth-child(4) { animation-delay: 0.4s; }
.anime-card:nth-child(5) { animation-delay: 0.5s; }
.anime-card:nth-child(6) { animation-delay: 0.6s; }
