/* Base & CSS Variables */
:root {
    --bg-main: #060608;
    --bg-panel: rgba(255, 255, 255, 0.02);
    --bg-surface: #111115;
    
    --border-color: rgba(255, 255, 255, 0.05);
    
    --primary: #f21b54;
    --primary-hover: #fa3c6f;
    --primary-dim: rgba(242, 27, 84, 0.15);
    
    --text-pure: #ffffff;
    --text-muted: #8a8a93;
    --text-dim: #5c5c63;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-pure);
    font-family: var(--font-family);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
}

html {
    overflow-x: hidden;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* Utilities */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-pure);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-dim);
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(6, 6, 8, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px; /* slightly wider than content container */
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.logo-manga {
    color: var(--text-pure);
}

.logo-theme {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-pure);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.search-box {
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.5rem 1rem;
    width: 240px;
    gap: 0.5rem;
    transition: width 0.3s ease, border-color 0.3s ease;
}

.search-box:focus-within {
    border-color: rgba(255,255,255,0.2);
    width: 280px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-pure);
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-dim);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 320px;
    background: rgba(9, 9, 11, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    z-index: 1000;
}

.search-dropdown.hidden {
    display: none;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
}

.search-item-img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
}

.search-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-item-title {
    color: #fafafa;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.search-item-status {
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.search-item-view-all {
    display: block;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    background: rgba(242, 27, 84, 0.05);
    text-decoration: none;
    transition: background 0.2s;
}

.search-item-view-all:hover {
    background: rgba(242, 27, 84, 0.1);
}

.search-empty {
    padding: 1rem;
    text-align: center;
    color: #a1a1aa;
    font-size: 0.9rem;
}

.notification-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.notification-btn:hover {
    background: var(--bg-panel);
    color: var(--text-pure);
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
}

/* Main Layout */
.container {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* Hero & Trending Grid */
.hero-trending-grid {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* Hero Section */
.hero-section {
    position: relative;
}

/* The magic purple glow behind the hero */
.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(130, 40, 255, 0.35) 0%, rgba(242, 27, 84, 0.2) 50%, rgba(0,0,0,0) 70%);
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
}

.hero-banner {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    height: 420px;
    display: flex;
    align-items: flex-end;
    padding: 3rem;
    z-index: 1;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    /* subtle internal border */
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.hero-banner img.lazy-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    display: block;
}

.hero-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(10,10,12,0.95) 0%, rgba(10,10,12,0.6) 40%, transparent 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 60%;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.badge-featured {
    background: var(--primary-dim);
    color: var(--primary);
    border: 1px solid rgba(242, 27, 84, 0.3);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-desc {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carousel-arrow {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Trending Sidebar */
.trending-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.trending-title {
    gap: 0.5rem;
}

.fire-icon {
    font-size: 1.2rem;
    /* optional: add drop shadow for glow */
    filter: drop-shadow(0 0 8px rgba(255, 100, 0, 0.6));
}

.trending-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.trending-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.rank {
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    width: 24px;
    text-align: center;
}

.trending-thumb {
    width: 50px;
    height: 70px;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.trending-thumb img.lazy-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.trending-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.trending-manga-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.views {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Latest Updates */
.lined-title {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    border-radius: 2px;
}

.manga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.manga-card {
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    transition: transform 0.2s ease;
}

.manga-card:hover .manga-cover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

.manga-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 2.9;
    border-radius: 12px;
    transition: all 0.3s ease;
    /* Soft border around image */
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}
.manga-cover img.lazy-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Badges on Covers */
.manga-cover .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    margin: 0; /* Override generic margin */
}

.badge-hot {
    background: #e60000;
    color: white;
}

.badge-completed {
    background: #800000;
    color: white;
}

.manga-title {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.chapter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.chapter-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.chap-name {
    color: #dedede;
    font-weight: 500;
}

.chap-action {
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand .logo {
    margin-bottom: 0.5rem;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--text-pure);
}

/* Details Page General Layout */
.details-bg-blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 520px;
    background-size: cover;
    background-position: center;
    z-index: -1;
}
.details-bg-blur::after {
    content: '';
    position: absolute;
    inset: 0;
    backdrop-filter: blur(50px);
    background: linear-gradient(to bottom, rgba(6, 6, 8, 0.45) 0%, rgba(6, 6, 8, 0.95) 75%, var(--bg-main) 100%);
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}
.breadcrumb a:hover {
    color: var(--text-pure);
}
.breadcrumb .current {
    color: var(--text-pure);
}

.details-layout-grid {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

/* Manga Header */
.manga-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 3.5rem;
}

.manga-poster-col {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.manga-poster {
    width: 100%;
    aspect-ratio: 2/2.9;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}
.manga-poster img.lazy-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.btn-block {
    width: 100%;
}
.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-pure);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.08);
}
.poster-actions {
    display: flex;
    gap: 0.75rem;
}

/* Manga Info Col */
.manga-info-col {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.manga-title-main {
    font-size: 2.75rem;
    font-weight: 900;
    line-height: 1.1;
}
.manga-alt-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}
.manga-author {
    color: var(--text-muted);
    font-size: 0.95rem;
}
.manga-author span {
    color: var(--primary);
    font-weight: 700;
}
.manga-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.star {
    color: var(--primary);
    font-size: 1.1rem;
}
.stat-badge {
    background: rgba(255,255,255,0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    color: var(--text-pure);
}
.manga-genres {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}
.genre-pill {
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-pure);
    border: 1px solid var(--border-color);
}
.genre-pill:hover {
    background: rgba(255,255,255,0.1);
}

.manga-synopsis-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    margin-top: 0.5rem;
}
.manga-synopsis-box h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.synopsis-content {
    position: relative;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.6;
    max-height: 80px;
    overflow: hidden;
}
.fade-out {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-surface));
}
.show-more-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Sections General Details */
.details-section {
    margin-bottom: 3.5rem;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.chapter-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.filter-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-pure);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
}
.filter-btn.active {
    background: var(--primary-dim);
    color: var(--primary);
    border-color: rgba(242, 27, 84, 0.3);
}
.chapter-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}
.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.chapter-item-large {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.1rem 1.25rem;
    border-radius: 12px;
}
.chapter-item-large:hover {
    background: rgba(255,255,255,0.05);
}
.chap-info-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.chap-title {
    font-weight: 700;
    font-size: 0.95rem;
}
.chap-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.chap-info-right {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-load-more {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
}

/* Comments Specifics */
.comment-count {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 0.95rem;
    margin-left: 0.25rem;
}
.sort-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}
.comment-input-area {
    display: flex;
    gap: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.user-avatar.small {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
}
.input-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.input-wrapper textarea {
    background: transparent;
    border: none;
    color: var(--text-pure);
    font-family: var(--font-family);
    resize: none;
    outline: none;
    min-height: 50px;
    font-size: 0.95rem;
}
.input-wrapper textarea::placeholder {
    color: var(--text-dim);
}
.input-actions {
    display: flex;
    justify-content: flex-end;
}
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.comment-item {
    display: flex;
    gap: 1rem;
}
.comment-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.comment-header-row {
    display: flex;
    align-items: center;
    padding-bottom: 0.25rem;
}
.username {
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: 0.75rem;
}
.time {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.comment-text {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
}
.comment-actions {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.comment-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.comment-actions button:hover {
    color: var(--text-pure);
}

/* --- Reader Page Styles Cleaned --- */

/* Custom Shadcn UI Select Replacement */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    font-family: var(--font-family);
}
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fafafa;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 140px;
    transition: background 0.2s, border-color 0.2s;
}
.custom-select-trigger:hover {
    background: rgba(255,255,255,0.05);
}
.custom-select-trigger.open {
    border-color: rgba(255,255,255,0.3);
}
.custom-select-trigger svg {
    transition: transform 0.2s ease;
    width: 16px;
    height: 16px;
    opacity: 0.7;
}
.custom-select-trigger.open svg {
    transform: rotate(180deg);
}
.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 100%;
    min-width: 200px;
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.25rem;
}
.custom-select-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.custom-select-option {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #a1a1aa;
    transition: background 0.2s, color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.custom-select-option:hover {
    background: rgba(255,255,255,0.08);
    color: #fafafa;
}
.custom-select-option.selected {
    background: rgba(255,255,255,0.05);
    color: #fafafa;
    font-weight: 600;
}
.custom-select-option.selected::after {
    content: "✓";
    font-size: 0.8rem;
    color: var(--primary);
}

.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}
.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* Shadcn Select Deprecated */

