/* ============================================
   MangaVerse - Main Stylesheet
   ============================================ */

/* Remove @import to improve performance - loaded in header.php */

/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0d0d1a;
    --bg-secondary: #12121f;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1f1f35;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --accent: #7c3aed;
    --accent-light: #f7f5fc;
    --accent-dim: rgba(124, 58, 237, 0.2);
    --accent2: #ec4899;
    --accent2-dim: rgba(236, 72, 153, 0.15);

    --text-primary: #f0f0ff;
    --text-secondary: #b1b1c7;
    --text-muted: #9898b8;
    /* Brighter variant */

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
    --shadow-accent: 0 4px 24px rgba(124, 58, 237, 0.3);

    --nav-height: 72px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Noto Sans Thai', 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

@media (min-width: 1600px) {
    .container {
        padding: 0 24px;
    }
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: rgba(13, 13, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.navbar.scrolled {
    background: rgba(13, 13, 26, 0.97);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-logo:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.nav-logo-img {
    height: 40px;
    object-fit: contain;
    transition: var(--transition);
}

@media (min-width: 1024px) {
    :root {
        --nav-height: 90px;
    }

    .nav-logo-img {
        height: 64px;
    }

    .logo-text {
        font-size: 32px;
    }

    .logo-icon {
        font-size: 40px;
    }
}

.logo-icon {
    font-size: 32px;
    line-height: 1;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.nav-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.nav-search input:focus {
    border-color: var(--accent-light);
    background: rgba(124, 58, 237, 0.08);
}

.nav-search input::placeholder {
    color: var(--text-muted);
}

.nav-search>svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.nav-search-drop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.nav-search-drop.active {
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.nav-link.active {
    color: var(--accent-light);
}

/* ===== Nav Dropdown ===== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.nav-dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.nav-dropdown:hover .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    padding-top: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: flex;
}

.nav-dropdown-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
    display: block;
}

.nav-mobile {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    flex-direction: column;
    gap: 4px;
    z-index: 999;
}

.nav-mobile.open {
    display: flex;
}

.nav-mobile a {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-mobile a:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

/* ===== Main Content ===== */
.main-content {
    padding-top: var(--nav-height);
    min-height: 100vh;
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    padding: 80px 0 60px;
    overflow: hidden;
    width: 100%;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 30% 40%, rgba(124, 58, 237, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 60% 60% at 80% 20%, rgba(236, 72, 153, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 64px;
    align-items: center;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-dim);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 20px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(124, 58, 237, 0);
    }
}

.hero-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.gradient-text {
    background: linear-gradient(135deg, #a78bfa, #ec4899, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 480px;
    line-height: 1.8;
}

.hero-search {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    overflow: visible;
    max-width: 480px;
    margin-bottom: 36px;
    position: relative;
    transition: var(--transition);
}

.hero-search:focus-within {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.hero-search input {
    flex: 1;
    padding: 14px 20px;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
}

.hero-search input::placeholder {
    color: var(--text-muted);
}

.hero-search button {
    padding: 10px 20px;
    margin-right: 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.hero-search button:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: var(--transition);
    color: var(--text-primary);
}

.suggestion-item:hover {
    background: var(--bg-glass);
}

.suggestion-item img {
    width: 36px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.suggestion-item strong {
    display: block;
    font-size: 14px;
}

.suggestion-item span {
    font-size: 12px;
    color: var(--text-muted);
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-light);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

.hero-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 3/4;
    box-shadow: var(--shadow-accent), var(--shadow-lg);
    transition: var(--transition);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.hero-card:hover {
    transform: scale(1.03) rotate(-1deg);
    box-shadow: 0 16px 60px rgba(124, 58, 237, 0.4);
}

.hero-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
}

.hc-genre {
    display: inline-block;
    padding: 3px 8px;
    background: var(--accent);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-card-info h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    display: inline;
    background: rgba(0, 0, 0, 0.45);
    box-shadow: 4px 0 0 rgba(0, 0, 0, 0.45), -4px 0 0 rgba(0, 0, 0, 0.45);
    line-height: 1.6;
    border-radius: 2px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.hc-chapters {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.hc-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.hc-daily-views {
    font-size: 12px;
    color: #fbbf24;
    font-weight: 600;
}

.hc-featured-label {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    padding: 5px 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
    pointer-events: none;
}

.hc-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    pointer-events: none;
}

.hc-status.status-ongoing {
    background: rgba(16, 185, 129, 0.85);
    color: #fff;
}

.hc-status.status-completed {
    background: rgba(59, 130, 246, 0.85);
    color: #fff;
}

.hc-status.status-hiatus {
    background: rgba(245, 158, 11, 0.85);
    color: #fff;
}

.hc-status.status-hidden {
    background: rgba(100, 100, 100, 0.85);
    color: #fff;
}


/* ===== Genre Pills ===== */
.genre-section {
    padding: 24px 0 8px;
}

.genre-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0;
}

.genre-pill {
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.genre-pill:hover,
.genre-pill.active {
    background: var(--accent-dim);
    border-color: var(--accent-light);
    color: var(--accent-light);
}

/* ===== Sections ===== */
.section {
    padding: 48px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    font-size: 24px;
}

.view-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    transition: var(--transition);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--accent-dim);
}

.view-all:hover {
    background: var(--accent-dim);
}

/* ===== Latest Grid ===== */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.latest-card {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
}

.latest-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.latest-cover {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 64px;
}

.latest-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.latest-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent2);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.latest-info {
    flex: 1;
    min-width: 0;
}

.latest-info h4 {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.chapter-num {
    display: block;
    font-size: 12px;
    color: var(--accent-light);
    font-weight: 500;
}

.chapter-time {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Manga Grid ===== */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 576px) {
    .manga-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 768px) {
    .manga-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .manga-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

.manga-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 0;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.manga-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.manga-card:hover .manga-info {
    transform: translateY(100%);
    opacity: 0;
}

.manga-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--bg-secondary);
}

.manga-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.manga-card:hover .manga-cover img {
    transform: scale(1.08);
}

.manga-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.manga-new-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e11d48;
    /* Increased contrast red */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

.manga-chapters {
    background: var(--accent);
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.manga-status {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-ongoing {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.status-completed {
    background: rgba(59, 130, 246, 0.9);
    color: white;
}

.status-hiatus {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

.manga-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.8);
    transition: all 0.3s ease;
}

.manga-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 2px;
}

.manga-genre {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manga-time {
    font-size: 11px;
    color: #fff;
    display: block;
    margin-top: 2px;
}

/* ===== Empty State ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

.empty-state a {
    color: var(--accent-light);
    text-decoration: underline;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 48px 0 24px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (min-width: 1600px) {
    .footer-grid {
        grid-template-columns: 3fr 1fr 1fr 1fr;
        gap: 60px;
    }
}

.footer-brand p {
    font-size: 14px;
    color: var(--text-secondary);
    /* Increased contrast */
    margin-top: 12px;
    line-height: 1.7;
}

.footer-links h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-links a {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    /* Increased contrast */
    margin-bottom: 8px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-light);
    padding-left: 4px;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    /* Increased contrast */
}

/* ===== Series Detail ===== */
.series-hero {
    position: relative;
    padding: 40px 0;
    overflow: hidden;
}

.series-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(30px) brightness(0.15);
    transform: scale(1.1);
}

.series-content {
    position: relative;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    align-items: start;
}

.series-cover {
    aspect-ratio: 3/4;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.series-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.series-info {
    padding: 8px 0;
}

.series-type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-dim);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.series-title {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.series-alt-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.series-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
}

.meta-value {
    font-size: 14px;
    font-weight: 500;
}

.series-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 24px;
    max-width: 600px;
}

.series-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: 50px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.series-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.series-genre-tag {
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.series-genre-tag:hover {
    border-color: var(--accent-light);
    color: var(--accent-light);
}

/* ===== Chapter List ===== */
.chapter-section {
    padding: 40px 0;
}

.chapter-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.chapter-count {
    font-size: 13px;
    color: var(--text-muted);
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 4px;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
}

.chapter-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-light);
    transform: translateX(4px);
}

.chapter-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chapter-item-num {
    font-size: 14px;
    font-weight: 600;
}

.chapter-item-title {
    font-size: 12px;
    color: var(--text-muted);
}

.chapter-item-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.chapter-item-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== Reader Page ===== */
.reader-controls {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(13, 13, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 800;
}

.reader-info {
    flex: 1;
}

.reader-info h2 {
    font-size: 14px;
    font-weight: 600;
}

.reader-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.reader-nav-btns {
    display: flex;
    gap: 8px;
}

.reader-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.reader-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent-light);
}

.reader-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.reader-mode-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
}

