/* ============================================
   AnimeLand — Premium Dark Theme Design System
   ============================================ */

/* Design Tokens */
:root {
    /* Color Palette — Deep cosmic purple/blue with warm accent */
    --bg-primary: #06080f;
    --bg-secondary: #0c1018;
    --bg-tertiary: #111827;
    --surface: rgba(17, 24, 39, 0.65);
    --surface-hover: rgba(30, 41, 59, 0.7);
    --surface-elevated: rgba(22, 33, 55, 0.8);

    --accent: #a855f7;
    --accent-light: #c084fc;
    --accent-dark: #7c3aed;
    --accent-glow: rgba(168, 85, 247, 0.35);
    --accent-subtle: rgba(168, 85, 247, 0.08);

    --secondary-accent: #06b6d4;
    --secondary-glow: rgba(6, 182, 212, 0.25);

    --gold: #f59e0b;
    --gold-glow: rgba(245, 158, 11, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(148, 163, 184, 0.08);
    --border-hover: rgba(168, 85, 247, 0.3);

    --glass-blur: blur(16px);
    --glass-saturate: saturate(180%);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
    --shadow-2xl: 0 25px 80px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --sidebar-width: 270px;
    --sidebar-collapsed: 80px;
    --radius-full: 9999px;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --surface: rgba(255, 255, 255, 0.75);
    --surface-hover: rgba(255, 255, 255, 0.9);
    --surface-elevated: rgba(255, 255, 255, 0.85);

    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-dark: #6d28d9;
    --accent-glow: rgba(139, 92, 246, 0.2);
    --accent-subtle: rgba(139, 92, 246, 0.06);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(139, 92, 246, 0.25);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.1);
    --shadow-2xl: 0 25px 80px rgba(0,0,0,0.15);
}

/* ============ Global Reset ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color var(--transition), color var(--transition);
    min-height: 100vh;
    line-height: 1.6;
}

/* Particles Canvas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

[data-theme="light"] #particles-canvas {
    opacity: 0.15;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--accent-dark);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============ App Layout ============ */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============ Sidebar ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border-right: 1px solid var(--border);
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: all var(--transition);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 8px;
    cursor: pointer;
    transition: transform var(--transition);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-icon-wrapper {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent), var(--secondary-accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: box-shadow var(--transition);
}

.logo-icon-wrapper.small {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.logo:hover .logo-icon-wrapper {
    box-shadow: 0 6px 25px var(--accent-glow);
}

.logo-icon {
    font-size: 18px;
    color: #fff;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text span {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    opacity: 0;
    transition: opacity var(--transition);
    z-index: -1;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.nav-item.active {
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.nav-item.active::before {
    opacity: 1;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.fav-count {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px 0;
}

.stats-box {
    background: var(--accent-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.stats-row > i {
    font-size: 20px;
    color: var(--accent);
}

.stats-row > div {
    display: flex;
    flex-direction: column;
}

.stats-num {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-light);
}

.stats-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ Mobile Topbar ============ */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 40;
}

.hamburger {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

.mobile-logo .logo-text {
    font-size: 18px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 45;
    backdrop-filter: blur(4px);
}

/* ============ Main Content ============ */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 30px 40px 60px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
}

.view {
    animation: fadeInView 0.4s ease forwards;
}

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

/* ============ Header ============ */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--accent);
}

.search-wrapper {
    position: relative;
    max-width: 520px;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    transition: color var(--transition);
}

.search-wrapper:focus-within .search-icon {
    color: var(--accent);
}

#search-input, #catalog-search-input {
    width: 100%;
    padding: 14px 90px 14px 48px;
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}

#search-input:focus, #catalog-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md);
    background: var(--surface-elevated);
}

#catalog-search-input {
    padding: 14px 20px 14px 48px;
}

.search-shortcut {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: inherit;
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 16px;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: rotate(20deg);
}

/* ============ Hero Section ============ */
.hero-section {
    position: relative;
    height: 480px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 45px;
    display: flex;
    align-items: flex-end;
    padding: 45px;
    box-shadow: var(--shadow-lg);
}

.hero-bg-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    animation: kenBurns 40s ease-in-out infinite;
}

@keyframes kenBurns {
    0% {
        transform: scale(1.06) translate(0, 0);
    }
    25% {
        transform: scale(1.12) translate(-1%, 0.5%);
    }
    50% {
        transform: scale(1.06) translate(-0.5%, -0.5%);
    }
    75% {
        transform: scale(1.12) translate(0.5%, -1%);
    }
    100% {
        transform: scale(1.06) translate(0, 0);
    }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(6, 8, 15, 0.1) 0%,
        rgba(6, 8, 15, 0.5) 40%,
        rgba(6, 8, 15, 0.95) 100%
    );
    z-index: 1;
}