/* Manga Rendering Stack */
.reader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 65px; /* Offset for topbar */
    padding-bottom: 40px; 
    width: 100%;
    min-height: 100vh;
}
.reader-breadcrumb {
    color: #a1a1aa;
    font-size: 0.85rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
    text-align: center;
    width: 100%;
}
.reader-breadcrumb .sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}
.reader-image-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 720px;
    background-color: #09090b;
}

/* In-page Chapter Nav Strip */
.chapter-nav-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem;
    background-color: #18181b; /* zinc-900 */
}
.shadcn-btn-nav {
    background: rgba(255, 255, 255, 0.05);
    color: #fafafa;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.shadcn-btn-nav:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
}
.red-menu-btn {
    background-color: #dc2626; /* red-600 */
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.red-menu-btn:hover { background-color: #b91c1c; }

/* Crucial fix to remove gaps */
.manga-page {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
}
.reader-empty-state {
    margin-top: 5rem;
    color: #a1a1aa;
    font-size: 0.9rem;
}

/* Comments Section */
.show-comments-wrapper {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    width: 100%;
}
.pill-btn-red {
    background-color: #dc2626;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.85rem 2.5rem;
    border-radius: 9999px; /* Pill */
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}
.pill-btn-red:hover { background-color: #b91c1c; transform: translateY(-1px); }

.reader-comments-section {
    width: 100%;
    background-color: #18181b; /* zinc-900 */
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 4rem;
}
.comments-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.comments-total {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}
.red-bar {
    width: 4px;
    height: 20px;
    background-color: #dc2626;
    margin-right: 0.75rem;
    border-radius: 2px;
}
.sort-by-btn {
    background: transparent;
    border: none;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}


/* --- Manga List Additions --- */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}
.genre-pill-grid {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-pure);
    text-align: center;
    transition: all 0.2s ease;
    font-weight: 500;
}
.genre-pill-grid:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

/* Responsive */
.mobile-menu-btn,
.mobile-search-btn {
    display: none;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-pure);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.mobile-menu-btn:hover,
.mobile-search-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.mobile-menu-btn svg,
.mobile-search-btn svg {
    display: block;
    pointer-events: none;
}

@media (max-width: 1024px) {
    .hero-trending-grid,
    .details-layout-grid {
        grid-template-columns: 1fr;
    }
    
    .genre-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 768px) {
    .navbar {
        background: rgba(6, 6, 8, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        /* Do NOT add position:relative here — it overrides position:sticky */
    }

    .nav-container {
        padding: 1.25rem 1.5rem;
    }

    .nav-links {
        display: none;
    }

    .search-box {
        display: none;
    }

    .search-box.mobile-active {
        display: flex;
        /* fixed positions relative to viewport, not a (broken) containing block */
        position: fixed;
        top: 72px; /* matches navbar height on mobile (40px padding + ~32px content) */
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding: 1rem 1.5rem;
        background: rgba(10, 10, 14, 0.98);
        backdrop-filter: blur(16px);
        z-index: 199;
        box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    }

    .search-box.mobile-active input {
        font-size: 1rem;
    }

    .search-box.mobile-active:focus-within {
        width: 100%;
    }

    .search-box.mobile-active .search-dropdown {
        width: calc(100% - 3rem);
        left: 1.5rem;
        top: calc(100% + 0.5rem);
    }
    
    .mobile-menu-btn,
    .mobile-search-btn {
        display: flex;
    }

    .nav-actions {
        gap: 0.75rem;
    }

    .hero-banner {
        height: 320px;
        padding: 2rem;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    .hero-desc {
        font-size: 0.95rem;
        -webkit-line-clamp: 3;
    }

    .carousel-arrow {
        display: none;
    }
    
    .manga-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .manga-title {
        font-size: 0.9rem;
    }
    
    .footer-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .manga-header {
        flex-direction: column;
        align-items: center;
    }
    
    .manga-poster-col {
        width: 100%;
        max-width: 300px;
    }
    
    .manga-title-main {
        font-size: 2.25rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    /* Layout specific Reader overrides for tablet/mobile */
    .reader-topbar {
        padding: 0.75rem 1rem;
    }
    .back-text {
        display: none;
    }
    .reader-center-info .chapter-title {
        display: none;
    }
    .reader-center-info .chapter-number {
        font-size: 1.1rem;
    }
    .chapter-select {
        font-size: 0.8rem;
    }
    .chapter-select-wrapper {
        padding: 0.4rem 0.8rem;
    }
    .reader-bottombar {
        padding: 1rem;
        gap: 0.5rem;
        justify-content: space-between;
    }
    .btn-reader-nav {
        padding: 0.5rem 0.75rem;
    }
    .btn-reader-nav .nav-text {
        display: none; /* Only show chevrons on very narrow mobile */
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .nav-container {
        padding: 1rem;
    }
    
    .btn-primary {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .hero-banner {
        height: 280px;
        padding: 1.5rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .chapter-row {
        padding: 0.4rem;
    }
    
    .chap-name {
        font-size: 0.75rem;
    }
    
    .chap-action {
        font-size: 0.65rem;
    }
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-menu {
    position: absolute;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--bg-surface);
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-nav-overlay.active .mobile-nav-menu {
    right: 0;
}

.mobile-nav-header {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.close-mobile-btn {
    background: none;
    border: none;
    color: var(--text-pure);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-links {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-nav-links a {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    color: var(--primary);
}

/* Modern Hero Carousel Styles */
.hero-banner {
    position: relative;
    height: 500px;
    background-size: cover;
    background-position: center 20%;
    display: flex;
    align-items: flex-end;
    padding: 3rem 4rem;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6, 6, 8, 1) 0%, rgba(6, 6, 8, 0.7) 40%, rgba(6, 6, 8, 0) 100%);
    z-index: 1;
}

.hero-content-modern {
    position: relative;
    z-index: 2;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.hero-title-modern {
    color: var(--text-pure);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
    margin: 0;
}

.hero-desc-modern {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 0.5rem;
}

.modern-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    opacity: 0;
}

.hero-section:hover .modern-carousel-arrow {
    opacity: 1;
}

.modern-carousel-arrow:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.modern-carousel-arrow.left-arrow { left: 2rem; }
.modern-carousel-arrow.right-arrow { right: 2rem; }

.modern-carousel-dots {
    position: absolute;
    bottom: 2rem;
    right: 3rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.modern-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.modern-carousel-dot.active {
    width: 24px;
    border-radius: 4px;
    background: var(--primary);
}

@media (max-width: 768px) {
    .hero-banner {
        height: 350px;
        padding: 1.5rem;
        align-items: flex-end;
    }
    .hero-content-modern {
        text-align: center;
        align-items: center;
        width: 100%;
        margin-bottom: 2rem;
    }
    .hero-title-modern {
        font-size: 1.75rem;
    }
    .hero-desc-modern {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
    .modern-carousel-dots {
        right: 50%;
        transform: translateX(50%);
        bottom: 1rem;
    }
    .modern-carousel-arrow {
        display: none;
    }
    .hero-tags {
        justify-content: center;
    }
}
/* Robust container & grid fixes */
.container {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.main-content-area {
    min-width: 0;
    max-width: 100%;
}

.hero-section {
    min-width: 0;
    max-width: 100%;
}

.slide-item {
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.manga-card {
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.manga-title {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

@media (max-width: 768px) {
    /* Mobile Manga Card Redesign */
    .manga-title {
        font-size: 0.85rem !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .manga-cover {
        border-radius: 8px !important;
    }

    .manga-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 1.25rem 0.75rem !important;
    }

    .hero-banner {
        padding: 1.5rem 1rem !important;
    }

    .hero-title-modern {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
    }

    .hero-desc-modern {
        font-size: 0.8rem !important;
        -webkit-line-clamp: 2 !important;
        margin-bottom: 1rem !important;
    }

    .hero-content-modern {
        gap: 0.5rem !important;
    }

    .hero-action .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }

    .hero-action svg {
        width: 14px !important;
        height: 14px !important;
    }

    .badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .manga-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1rem 0.5rem !important;
    }
}

/* =============================================
   Lazy Loading — Background Image Skeleton
   ============================================= */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

@keyframes smoothFadeIn {
    0%   { filter: blur(10px); opacity: 0.5; }
    100% { filter: blur(0); opacity: 1; }
}

.lazy-bg {
    background-color: var(--bg-surface);
    background-image: linear-gradient(
        90deg,
        var(--bg-surface) 0px,
        rgba(255,255,255,0.05) 40px,
        var(--bg-surface) 80px
    );
    background-size: 800px 100%;
    background-repeat: no-repeat;
    animation: shimmer 1.4s ease infinite;
    transition: opacity 0.35s ease;
    opacity: 0.75;
}

.lazy-bg.lazy-loaded {
    animation: smoothFadeIn 0.5s ease-out forwards;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 1;
}

/* Modern Numbered Pagination */
.pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.pagination-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-pure);
    border-color: rgba(255, 255, 255, 0.2);
}

.pagination-item.active {
    background: var(--primary);
    color: var(--text-pure);
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-dim);
}

.pagination-item.disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.9rem;
    user-select: none;
}