.reader-mode-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent-light);
    color: var(--accent-light);
}

.reader-pages {
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 20px 40px;
}

.reader-pages.webtoon {
    max-width: 720px;
}

.reader-pages.paginated .page-img {
    display: none;
}

.reader-pages.paginated .page-img.active {
    display: block;
}

.page-img {
    width: 100%;
    margin: 0 auto;
    border-radius: 4px;
    display: block;
    background: #000;
    min-height: 200px;
}

.page-img+.page-img {
    margin-top: 4px;
}

.reader-pages.webtoon .page-img+.page-img {
    margin-top: 2px;
}

.reader-page-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 13, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 800;
    font-size: 13px;
}

.page-counter {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* ===== Search & List Page ===== */
.page-hero {
    padding: 60px 20px 40px;
    max-width: 1280px;
    margin: 0 auto;
}

.page-hero h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.page-hero p {
    color: var(--text-muted);
}

.filter-bar {
    padding: 0 0 32px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    padding: 9px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239898b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-select:focus {
    border-color: var(--accent-light);
}

.search-input {
    flex: 1;
    max-width: 360px;
    padding: 9px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--accent-light);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 40px 0;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.page-btn:hover {
    border-color: var(--accent-light);
    background: var(--accent-dim);
}

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.page-btn.wide {
    width: auto;
    padding: 0 16px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    max-width: 300px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--info);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .nav-links {
        display: none;
    }

    .nav-search {
        max-width: 280px;
    }
}

@media (max-width: 768px) {

    .container,
    .nav-container,
    .hero-content {
        padding: 0 10px;
    }

    .hero {
        padding: 40px 0 40px;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 32px;
    }

    .hero-badge {
        margin-left: auto;
        margin-right: auto;
        font-size: 14px;
    }

    .hero-title {
        font-size: 38px;
    }

    .hero-desc {
        margin-left: auto;
        margin-right: auto;
        font-size: 15px;
        line-height: 1.6;
        max-width: 100%;
    }

    .mobile-nowrap {
        display: inline-block;
        white-space: nowrap;
        font-size: 13.5px;
        letter-spacing: -0.2px;
    }

    .hero-search {
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }

    .hero-featured {
        display: none;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .series-content {
        grid-template-columns: 140px 1fr;
        gap: 20px;
    }

    .latest-grid {
        grid-template-columns: 1fr;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-search {
        display: none;
    }

    .reader-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .series-content {
        grid-template-columns: 1fr;
    }

    .series-cover {
        max-width: 180px;
        margin: 0 auto;
    }

    .series-desc {
        text-align: center;
        max-width: 100%;
    }

    .hero {
        padding: 40px 16px 32px;
    }
}

/* ===== Loading Skeleton ===== */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* ===== Gallery Filter Bar ===== */
.gallery-filter-bar {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.sort-tabs {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 4px;
}

.sort-tab {
    padding: 8px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    /* Increased from muted for better contrast */
    transition: var(--transition);
    white-space: nowrap;
}

.sort-tab:hover {
    color: var(--text-primary);
    /* Increased from secondary for better hover contrast */
}

.sort-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
}

/* ===== Manga Views Badge ===== */
.manga-views {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
}

/* ===== Lazy Load Images ===== */
.manga-page-placeholder {
    width: 100%;
    min-height: 40vh;
    background: #111;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin: 0;
}

.manga-page-placeholder::before {
    content: "กำลังโหลดรูปภาพ...";
    color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    position: absolute;
    z-index: 0;
}

.manga-page-placeholder::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #111 25%, #1a1a24 50%, #111 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

.manga-page-placeholder.loaded {
    min-height: auto;
    background: transparent;
}

.manga-page-placeholder.loaded::before,
.manga-page-placeholder.loaded::after {
    display: none;
}

.lazy-manga-page {
    max-width: 100%;
    display: block;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
    position: relative;
}

.lazy-manga-page.loaded {
    opacity: 1;
}

/* ===== Scroll To Top ===== */
.scroll-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
    opacity: 0;
    transform: translateY(16px) scale(0.85);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 999;
}

.scroll-to-top.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.scroll-to-top:hover {
    box-shadow: 0 6px 28px rgba(139, 92, 246, 0.75);
    transform: translateY(-2px) scale(1.08);
}

.scroll-to-top svg {
    flex-shrink: 0;
}

/* ===== Mobile Featured Card ===== */
.mobile-featured-card {
    display: none;
}

@media (max-width: 768px) {
    .mobile-featured-card {
        display: flex !important;
    }

    .hero-stats {
        justify-content: center;
        gap: 16px;
    }

    .stat-num {
        font-size: 24px;
    }

    .stat-label {
        font-size: 13px;
    }
}

/* ===== View More Card ===== */
.view-more-cover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(236, 72, 153, 0.12)) !important;
    border: 2px dashed rgba(139, 92, 246, 0.4) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.view-more-card:hover .view-more-cover {
    border-color: var(--accent-light) !important;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(236, 72, 153, 0.2)) !important;
}

.view-more-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--accent-light);
}

.view-more-inner span {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent-light), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.view-more-inner small {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Text Blink (Waiting State) ===== */
@keyframes text-blink-anim {

    0%,
    100% {
        opacity: 1;
        text-shadow:
            0 0 8px rgba(139, 92, 246, 0.8),
            0 0 20px rgba(139, 92, 246, 0.4);
    }

    50% {
        opacity: 0.35;
        text-shadow:
            0 0 4px rgba(139, 92, 246, 0.2),
            0 0 10px rgba(236, 72, 153, 0.1);
    }
}

@keyframes text-blink-gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.text-blink {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-light), var(--accent2), var(--accent-light));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation:
        text-blink-anim 1.4s ease-in-out infinite,
        text-blink-gradient 2.8s ease infinite;
    cursor: default;
    transition: filter 0.25s ease, transform 0.25s ease;
}

.text-blink:hover {
    animation-play-state: paused;
    filter: brightness(1.4) drop-shadow(0 0 8px rgba(139, 92, 246, 0.7));
    transform: scale(1.04);
    -webkit-text-fill-color: transparent;
}