.hero-particles {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(circle at 20% 80%, var(--accent-glow) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, var(--secondary-glow) 0%, transparent 50%);
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 620px;
}

.hero-badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px var(--accent-glow);
    letter-spacing: 0.5px;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 46px;
    font-weight: 900;
    margin-bottom: 12px;
    line-height: 1.05;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
    color: #fff;
}

.hero-description {
    color: #cbd5e1;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 20px var(--accent-glow); }
    50% { box-shadow: 0 4px 35px var(--accent-glow), 0 0 60px var(--accent-glow); }
}

.btn-glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-favorite {
    width: 100%;
    justify-content: center;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 14px 20px;
    font-size: 15px;
}

.btn-favorite:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-link:hover {
    color: var(--accent-light);
    gap: 10px;
}

.btn-load-more {
    padding: 16px 40px;
    font-size: 15px;
    border-radius: var(--radius-lg);
}

.filter-reset-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    align-self: flex-end;
}

.filter-reset-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ============ Anime Row (Horizontal Scroll) ============ */
.anime-row-section {
    margin-bottom: 45px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--accent);
    font-size: 18px;
}

.results-count {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.anime-row {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 15px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.anime-row::-webkit-scrollbar {
    height: 6px;
}

.anime-row::-webkit-scrollbar-thumb {
    background: var(--accent-dark);
    border-radius: 10px;
}

.anime-row .anime-card {
    min-width: 180px;
    max-width: 180px;
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* ============ Genres Cloud ============ */
.genres-section {
    margin-bottom: 45px;
}

.genres-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.genre-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.genre-chip:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* ============ Filters Section ============ */
.filters-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 35px;
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 160px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group label i {
    color: var(--accent);
    font-size: 12px;
}

.filter-group select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.filter-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ============ Anime Grid ============ */
.anime-section {
    margin-bottom: 40px;
}

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 22px;
    min-height: 200px;
    position: relative;
}

/* Loader */
.loader {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 35px;
}

/* ============ Anime Card ============ */
.anime-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: 300px 450px;
}

.anime-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--border-hover);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3), 0 0 20px var(--accent-glow);
}

.card-poster-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.card-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.anime-card:hover .card-poster {
    transform: scale(1.1);
}

/* Gradient overlay on card poster */
.card-poster-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    pointer-events: none;
}

.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(6, 8, 15, 0.8);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.card-rating {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--gold), #d97706);
    color: #000;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 10px var(--gold-glow);
    z-index: 2;
}

.card-info {
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 35px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Inline favorite button on card */
.fav-btn-inline {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.fav-btn-inline:hover {
    color: #ef4444;
    transform: scale(1.2);
}

.fav-btn-inline.active {
    color: #ef4444;
}

/* ============ Empty / Error States ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    gap: 16px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    opacity: 0.4;
}

.empty-state h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 300px;
}

.no-results-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.error-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #ef4444;
}

/* ============ Detail Page ============ */
.detail-page {
    animation: fadeInView 0.5s ease;
    max-width: 100%;
    overflow: hidden;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    transition: all var(--transition);
}

.back-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateX(-4px);
}

.detail-hero {
    position: relative;
    height: 300px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: -80px;
}

.detail-hero-bg {
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    background-size: cover;
    background-position: center;
    filter: blur(5px) brightness(0.7);
    transition: opacity 1.8s ease-in-out, transform 8s ease-in-out;
    opacity: 0;
}

.detail-hero-bg.active {
    opacity: 1;
    transform: scale(1.04);
}

.detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(6, 8, 15, 0.3) 0%,
        rgba(6, 8, 15, 0.7) 60%,
        var(--bg-primary) 100%
    );
}

[data-theme="light"] .detail-hero-overlay {
    background: linear-gradient(
        180deg,
        rgba(248, 250, 252, 0.3) 0%,
        rgba(248, 250, 252, 0.7) 60%,
        var(--bg-primary) 100%
    );
}

.detail-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    position: relative;
    z-index: 2;
    padding: 0 10px;
    max-width: 100%;
    overflow: hidden;
}

.detail-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-poster {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    aspect-ratio: 2/3;
    object-fit: cover;
    border: 3px solid var(--border);
    transition: transform var(--transition);
}

.detail-poster:hover {
    transform: scale(1.02);
}

.detail-right {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding-top: 20px;
    min-width: 0;
    overflow: hidden;
}

.detail-header-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 900;
    line-height: 1.1;
    overflow-wrap: break-word;
    word-break: break-word;
}

.detail-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 500;
    overflow-wrap: break-word;
    word-break: break-word;
}

