/* ===========================================================================
   NexusReader CMS - Dark Premium Theme
   =========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Colors */
    --bg-primary: #09090b;
    --bg-secondary: #111113;
    --bg-card: #16161a;
    --bg-card-hover: #1c1c21;
    --bg-elevated: #1e1e24;
    --bg-input: #1a1a1f;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --border-color: #2a2a30;
    --border-subtle: #222228;

    --text-primary: #f0f0f3;
    --text-secondary: #a0a0ab;
    --text-muted: #6b6b76;
    --text-inverse: #09090b;

    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-glow: rgba(139, 92, 246, 0.25);
    --primary-subtle: rgba(139, 92, 246, 0.1);
    --accent: #22d3ee;
    --accent-hover: #06b6d4;
    --accent-glow: rgba(34, 211, 238, 0.2);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --container-width: 1280px;
    --container-padding: 20px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 30px var(--primary-glow);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* --- Glassmorphism Utilities --- */
.glass {
    background: rgba(22, 22, 26, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
}

.glass-strong {
    background: rgba(22, 22, 26, 0.92);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-color);
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 var(--container-padding);
    height: 72px;
    background: #000;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: all var(--transition);
}

.navbar-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.navbar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.navbar-brand .brand-accent {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Bar */
.navbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.navbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition);
}

.navbar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-elevated);
}

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

.navbar-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-results-dropdown.active { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background var(--transition);
    color: var(--text-primary);
}

.search-result-item:hover { background: var(--bg-card-hover); }

.search-result-item img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.search-result-item .result-info { flex: 1; min-width: 0; }
.search-result-item .result-title { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-item .result-type { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Nav Links */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.navbar-nav a, .navbar-nav button {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    white-space: nowrap;
}

.navbar-nav a:hover, .navbar-nav button:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.navbar-nav .nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 2px 10px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--primary-glow);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--text-inverse);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
}

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

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

.card-body { padding: 16px; }

/* --- Series Grid --- */
.series-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.series-card {
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    transition: all var(--transition);
    cursor: pointer;
    overflow: hidden;
}

.series-card > div.card-info { padding: 12px 12px 8px 12px !important; }
.series-card > a { display: block; }
.series-card > div.card-meta-tax { padding: 10px 12px; }

.series-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.series-card .cover-wrapper {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    width: 100%;
}

.series-card .cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.series-card:hover .cover-wrapper img {
    transform: scale(1.05);
}

.series-card .badge-type {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--primary);
    color: #fff;
    z-index: 2;
}

.series-card .card-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--text-primary);
    margin: 0;
}

.series-card .card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.series-card .card-meta svg { width: 12px; height: 12px; flex-shrink: 0; }

.series-card .card-meta-tax {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.75rem;
}

.tax-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.tax-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.tax-link {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    transition: all var(--transition);
}

.tax-value {
    font-size: 0.9rem;
}

.tax-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.tax-type { color: var(--accent); border-color: rgba(34, 211, 238, 0.2); }
.tax-parody { color: var(--success); border-color: rgba(16, 185, 129, 0.2); }
.tax-char { color: var(--primary); border-color: rgba(139, 92, 246, 0.2); }

/* --- Hero Section --- */
.hero {
    position: relative;
    padding: 120px 0 60px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, var(--primary-glow), transparent 50%),
                radial-gradient(ellipse at 80% 20%, var(--accent-glow), transparent 40%),
                linear-gradient(to bottom, transparent 60%, var(--bg-primary));
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 30px;
}

/* --- Section Headers --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.section-title .accent {
    color: var(--primary);
}

/* --- Chapter List --- */
.chapter-list { display: flex; flex-direction: column; gap: 2px; }

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    transition: all var(--transition);
    color: var(--text-primary);
    gap: 12px;
}

.chapter-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.chapter-item .chapter-number { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.chapter-item .chapter-title { flex: 1; font-size: 0.875rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-item .chapter-date { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* --- Tags / Genres --- */
.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-subtle);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    transition: all var(--transition);
}

.tag:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tags-wrapper { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Stats --- */
.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-item svg { width: 16px; height: 16px; }
.stat-item .stat-value { font-weight: 700; color: var(--text-primary); }

/* --- Forms --- */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b76' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* --- Pagination --- */
.pagination { margin: 40px 0; display: flex; justify-content: center; }
.pagination ul { display: flex; align-items: center; gap: 4px; }

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition);
}

