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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #10b981;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-light: #f1f5f9;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --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 -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Rubik', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.header {
    background: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 800;
    cursor: pointer;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.2));
}

.logo-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-plus {
    color: var(--secondary);
}

.nav {
    display: flex;
    gap: 2.5rem;
    justify-self: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.user-btn {
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.user-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.hero {
    position: relative;
    height: 36vh;
    min-height: 320px;
    max-height: 400px;
    overflow: hidden;
    background-color: #111827;
}

.hero-slider {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.hero-slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
}

.hero-slide-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
}

.hero-slide-content {
    position: relative;
    z-index: 2;
    color: white;
    padding: 3rem 2rem;
    max-width: 700px;
    text-align: right;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s;
}

.hero-slide.active .hero-slide-content {
    opacity: 1;
    transform: translateY(0);
}

.hero-slide-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-slide-description {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.hero-slide-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.hero-slide-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.hero-pagination {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.hero-dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-dot:hover {
    background: white;
}

.hero-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.search-and-filters {
    padding: 2.5rem 0;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.main-search-box {
    position: relative;
    max-width: 700px;
    width: 100%;
    margin: 0 auto 1.25rem auto;
}

.main-search-box input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    font-size: 1.1rem;
    font-family: 'Rubik', sans-serif;
    color: var(--text-dark);
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.main-search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15), var(--shadow-lg);
}

.main-search-box .search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.filter-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.filter-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.filter-select {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: var(--text-dark);
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    font-size: 0.9rem;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.main-content {
    padding-top: 3rem;
}

.anime-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-dark);
    position: relative;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 80px;
    height: 2px;
    background: var(--primary);
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.anime-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.anime-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.anime-image {
    position: relative;
    width: 100%;
    height: 350px;
    overflow: hidden;
    background-color: var(--bg-light);
}

.anime-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.anime-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(14, 23, 43, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.anime-card:hover .anime-overlay {
    opacity: 1;
}

.play-btn {
    background: white;
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 1rem;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.anime-type {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.anime-info {
    padding: 1.25rem;
}

.anime-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anime-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.rating {
    color: #f59e0b;
    font-weight: 600;
}

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

.genre-tag {
    background-color: var(--bg-light);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
}

.loading {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

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

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

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

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

.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-main);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-dark);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-hero {
    position: relative;
    height: 350px;
    overflow: hidden;
    background: var(--bg-light);
    border-radius: 16px 16px 0 0;
}

.modal-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-hero-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 2rem;
    background: linear-gradient(to top, rgba(17, 24, 39, 0.9), transparent);
}

.modal-hero-overlay h2 {
    font-size: 2.5rem;
    color: white;
    font-weight: 700;
}

.modal-subtitle {
    color: #d1d5db;
    font-size: 1.1rem;
    font-weight: 400;
}

.modal-details {
    padding: 2rem;
}

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

.btn-primary, .btn-secondary {
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Rubik', sans-serif;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
    flex: 1;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
}

.modal-info {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    color: var(--text-dark);
    font-weight: 500;
}

.modal-description h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 600;
}

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

.footer {
    background: #111827;
    color: #d1d5db;
    margin-top: 5rem;
    padding: 3.5rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.footer-section h3, .footer-section h4 {
    color: white;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

.footer-section p, .footer-section ul li a {
    color: #9ca3af;
    transition: color 0.3s ease;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.7rem;
}

.footer-section ul li a {
    text-decoration: none;
}

.footer-section ul li a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1f2937;
    border-radius: 50%;
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .header-content {
        grid-template-columns: auto 1fr;
        justify-content: space-between;
    }
    .nav {
        grid-row: 2;
        grid-column: 1 / -1;
        justify-self: center;
        padding-top: 1rem;
    }
    .header-actions {
        justify-self: end;
    }
}


@media (max-width: 768px) {
    .hero { height: 50vh; }
    .hero-slide-title { font-size: 2.2rem; }
    .anime-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; }
    .modal-content { margin: 1rem; }
    .modal-hero-overlay h2 { font-size: 1.8rem; }
    .modal-actions { flex-direction: column; }
}

@media (max-width: 500px) {
    .nav {
        gap: 1.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
}


.grid-message, .modal-error {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.modal-error h3 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}