.detail-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.rating-badge {
    background: linear-gradient(135deg, var(--gold), #d97706);
    color: #000;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 12px var(--gold-glow);
}

.type-badge {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid rgba(168, 85, 247, 0.2);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.year-badge {
    background: rgba(6, 182, 212, 0.1);
    color: var(--secondary-accent);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

/* Detail Meta Grid */
.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.meta-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--transition);
}

.meta-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.meta-card > i {
    font-size: 18px;
    color: var(--accent);
    width: 24px;
    text-align: center;
}

.meta-card > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.meta-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Genres in detail */
.detail-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.genre-tag {
    background: var(--accent-subtle);
    color: var(--accent-light);
    border: 1px solid rgba(168, 85, 247, 0.15);
    padding: 7px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition);
    cursor: pointer;
}

.genre-tag:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: scale(1.05);
}

/* Description */
.watch-section,
.screenshots-section,
.similar-section {
    margin-top: 45px;
    margin-bottom: 25px;
}

.detail-description-wrapper h3,
.watch-section h3,
.similar-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.detail-description-wrapper h3 i,
.watch-section h3 i,
.similar-section h3 i {
    color: var(--accent);
    font-size: 16px;
}

.detail-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-line;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ============ Watch/Player Container ============ */
.player-container {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    max-width: 960px;
    width: 100%;
}

.player-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    transition: all var(--transition);
}

.player-placeholder:hover {
    color: var(--accent);
}

.player-placeholder i {
    font-size: 72px;
    filter: drop-shadow(0 4px 20px var(--accent-glow));
    transition: transform var(--transition);
}

.player-placeholder:hover i {
    transform: scale(1.1);
}

.player-placeholder span {
    font-weight: 600;
    font-size: 14px;
}

.video-player {
    width: 100%;
    height: 100%;
}

/* ============ Similar Section ============ */
.similar-section {
    overflow: hidden;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    overflow: hidden;
}

.similar-grid .anime-card {
    border-radius: var(--radius-md);
}

/* ============ Scroll to Top Button ============ */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition);
    box-shadow: 0 4px 20px var(--accent-glow);
    pointer-events: none;
}

.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-top-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 30px var(--accent-glow);
}

/* ============ Animations ============ */
@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.anime-card {
    animation: cardAppear 0.5s ease forwards;
    opacity: 0;
}

/* Stagger animation for cards */
.anime-card:nth-child(1) { animation-delay: 0.02s; }
.anime-card:nth-child(2) { animation-delay: 0.04s; }
.anime-card:nth-child(3) { animation-delay: 0.06s; }
.anime-card:nth-child(4) { animation-delay: 0.08s; }
.anime-card:nth-child(5) { animation-delay: 0.10s; }
.anime-card:nth-child(6) { animation-delay: 0.12s; }
.anime-card:nth-child(7) { animation-delay: 0.14s; }
.anime-card:nth-child(8) { animation-delay: 0.16s; }
.anime-card:nth-child(9) { animation-delay: 0.18s; }
.anime-card:nth-child(10) { animation-delay: 0.20s; }
.anime-card:nth-child(11) { animation-delay: 0.22s; }
.anime-card:nth-child(12) { animation-delay: 0.24s; }
.anime-card:nth-child(n+13) { animation-delay: 0.26s; }

/* ============ User Rating System ============ */
.user-rating-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    width: fit-content;
}

[data-theme="light"] .user-rating-section {
    background: rgba(0, 0, 0, 0.02);
}

.user-rating-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-stars {
    display: flex;
    gap: 6px;
}

.user-stars i {
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}

.user-stars i:hover {
    transform: scale(1.2);
}

.user-stars i.active {
    color: var(--gold);
    filter: drop-shadow(0 0 4px var(--gold-glow));
}

.user-rating-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 80px;
}

@media (max-width: 480px) {
    .user-rating-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
}

/* ============ Screenshots Gallery Carousel ============ */
.screenshots-section {
    margin-top: 32px;
    margin-bottom: 20px;
    overflow: hidden;
}

.screenshots-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.screenshots-section h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.carousel-controls {
    display: flex !important;
    gap: 8px !important;
    z-index: 100;
}

.carousel-controls .control-btn {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

.carousel-controls .control-btn i {
    font-size: 15px !important;
    color: var(--text-primary) !important;
}

.carousel-controls .control-btn:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    transform: scale(1.08) !important;
}

.carousel-controls .control-btn:hover i {
    color: #fff !important;
}

.screenshots-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 4px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
    margin-right: -4px;
}

.screenshots-carousel::-webkit-scrollbar {
    height: 6px;
}

.screenshots-carousel::-webkit-scrollbar-track {
    background: transparent;
}

.screenshots-carousel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

.screenshots-carousel:hover::-webkit-scrollbar-thumb {
    background: var(--accent);
}