.page-link:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 10px var(--primary-glow);
}

.page-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

/* --- Flash Messages --- */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--success); }
.alert-error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: var(--warning); }
.alert-info { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); color: var(--info); }

/* --- Footer --- */
.footer {
    margin-top: 80px;
    padding: 40px 0;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text-primary); }

/* --- Animations --- */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.fade-in { animation: fadeIn 0.5s ease; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 992px) {
    .series-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 16px;
    }

    .navbar-search { display: none; }
    .search-toggle { display: block !important; margin-right: 15px; }
    .navbar-nav { display: none; }
    .menu-toggle { display: block; }
    
    .navbar.mobile-search-active .navbar-search {
        display: block;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        padding: 12px var(--container-padding);
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border-subtle);
        max-width: none;
        box-shadow: var(--shadow-lg);
    }

    .navbar.mobile-search-active .search-icon {
        left: calc(var(--container-padding) + 14px);
    }

    .navbar.mobile-search-active input {
        border-radius: 5px;
    }

    .navbar.mobile-search-active .search-results-dropdown {
        border-radius: 5px;
        left: var(--container-padding);
        right: var(--container-padding);
        width: auto;
    }

    .series-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .hero { padding: 100px 0 40px; }
    .hero-title { font-size: 1.8rem; }

    .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }

    .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .series-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .series-card .card-title { font-size: 1.05rem; }
    .tax-row { gap: 5px; }
    .tax-label { display: inline; font-size: 0.82rem; }
    .tax-link { padding: 3px 8px; font-size: 0.82rem; }
    .tax-value { font-size: 0.9rem; }
    .card-meta-tax { gap: 6px; }
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Selection --- */
::selection {
    background: var(--primary);
    color: #fff;
}

/* ===========================================================================
   Catalog Filters
   =========================================================================== */

/* --- Toggle Button Enhancement --- */
#catalogToggleFilters svg {
    transition: transform var(--transition);
}
#catalogToggleFilters:hover svg {
    transform: rotate(15deg);
}

/* --- Active Filters Bar --- */
.catalog-active-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
    animation: slideDown 0.3s ease;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.cf-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(34, 211, 238, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--primary);
    animation: fadeIn 0.2s ease;
    white-space: nowrap;
}

.cf-active-chip-label {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cf-active-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary);
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    flex-shrink: 0;
}

.cf-active-chip-remove:hover {
    background: var(--danger);
    color: #fff;
    transform: scale(1.15);
}

.active-filters-clear {
    flex-shrink: 0;
    color: var(--text-muted) !important;
}
.active-filters-clear:hover {
    color: var(--danger) !important;
}

/* --- Filter Panel --- */
.catalog-filters-panel {
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin 0.3s ease;
    margin-bottom: 0;
}

.catalog-filters-panel.open {
    max-height: 3000px;
    opacity: 1;
    margin-bottom: 20px;
}

.catalog-filters-loading {
    padding: 20px;
}

.catalog-filters-content {
    padding: 8px;
}

/* --- Section Accordion --- */
.cf-section {
    border-bottom: 1px solid var(--border-subtle);
}

.cf-section:last-child {
    border-bottom: none;
}

.cf-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    text-align: left;
}

.cf-section-header:hover {
    background: rgba(139, 92, 246, 0.05);
}

.cf-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--primary-subtle);
    color: var(--primary);
    flex-shrink: 0;
}

.cf-section-label {
    flex: 1;
}

.cf-section-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-card-hover);
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 28px;
    text-align: center;
}

.cf-section-chevron {
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.cf-section.open .cf-section-chevron {
    transform: rotate(180deg);
}

.cf-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cf-section.open .cf-section-body {
    overflow-y: auto;
}

/* --- Search Input inside taxonomy --- */
.cf-search-wrapper {
    position: relative;
    padding: 0 16px 10px;
    margin-top: 10px;
}

.cf-search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(calc(-50% - 5px));
    color: var(--text-muted);
    pointer-events: none;
}

.cf-search-input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition);
}

.cf-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

/* --- A-Z Navigation --- */
.cf-az-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 16px 10px;
    justify-content: center;
}

.cf-az-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.cf-az-letter:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.cf-az-letter.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.cf-az-letter.disabled,
.cf-az-letter:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

