:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --accent: #e63946;
    --accent-secondary: #7c3aed;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b80;
    --gradient-1: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --border: rgba(255, 255, 255, 0.06);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px rgba(230, 57, 70, 0.3);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

img {
    max-width: 100%;
    display: block;
}

/* Utilities */
.section {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-left: 4px solid var(--accent);
    padding-left: 10px;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.ml-1 { margin-left: 0.5rem; }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-secondary); }

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    background-color: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s;
}

.navbar.scrolled {
    background-color: rgba(10, 10, 15, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.search-icon-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-search {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3rem 1rem;
    align-items: center;
}

.nav-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    padding: 0.2rem;
    width: 200px;
}

.nav-search button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.mobile-menu-btn span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: 0.3s;
}

/* Carousel */
.hero-section {
    width: 100%;
    position: relative;
}

.hero-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 21/9;
    max-height: 500px;
}

.carousel-inner {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease;
}

.carousel-item {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.carousel-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 50%);
    pointer-events: none;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.3s;
}

.carousel-btn:hover { background: var(--accent); }
.carousel-btn.prev { left: 20px; }
.carousel-btn.next { right: 20px; }

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

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

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

/* Grids & Cards */
.scroll-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: none;
}
.scroll-row::-webkit-scrollbar { display: none; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }

.card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    border: 1px solid var(--border);
    position: relative;
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-glow);
    border-color: rgba(230, 57, 70, 0.3);
}

.anime-card .img-wrapper {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
}

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

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

.card-info {
    padding: 1rem;
}

.card-info .title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.card-info .subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.episode-card {
    min-width: 280px;
}
.episode-card .img-wrapper {
    aspect-ratio: 16/9;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-dub { background: #10b981; color: #fff; }
.badge-type { background: var(--accent-secondary); color: #fff; }
.rating-badge { background: #f59e0b; color: #000; }
.badge-top { position: absolute; top: 10px; left: 10px; z-index: 2; }

.tags-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.meta-row { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }

/* Categories */
.category-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    min-height: 200px;
    display: block;
}
.category-card img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}
.category-card:hover img { transform: scale(1.1); }
.category-card .overlay {
    position: absolute;
    inset: 0;
    transition: opacity 0.3s;
}
.category-card:hover .overlay { opacity: 0.8; }
.category-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    z-index: 2;
}
.category-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Filter Tags */
.filter-tags { margin-bottom: 1.5rem; }
.filter-tag {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: 0.2s;
}
.filter-tag:hover { background: var(--bg-card-hover); }
.filter-tag.active {
    background: var(--cat-color, var(--accent));
    border-color: transparent;
    color: white;
}

/* Search Page */
.page-search-form { max-width: 600px; margin: 0 auto 2rem; }
.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 0.5rem 1rem;
    gap: 1rem;
}
.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    padding: 0.5rem 0;
}
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-primary:hover { background: #ff4d5a; }

.active-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}
.clear-filter { color: var(--accent); font-weight: bold; }
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }

/* Anime Detail Page */
.anime-banner-container {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}
.anime-banner {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}
.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-primary) 0%, rgba(10,10,15,0.4) 100%);
}

.anime-content-section {
    margin-top: -150px;
    position: relative;
    z-index: 10;
}

.anime-info {
    display: flex;
    gap: 3rem;
    align-items: flex-end;
    margin-bottom: 3rem;
}

.anime-poster {
    flex-shrink: 0;
    width: 250px;
    border-radius: 12px;
    overflow: hidden;
}
.shadow-glow { box-shadow: 0 0 20px rgba(0,0,0,0.8); }

.anime-details {
    padding-bottom: 1rem;
    flex: 1;
}
.anime-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}
.anime-meta-badges { margin-bottom: 1rem; display: flex; gap: 0.5rem; }
.anime-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.anime-description {
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 800px;
}

.season-tabs { margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.season-tab {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}
.season-tab:hover { background: var(--bg-card); color: var(--text-primary); }
.season-tab.active { background: var(--accent); color: white; }

.episode-item-card .ep-thumb { aspect-ratio: 16/9; }
.ep-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 2;
}
.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    opacity: 0;
    transition: 0.3s;
    z-index: 2;
}
.episode-item-card:hover .play-overlay { opacity: 1; }