.screenshot-item {
    flex: 0 0 280px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.screenshot-item:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

.screenshot-item:hover img {
    transform: scale(1.05);
}

/* ============ Lightbox Modal ============ */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(6, 8, 15, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.lightbox-content {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    animation: zoomIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    color: var(--text-muted);
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    user-select: none;
}

.lightbox-close:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

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

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============ Lightbox Arrow Navigation ============ */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
    z-index: 10001;
    opacity: 0.7;
}

.lightbox-arrow:hover {
    opacity: 1;
    background: rgba(168, 85, 247, 0.5);
    border-color: var(--accent);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 20px var(--accent-glow);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

@media (max-width: 768px) {
    .screenshots-carousel {
        gap: 10px;
    }
    .screenshot-item {
        flex: 0 0 220px;
    }
    .lightbox-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .lightbox-prev {
        left: 10px;
    }
    .lightbox-next {
        right: 10px;
    }
    .lightbox-content {
        max-width: 95%;
        max-height: 80%;
    }
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .main-content {
        padding: 30px 24px 60px;
    }

    .detail-content {
        grid-template-columns: 220px 1fr;
        gap: 28px;
    }

    .hero-title {
        font-size: 36px;
    }

    .detail-title {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 55;
        width: var(--sidebar-width);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 16px 60px;
    }

    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    .main-header .header-actions {
        display: none;
    }

    .hero-section {
        height: auto;
        min-height: 300px;
        padding: 30px 20px 24px;
        flex-direction: column;
        justify-content: flex-end;
        align-items: stretch;
        border-radius: var(--radius-lg);
        margin-bottom: 30px;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-title {
        font-size: 28px;
        margin-bottom: 8px;
    }

    .hero-description {
        font-size: 13px;
        -webkit-line-clamp: 3;
        margin-bottom: 20px;
    }

    .hero-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 10px;
        font-size: 13px;
    }

    .anime-row-section {
        margin-bottom: 30px;
    }

    .section-header {
        align-items: center;
        gap: 10px;
        margin-bottom: 14px;
    }

    .section-title {
        font-size: 18px;
    }

    .anime-row {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
        gap: 14px;
    }

    .anime-row .anime-card {
        min-width: 140px;
        max-width: 140px;
    }

    .genre-chip {
        padding: 8px 16px;
        font-size: 12px;
    }

    .detail-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-left {
        display: grid;
        grid-template-columns: 160px 1fr;
        gap: 16px;
        align-items: start;
    }

    .detail-right {
        padding-top: 0;
    }

    .detail-hero {
        height: 200px;
        margin-bottom: -40px;
    }

    .detail-title {
        font-size: 24px;
    }

    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 14px;
    }

    .filters-section {
        padding: 16px;
        gap: 12px;
    }

    .filter-group {
        min-width: 120px;
    }

    .filter-reset-btn {
        width: 100%;
        justify-content: center;
        align-self: auto;
        margin-top: 4px;
    }

    .search-shortcut {
        display: none;
    }

    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .player-container {
        border-radius: var(--radius-md);
    }

    .detail-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .similar-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .genres-cloud {
        gap: 8px;
    }

    .empty-state i {
        font-size: 48px;
    }

    .empty-state h3 {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .detail-left {
        grid-template-columns: 1fr;
    }

    .detail-poster {
        max-width: 200px;
        margin: 0 auto;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-description {
        display: none; /* Hide description on very small screens for compact layout */
    }

    .hero-section {
        min-height: 220px;
        padding: 20px 16px;
    }

    .screenshot-item {
        flex: 0 0 200px;
    }

    .main-content {
        padding: 70px 12px 40px;
    }

    .detail-hero {
        height: 160px;
        margin-bottom: -30px;
    }

    .detail-right {
        gap: 20px;
    }

    .detail-meta-grid {
        grid-template-columns: 1fr;
    }

    .detail-title {
        font-size: 20px;
    }

    .detail-subtitle {
        font-size: 14px;
    }

    .detail-badges {
        gap: 6px;
    }

    .rating-badge,
    .type-badge,
    .year-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .back-btn {
        padding: 8px 14px;
        font-size: 13px;
        margin-bottom: 16px;
    }

    .lightbox-arrow {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .lightbox-prev {
        left: 6px;
    }

    .lightbox-next {
        right: 6px;
    }

    .filters-section {
        padding: 10px;
        gap: 8px;
    }

    .filter-group {
        min-width: 100%;
    }

    .hero-buttons {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    .anime-row .anime-card {
        min-width: 120px;
        max-width: 120px;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .anime-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .main-content {
        padding: 66px 8px 30px;
    }

    .hero-section {
        min-height: 180px;
        padding: 16px 12px;
        margin-bottom: 20px;
    }

    .hero-title {
        font-size: 20px;
    }

    .section-title {
        font-size: 16px;
    }

    .mobile-topbar {
        height: 54px;
        padding: 0 12px;
    }

    .screenshot-item {
        flex: 0 0 170px;
    }
}