/* Wider buttons for 0-9 and TODO */
.cf-az-letter.cf-az-all {
    width: auto;
    padding: 0 10px;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

/* --- Terms List (Scrollable) --- */
.cf-terms-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 0 16px 14px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.cf-terms-list::-webkit-scrollbar { width: 4px; }
.cf-terms-list::-webkit-scrollbar-track { background: transparent; }
.cf-terms-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* --- Letter Group --- */
.cf-letter-group {
    margin-bottom: 10px;
}

.cf-letter-heading {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    padding: 4px 0 6px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    margin-bottom: 8px;
}

/* --- Chips Grid --- */
.cf-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    margin-top: 10px;
    margin-bottom: 10px;
}

.cf-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.cf-chip.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.cf-chip-count {
    font-size: 0.68rem;
    opacity: 0.6;
    font-weight: 700;
}

.cf-chip.active .cf-chip-count {
    opacity: 0.85;
}

/* --- Sort Bar --- */
.catalog-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.catalog-results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.catalog-results-count span {
    font-weight: 700;
    color: var(--primary);
}

.catalog-sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-sort-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.catalog-sort-select {
    width: auto !important;
    min-width: 160px;
    height: 36px;
    padding: 0 32px 0 12px !important;
    font-size: 0.82rem !important;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .cf-az-nav {
        gap: 2px;
    }

    .cf-az-letter {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }

    .cf-chips-grid {
        gap: 4px;
    }

    .cf-chip {
        padding: 4px 10px;
        font-size: 0.73rem;
    }

    .cf-search-input {
        height: 34px;
        font-size: 0.8rem;
    }

    .catalog-sort-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .catalog-sort-options {
        width: 100%;
    }

    .catalog-sort-select {
        flex: 1;
        min-width: 0 !important;
    }

    .cf-active-chip-label {
        max-width: 140px;
    }
}

@media (max-width: 480px) {
    .cf-az-letter {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }

    .cf-section-header {
        padding: 12px;
        font-size: 0.85rem;
    }

    .cf-terms-list {
        max-height: 260px;
    }
}

/* ===========================================================================
   2026 UX + Scale Refresh
   =========================================================================== */

:root {
    --bg-primary: #0b0c0f;
    --bg-secondary: #111318;
    --bg-card: #171a20;
    --bg-card-hover: #20242c;
    --bg-elevated: #1b1f27;
    --bg-input: #12151b;
    --border-color: #343a46;
    --border-subtle: #242a34;
    --text-primary: #f6f4ee;
    --text-secondary: #b8bec9;
    --text-muted: #7d8592;
    --primary: #f97316;
    --primary-hover: #ea580c;
    --primary-glow: rgba(249, 115, 22, 0.22);
    --primary-subtle: rgba(249, 115, 22, 0.1);
    --accent: #14b8a6;
    --accent-hover: #0f9488;
    --accent-glow: rgba(20, 184, 166, 0.18);
    --radius: 8px;
    --radius-lg: 8px;
    --radius-xl: 999px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.42);
    --shadow-glow: 0 18px 42px rgba(249, 115, 22, 0.16);
}

body {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), transparent 280px),
        var(--bg-primary);
}