/* Watch Page */
.watch-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}
.player-container {
    background: #000;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}
.html-player { width: 100%; height: 100%; }
.player-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
}
.ep-title { font-size: 1.5rem; margin-bottom: 0.5rem; }
.anime-link { color: var(--text-secondary); font-size: 1.1rem; }
.anime-link:hover { color: var(--accent); }

.episodes-sidebar {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    max-height: 600px;
    display: flex;
    flex-direction: column;
}
.sidebar-title { margin-bottom: 1rem; font-size: 1.2rem; }
.episode-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ep-list-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: 0.2s;
}
.ep-list-item:hover { background: var(--bg-card); }
.ep-list-item.active { background: var(--bg-card-hover); border-left: 3px solid var(--accent); }
.ep-list-thumb {
    width: 100px;
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.ep-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.now-playing-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.ep-list-info h4 { font-size: 0.9rem; margin-bottom: 0.2rem; }
.ep-list-info p { font-size: 0.8rem; color: var(--text-secondary); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.lazy-load { animation: fadeIn 0.5s ease-in; }

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 3rem 5% 1rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
}
.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-logo-area p { color: var(--text-secondary); margin-top: 0.5rem; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--text-primary); }
.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .watch-layout { grid-template-columns: 1fr; }
    .episodes-sidebar { max-height: 400px; }
}
@media (max-width: 768px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .nav-links, .nav-search { display: none; }
    .mobile-menu-btn { display: flex; }
    .hero-carousel { aspect-ratio: 16/9; }
    .anime-info { flex-direction: column; align-items: center; text-align: center; gap: 1.5rem; }
    .anime-stats { justify-content: center; }
    .anime-meta-badges { justify-content: center; }
}
@media (max-width: 480px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .anime-poster { width: 180px; }
    .anime-title { font-size: 1.8rem; }
    .section { padding: 1.5rem 5%; }
}


/* ------------------------------------- */
/* PREMIUM DESIGN OVERHAUL               */
/* ------------------------------------- */

/* Hero Section */
.hero-carousel {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--bg-primary) 0%, rgba(10,10,15,0) 50%, rgba(10,10,15,0.3) 100%);
    z-index: 1;
}
.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 6s ease;
}
.carousel-item:hover .hero-img {
    transform: scale(1.05);
}
.hero-info {
    position: absolute;
    bottom: 40px;
    left: 40px;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.hero-info h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}
.hero-badge {
    background: var(--accent);
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    position: relative;
    padding-left: 15px;
}
.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 80%;
    background: var(--accent);
    border-radius: 2px;
}

/* Poster Cards */
.posters-row {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
}
.poster-card-wrapper {
    flex: 0 0 auto;
    width: 160px;
}
.poster-card-link {
    text-decoration: none;
    color: inherit;
}
.poster-card {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: var(--bg-card);
}
.poster-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.poster-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.poster-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(230, 57, 70, 0.2);
}
.poster-card:hover img {
    transform: scale(1.08);
}
.poster-card:hover .poster-overlay {
    opacity: 1;
}
.poster-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 10px;
    text-align: center;
    transition: color 0.2s;
}
.poster-card-wrapper:hover .poster-title {
    color: var(--accent);
}

/* Navbar Upgrade */
.navbar {
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* Episode Card Enhancements */
.episode-card.card {
    border: none;
    background: transparent;
}
.episode-card .img-wrapper {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}
.episode-card:hover .img-wrapper {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.25);
}
.episode-card .play-overlay {
    opacity: 0;
}
.episode-card:hover .play-overlay {
    opacity: 1;
}
.episode-card .card-info {
    padding: 12px 5px;
    background: transparent;
}
.episode-card .title {
    font-weight: 600;
    font-size: 1rem;
}
.episode-card .subtitle {
    color: var(--text-muted);
}

/* Mobile Menu Styles */
.nav-links.mobile-active,
.nav-search.mobile-active {
    display: flex !important;
}

@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--bg-secondary);
        padding: 1rem;
        border-radius: 8px;
        margin-top: 10px;
        box-shadow: var(--shadow);
    }
    .nav-search {
        display: none;
        width: 100%;
        margin-top: 10px;
    }
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
    }
    .mobile-menu-btn span {
        display: block;
        width: 25px;
        height: 3px;
        background-color: var(--text-primary);
        transition: 0.3s;
        border-radius: 3px;
    }
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
}
