/* ===================================
   AnimeSearch 2025 - Modern Redesign
   Author: Luca Mastroianni | BlueMoon
   =================================== */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --airing: #ef4444;
    --completed: #64748b;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 120px;
}

/* ==================
   HEADER SECTION
   ================== */

.main-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    background-color: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 1rem 3rem;
    position: relative;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    display: inline-block;
    animation: gradientShift 3s ease infinite;
}

.logo i {
    -webkit-text-fill-color: var(--primary-color);
    margin-right: 0.5rem;
}

@keyframes gradientShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(20deg); }
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.mal-profile {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.mal-input {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    max-width: 200px;
}

.mal-input:focus {
    border-color: var(--primary-color);
}

.mal-save-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mal-save-btn:hover {
    background: var(--secondary-color);
}

.mal-link {
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 25px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mal-link:hover {
    background: var(--primary-color);
    color: white;
}

.anilist-lists {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.anilist-list-btn {
    padding: 0.5rem 1rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--secondary-color);
    border-radius: 25px;
    color: var(--secondary-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.anilist-list-btn:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}

/* ==================
   SEARCH SECTION
   ================== */

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

.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 300px;
    max-width: 600px;
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.search-bar {
    width: 100%;
    padding: 1rem 3.5rem 1rem 3.5rem;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

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

.search-bar::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: none;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.clear-btn.active {
    display: block;
}

.search-button {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.search-button:active {
    transform: translateY(0);
}

/* ==================
   FILTERS
   ================== */

.filters-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

.filter-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.filter-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding: 0.25rem;
}

.filter-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.favorites-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-color), #f43f5e);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.favorites-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(236, 72, 153, 0.3);
}

.fav-count {
    background: white;
    color: var(--accent-color);
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ==================
   LOADING & RESULTS
   ================== */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    gap: 1rem;
}

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

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

.results-info {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================
   CARDS GRID
   ================== */

.cards-list {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    animation: fadeIn 0.5s ease;
}

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

/* ==================
   CARD DESIGN
   ================== */

.card {
    position: relative;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    animation: cardAppear 0.5s ease backwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card_image {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.card_image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card_image img {
    transform: scale(1.1);
}

.card_image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, var(--bg-card), transparent);
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    
    display: flex;
    align-items: center;
    gap: 0.3rem;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.airing {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.status-badge.completed {
    background: rgba(100, 116, 139, 0.9);
    color: white;
}

/* Info Icon */
.info-icon-wrapper {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.9);
    
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.info-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(180deg);
}

/* Favorite Button */
.favorite-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.9);
    
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.favorite-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.1);
}

.favorite-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.favorite-btn.active:hover {
    background: #f43f5e;
}

/* Card Content */
.card_content {
    padding: 1.5rem;
    position: relative;
}

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

.card_meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.score-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 50px;
    color: #fbbf24;
    font-weight: 600;
}

.user-score {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    background: rgba(236, 72, 153, 0.1);
    border-radius: 50px;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.user-progress {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50px;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.85rem;
}

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

.streamings-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.streaming-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.streaming-loading {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.streaming-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.streaming-icon:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

/* ==================
   MODAL
   ================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    
    z-index: 1000;
    padding: 2rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    position: relative;
    border: 1px solid var(--border-color);
    animation: modalSlideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--error);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.modal-image {
    width: 200px;
    height: 300px;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.modal-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-tag {
    padding: 0.3rem 0.8rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-synopsis {
    margin-top: 2rem;
}

.modal-synopsis h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-synopsis p {
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ==================
   TOAST NOTIFICATION
   ================== */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

/* ==================
   FOOTER
   ================== */

footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.footer-info {
    display: flex;
    gap: 2rem;
    flex: 1;
}

.footer-section {
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.4;
}

.footer-logo {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.social-links {
    display: inline-flex;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.social-links a {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: #1DA1F2;
    color: white;
    transform: translateY(-2px);
}

.copyright {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
}

.disclaimer,
.disclaimer-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.disclaimer strong {
    color: var(--text-primary);
}

.privacy-policy {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.65rem;
    transition: color 0.3s ease;
}

.privacy-policy:hover {
    color: var(--accent-color);
}

.footer-mascot {
    position: absolute;
    right: 20px;
    bottom: 0;
}

.mascot-img {
    width: 90px;
    height: auto;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ==================
   RESPONSIVE
   ================== */

@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .mal-profile {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
    }
    
    .mal-input {
        width: 100%;
        max-width: 100%;
    }
    
    .anilist-lists {
        width: 100%;
        padding: 0 1rem;
    }
    
    .anilist-list-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input-wrapper {
        min-width: 100%;
    }
    
    .search-button {
        width: 100%;
        justify-content: center;
    }
    
    .filters-container {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-group,
    .favorites-btn {
        width: 100%;
        justify-content: space-between;
    }
    
    .cards-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .modal-header {
        flex-direction: column;
    }
    
    .modal-image {
        width: 100%;
        height: auto;
    }
    
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: calc(100px + 1rem);
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-info {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .footer-section {
        font-size: 0.65rem;
    }
    
    footer {
        padding: 0.75rem;
    }
    
    .footer-logo {
        font-size: 1rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-mascot {
        position: static;
        margin-top: 0.5rem;
    }
    
    .mascot-img {
        width: 70px;
    }
    
    .disclaimer-sub {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 1.5rem 0.5rem 2rem;
    }
    
    .card_image {
        height: 350px;
    }
    
    body {
        padding-bottom: 100px;
    }
    
    footer {
        padding: 0.5rem;
    }
    
    .mascot-img {
        width: 60px;
    }
    
    .footer-logo {
        font-size: 0.9rem;
    }
    
    .disclaimer,
    .privacy-policy {
        font-size: 0.6rem;
    }
    
    .copyright {
        font-size: 0.6rem;
    }
}

/* ==================
   UTILITY CLASSES
   ================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

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

.no-results h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