.navbar {
    background: rgba(8, 9, 12, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.navbar-brand {
    letter-spacing: 0;
}

.navbar-brand .brand-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #08100f;
    font-weight: 900;
}

.glass,
.glass-strong {
    background: rgba(23, 26, 32, 0.86);
    border-color: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.btn,
.form-control,
.page-link,
.tag,
.tax-link,
.cf-chip,
.catalog-sort-bar,
.catalog-active-filters {
    border-radius: var(--radius);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #f59e0b);
    color: #160b02;
}

.btn-primary:hover {
    color: #160b02;
}

.hero {
    min-height: 320px;
    padding: 112px 0 54px;
}

.hero-bg::after {
    background:
        linear-gradient(135deg, rgba(249, 115, 22, 0.16), rgba(20, 184, 166, 0.08) 42%, transparent 72%),
        linear-gradient(to bottom, rgba(11, 12, 15, 0.12), var(--bg-primary));
}

.hero-title {
    letter-spacing: 0;
}

.hero-subtitle {
    color: var(--text-secondary);
}

.section-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.series-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

@media (max-width: 992px) {
    .series-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.series-card {
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}

.series-card:hover {
    border-color: rgba(249, 115, 22, 0.36);
}

.series-card .cover-wrapper {
    aspect-ratio: 1 / 1;
    background: var(--bg-secondary);
}

.series-card .card-title {
    font-size: 0.96rem;
    letter-spacing: 0;
}

.series-card .card-meta-tax {
    min-height: 126px;
}

.search-results-dropdown {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.search-result-item:focus-visible,
.btn:focus-visible,
.page-link:focus-visible,
.tag:focus-visible,
.tax-link:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.footer {
    background: #08090c;
}

@media (max-width: 768px) {
    .series-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        min-height: 260px;
        padding-top: 96px;
    }

    .navbar.mobile-search-active .navbar-search {
        background: rgba(17, 19, 24, 0.98);
    }

    .navbar-nav.mobile-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        padding: 12px var(--container-padding);
        background: rgba(17, 19, 24, 0.98);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        z-index: 999;
        gap: 4px;
    }

    .navbar-nav.mobile-open a,
    .navbar-nav.mobile-open button,
    .navbar-nav.mobile-open form {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 44px;
        padding: 0 12px;
        color: var(--text-secondary);
        font-size: 0.9rem;
        font-weight: 500;
        background: transparent;
        border: none;
        border-radius: var(--radius);
        transition: all var(--transition);
        box-sizing: border-box;
    }

    /* Reset button styling specifically in mobile open menu to match list item look */
    .navbar-nav.mobile-open .btn {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-secondary) !important;
        box-shadow: none !important;
        padding: 0 12px !important;
        height: 44px !important;
        width: 100% !important;
        font-size: 0.9rem !important;
        font-weight: 500 !important;
        transform: none !important;
        text-align: left !important;
    }

    .navbar-nav.mobile-open a:hover,
    .navbar-nav.mobile-open button:hover,
    .navbar-nav.mobile-open .btn:hover {
        background: rgba(255, 255, 255, 0.06) !important;
        color: var(--text-primary) !important;
    }

    /* Specifically style the custom dropdown element for language in mobile open menu */
    .navbar-nav.mobile-open .custom-dropdown {
        width: 100%;
    }

    .navbar-nav.mobile-open .custom-dropdown .dropdown-trigger {
        width: 100% !important;
        height: 44px !important;
        padding: 0 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-secondary) !important;
    }

    .navbar-nav.mobile-open .custom-dropdown .dropdown-trigger:hover,
    .navbar-nav.mobile-open .custom-dropdown.active .dropdown-trigger {
        background: rgba(255, 255, 255, 0.06) !important;
        color: var(--text-primary) !important;
    }

    .navbar-nav.mobile-open .custom-dropdown .dropdown-menu {
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(0, 0, 0, 0.25) !important;
        margin-top: 4px !important;
        padding: 4px 8px !important;
        max-height: 200px !important;
    }
}

/* --- Custom Language Dropdown (Desktop) --- */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.custom-dropdown .dropdown-trigger {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    transition: all var(--transition);
    white-space: nowrap;
}

.custom-dropdown .dropdown-trigger:hover,
.custom-dropdown.active .dropdown-trigger {
    color: var(--text-primary);
    background: var(--bg-card);
}

.custom-dropdown .dropdown-trigger .chevron-icon {
    transition: transform var(--transition);
    color: var(--text-muted);
}

.custom-dropdown.active .dropdown-trigger .chevron-icon {
    transform: rotate(180deg);
    color: var(--text-primary);
}

.custom-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0; /* Align to the right side of trigger on desktop */
    margin-top: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1002;
    min-width: 160px;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.custom-dropdown .dropdown-menu::-webkit-scrollbar {
    width: 4px;
}
.custom-dropdown .dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}
.custom-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.custom-dropdown.active .dropdown-menu {
    display: block;
}

.custom-dropdown .dropdown-item {
    width: 100% !important;
    padding: 8px 12px !important;
    background: transparent !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-secondary) !important;
    text-align: left !important;
    cursor: pointer !important;
    font-family: var(--font-family) !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    transition: all var(--transition) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: none !important;
    height: auto !important;
    margin: 0 !important;
}

.custom-dropdown .dropdown-item:hover {
    background: var(--bg-card-hover) !important;
    color: var(--text-primary) !important;
}

.custom-dropdown .dropdown-item.active {
    background: var(--primary-subtle) !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
}

@media (max-width: 480px) {
    .series-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
