/* Main Layout & Aesthetic */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Header */
.site-header {
    height: var(--header-height);
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
}

.logo-text span {
    color: var(--primary-color);
}

.site-logo {
    height: 60px;
    width: auto;
    max-width: 160px;
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo:hover .site-logo {
    transform: scale(1.08);
}

.main-navigation ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.main-navigation a {
    font-weight: 600;
    font-size: 15px;
    text-transform: uppercase;
}

.main-navigation a:hover {
    color: var(--primary-color);
}

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

.header-actions i {
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.header-actions i:hover {
    color: var(--primary-color);
}

/* Hero Slider */
.hero-slider-section {
    padding: 40px 0;
}

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

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

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

.hero-slider {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.slider-item {
    height: 350px;
    border-radius: var(--border-radius);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.slider-content {
    position: relative;
    z-index: 2;
}

.slider-content h3 {
    font-size: 18px;
    margin: 5px 0 10px;
}

.manga-genre {
    font-size: 12px;
    background: var(--primary-color);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Manga Grid & Cards */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

.manga-card {
    background: var(--surface-dark);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.manga-card:hover {
    transform: translateY(-5px);
}

.manga-card-thumb {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
}

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

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

.thumb-overlays {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.pushpin-icon {
    font-size: 18px;
    color: var(--primary-color);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.verified-icon {
    color: #3498db;
    font-size: 16px;
    vertical-align: middle;
    margin-left: 5px;
}

/* Chapter Pills */
.chapter-pill {
    background: var(--surface-lighter);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    transition: var(--transition);
}

.chapter-pill:hover {
    background: var(--primary-color);
}

.chapter-pill:hover * {
    color: #fff;
}

/* Manga Tabs */
.manga-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 12px 25px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Ranking Widget */
.ranking-widget {
    background: var(--surface-dark);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
}

.widget-title {
    font-size: 16px;
    margin-bottom: 15px;
}

.ranking-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.rank-badge {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

.rank-badge.gold {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid #f1c40f;
}

.rank-badge.blue {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid #3498db;
}

/* Chapter Controls Bar */
.chapter-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.chapter-search {
    display: flex;
    align-items: center;
    background: var(--surface-lighter);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px;
    flex: 1;
    min-width: 150px;
}

.chapter-search i {
    color: var(--text-muted);
    font-size: 16px;
    margin-right: 6px;
}

.chapter-search input {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 8px 0;
    width: 100%;
    font-size: 13px;
    outline: none;
}

.sort-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.sort-btn {
    background: var(--surface-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sort-btn i {
    font-size: 14px;
}

.sort-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.sort-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Chapter Grid (Multi-column) */
.chapter-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 16px;
}

.chapter-grid-item {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--surface-lighter);
    border-radius: 6px;
    text-decoration: none !important;
    color: var(--text-main);
    font-size: 13px;
    transition: all 0.2s ease;
    overflow: hidden;
    border: 1px solid transparent;
    gap: 8px;
    min-height: 40px;
    box-sizing: border-box;
}

.chapter-grid-item:hover {
    background: rgba(255, 61, 90, 0.08);
    border-color: rgba(255, 61, 90, 0.2);
    color: var(--primary-color);
}

.cg-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    font-weight: 500;
    display: inline-block;
}

.cg-date {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
    display: inline-block;
}

/* Pagination */
.chapter-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pag-btn {
    background: var(--surface-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pag-btn:hover:not([disabled]):not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pag-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.pag-btn[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

.pag-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 10px;
}

/* Responsive: 3 columns on large */
@media screen and (min-width: 1024px) {
    .chapter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile: 1 column */
@media screen and (max-width: 768px) {
    .chapter-grid {
        grid-template-columns: 1fr !important;
        gap: 4px !important;
    }

    .chapter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-toggle {
        justify-content: center;
    }

    .chapter-grid-item {
        padding: 10px 14px !important;
        font-size: 14px !important;
        min-height: 44px !important;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0 !important;
        background: transparent !important;
    }

    .chapter-grid-item:hover {
        background: rgba(255, 61, 90, 0.05) !important;
    }

    .cg-date {
        font-size: 12px;
    }
}


/* Footer & Back to Top */
.footer-search {
    margin-top: 20px;
    position: relative;
    max-width: 300px;
}

.footer-search input {
    width: 100%;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    padding: 10px 40px 10px 15px;
    border-radius: 25px;
    color: #fff;
}

.footer-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    opacity: 0.8;
    transition: var(--transition);
}

.back-to-top:hover {
    opacity: 1;
    transform: translateY(-5px);
}

/* Novel Reader Core */
.reader-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 60px;
    /* space for fixed footer nav */
}

.reader-container.theme-light {
    background: #ffffff;
    color: #1a1a1a;
}

.reader-container.theme-sepia {
    background: #f8f1e3;
    color: #4a3728;
}

.reader-container.theme-dark {
    background: #121212;
    color: #d8d8d8;
}

/* ===== Compact Top Bar ===== */
.reader-topbar {
    position: sticky;
    top: 0;
    z-index: 120000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
    height: 50px;
}

.topbar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 12px;
}

.topbar-back {
    color: #fff;
    font-size: 22px;
    display: flex;
    align-items: center;
    padding: 6px;
    flex-shrink: 0;
}

.topbar-back:hover {
    color: var(--primary-color);
}

.topbar-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-novel-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-chapter-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-settings-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.topbar-settings-btn:hover,
.topbar-settings-btn.active {
    background: var(--primary-color);
}

/* ===== Settings Drawer ===== */
.settings-drawer {
    position: fixed;
    bottom: 60px;
    /* above footer nav */
    left: 0;
    right: 0;
    z-index: 180;
    background: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #fff;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px 16px 0 0;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-drawer.open {
    transform: translateY(0);
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 170;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.settings-drawer-inner {
    padding: 20px 20px 16px;
}

.drawer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-row:last-child {
    border-bottom: none;
}

.drawer-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.drawer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 42px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.drawer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.drawer-btn:active {
    transform: scale(0.95);
}

.drawer-value {
    min-width: 45px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-color);
}

.drawer-select {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.drawer-select option {
    background: #1a1a1a;
    color: #fff;
}

/* Theme selector buttons in drawer */
.theme-controls {
    gap: 6px;
}

.theme-controls .theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 52px;
    height: 34px;
}

.theme-controls .theme-btn.theme-white {
    background: #fff;
    color: #333;
}

.theme-controls .theme-btn.theme-sepia {
    background: #f4ecd8;
    color: #5b4636;
}

.theme-controls .theme-btn.theme-dark {
    background: #1a1a1a;
    color: #d1d1d1;
}

.theme-controls .theme-btn.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* ===== Reading Area ===== */
.reader-area {
    flex: 1;
    padding: 24px 0 40px;
}

.reader-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.chapter-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
}

.reader-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 13px;
    color: inherit;
    opacity: 0.6;
}

.reader-meta i {
    font-size: 14px;
    vertical-align: middle;
    margin-right: 3px;
}

.chapter-content {
    line-height: 2.0;
    letter-spacing: 0.02em;
}

.chapter-content p {
    margin-bottom: 24px;
}

.chapter-content.font-serif {
    font-family: 'Georgia', 'Times New Roman', serif;
}

.chapter-content.font-sans-serif {
    font-family: 'Inter', sans-serif;
}

/* Theme-specific content colors */
.reader-container.theme-light .chapter-content {
    color: #1a1a1a;
}

.reader-container.theme-sepia .chapter-content {
    color: #4a3728;
}

.reader-container.theme-dark .chapter-content {
    color: #d8d8d8;
}

.reader-container.theme-light .reader-area {
    background-color: #ffffff;
}

.reader-container.theme-sepia .reader-area {
    background-color: #f8f1e3;
}

.reader-container.theme-dark .reader-area {
    background-color: #121212;
}

.reader-container.theme-light .reader-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.reader-container.theme-sepia .reader-header {
    border-bottom-color: rgba(91, 70, 54, 0.15);
}

.reader-container.theme-dark .reader-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Paragraph hover - desktop only */
.novel-para {
    position: relative;
    transition: 0.2s;
}

/* Font Families */
.font-serif {
    font-family: 'Georgia', 'Times New Roman', serif;
}

.font-sans-serif {
    font-family: 'Inter', sans-serif;
}

/* Novel Specific UI */
.vip-tag {
    background: #f1c40f;
    color: #000;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
    margin-left: 10px;
    vertical-align: middle;
}

.paywall-content i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.paywall-content h2 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 15px;
}

.paywall-content p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.paywall-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Ad Placeholders */
.ad-placeholder {
    transition: opacity 0.3s ease;
}

.ad-placeholder:hover {
    opacity: 0.7;
}

/* Reader Tweaks */
.container-narrow {
    max-width: 800px;
}


/* Page Template Adjustments */
.vip-upgrade-page .alert-success {
    color: #fff;
    font-weight: 600;
    text-align: center;
}

/* Reader */
.reader-nav-bar {
    background: var(--surface-dark);
    height: 60px;
    display: flex;
    align-items: center;
}

.nav-bar-inner {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.chapter-images img {
    margin: 0 auto;
    display: block;
    width: 100%;
}

/* LIGHT MODE OVERRIDES */
body.light-mode {
    --background-dark: var(--bg-light);
    --surface-dark: var(--surface-light);
    --text-main: var(--text-light);
    --border-color: #ddd;
    --text-muted: var(--text-muted-light);
}

body.light-mode .site-header {
    background: rgba(255, 255, 255, 0.9);
}

body.light-mode .manga-card {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Mobile Optimizations */
@media screen and (max-width: 768px) {

    /* Homepage Hero Slider Fix - Horizontal Scroll */
    .hero-slider {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 15px;
        grid-template-columns: none !important;
        /* Force override of the grid */
        padding-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        margin: 0 -20px;
        padding: 0 20px 20px;
    }

    .slider-item {
        flex: 0 0 85% !important;
        min-width: 280px;
        height: 180px !important;
        scroll-snap-align: start;
        border-radius: 12px;
    }

    .slider-content {
        padding: 15px !important;
    }

    .slider-content h3 {
        font-size: 1.1rem !important;
    }

    .slider-content p {
        display: none !important;
    }

    .slider-content .btn {
        font-size: 12px;
        padding: 5px 15px;
    }

    /* Reader Toolbar Fix - Compact Height */
    .reader-settings-bar {
        position: fixed !important;
        top: 60px !important;
        /* Move it up slightly if header is smaller */
        padding: 8px 0 !important;
        background: rgba(26, 26, 26, 0.98) !important;
    }

    .settings-inner {
        gap: 5px !important;
        justify-content: space-around !important;
        flex-wrap: nowrap !important;
    }

    .setting-group {
        gap: 10px !important;
        flex: none !important;
        justify-content: center !important;
    }

    .setting-label {
        display: none !important;
        /* Hide "Cỡ chữ", "Phông chữ" to save space */
    }

    .setting-item {
        gap: 5px !important;
    }

    .setting-item button {
        padding: 6px 12px !important;
        font-size: 13px !important;
        min-width: 35px;
    }

    .theme-btn {
        width: 28px !important;
        height: 28px !important;
    }

    .size-val {
        min-width: 35px !important;
        font-size: 13px !important;
    }

    /* Layout Adjustments */
    .reader-area {
        padding-top: 100px !important;
        /* Account for fixed bar */
    }

    .chapter-title {
        font-size: 1.4rem !important;
        margin-bottom: 5px !important;
    }
}

/* Bookmark Button States */
.btn-bookmark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-bookmark span {
    font-size: 13px;
}

.btn-bookmark.bookmarked {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.btn-bookmark.bookmarked i {
    color: #fff !important;
}

.btn-bookmark:hover {
    transform: scale(1.05);
}

/* Continue Reading Button */
.novel-actions .btn .dashicons-controls-play {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Homepage AI Sections */
.bns-ai-sections {
    margin-top: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.bns-ai-col .bns-detailed-card {
    transition: var(--transition);
    border: 1px solid transparent;
    padding: 10px;
    border-radius: var(--border-radius);
}

.bns-ai-col .bns-detailed-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
}

@media screen and (max-width: 768px) {
    .bns-ai-sections {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bns-ai-col .bns-detailed-card {
        padding: 0;
        background: transparent !important;
        border: none !important;
    }
}

/* Fix for small card alignment */
.bns-small-card {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.bns-small-card .bns-card-thumb {
    flex-shrink: 0;
    width: 80px;
    border-radius: 4px;
    overflow: hidden;
}

.bns-small-card .bns-card-info {
    flex: 1;
}

.bns-small-card h3 {
    font-size: 16px;
    margin: 0 0 5px 0;
    line-height: 1.3;
}

/* User Dashboard Styling */
.dashboard-layout {
    display: flex;
    gap: 30px;
}

.dashboard-sidebar {
    width: 300px;
    flex-shrink: 0;
}

.dashboard-main {
    flex: 1;
}

.user-profile-card {
    background: var(--surface-dark);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 20px;
}

.user-avatar img {
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    margin-bottom: 15px;
}

.badge-vip {
    color: #f1c40f;
    font-weight: bold;
    font-size: 13px;
}

.badge-free {
    color: #9ca3af;
    font-size: 13px;
}

.user-assets {
    background: var(--surface-dark);
    padding: 20px;
    border-radius: var(--border-radius);
}

.asset-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.asset-item:last-of-type {
    border-bottom: none;
}

.asset-label {
    font-size: 14px;
    color: #9ca3af;
}

.asset-value {
    font-weight: 700;
    color: #fff;
}

.dashboard-section {
    background: var(--surface-dark);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
}

.dashboard-section .section-title {
    font-size: 18px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 5px;
}

.history-list {
    list-style: none;
}

.history-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 14px;
}

.h-novel {
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

.h-chapter {
    color: var(--primary-color);
    text-decoration: none;
}

.h-sep {
    color: #666;
    font-size: 12px;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.status-badge.publish {
    background: #4ade80;
    color: #000;
}

.status-badge.pending {
    background: #fbbf24;
    color: #000;
}

@media screen and (max-width: 900px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .dashboard-sidebar {
        width: 100%;
    }
}

/* ===== CONTENT PROTECTION & ANTI-COPY ===== */
.chapter-content {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Obfuscated "Salt" text hiding */
.v-salt {
    display: none !important;
    visibility: hidden !important;
    overflow: hidden !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* DevTools Warning Overlay */
#devtools-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 15, 0.98);
    backdrop-filter: blur(20px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 20px;
    font-family: 'Montserrat', sans-serif;
}

#devtools-warning .warning-content {
    max-width: 500px;
}

#devtools-warning h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 28px;
}

#devtools-warning p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.8);
}

#devtools-warning .btn-back {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
}

body.devtools-open #devtools-warning {
    display: flex;
}

body.devtools-open .reader-container {
    filter: blur(50px) !important;
    pointer-events: none !important;
}
/* ===== NOVEL DETAIL BNS REDESIGN ===== */
.novel-detail-bns {
    padding: 30px 0 60px;
    background: #f4f5f6;
    color: #333;
    min-height: 100vh;
}

.novel-detail-bns a { color: inherit; text-decoration: none; transition: all 0.2s; }
.novel-detail-bns a:hover { color: var(--primary-color); }

/* Breadcrumb */
.bns-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    color: #666;
}
.bns-breadcrumb i { font-size: 14px; width: 14px; height: 14px; }
.bns-breadcrumb span { color: #333; font-weight: 500; }

/* Header Card */
.bns-header-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.bns-header-flex {
    display: flex;
    gap: 30px;
}

.bns-poster {
    flex: 0 0 220px;
}
.bns-poster img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.bns-info {
    flex: 1;
}
.bns-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 20px;
    line-height: 1.2;
    color: #1a1a1a;
}

.bns-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 30px;
    margin-bottom: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.meta-row {
    display: flex;
    font-size: 15px;
}
.meta-row .label {
    color: #666;
    width: 90px;
    flex-shrink: 0;
}
.meta-row .value {
    color: #333;
    font-weight: 600;
}
.vxu-highlight { color: #ed8936 !important; }

/* Actions */
.bns-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-bns {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-continue {
    background: var(--primary-color);
    color: #fff !important;
}
.btn-continue:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-dark {
    background: #2d3748;
    color: #fff !important;
}
.btn-dark:hover {
    background: #1a202c;
    transform: translateY(-2px);
}

.btn-bookmark-bns {
    background: #fff;
    border: 2px solid #ed64a6;
    color: #ed64a6;
}
.btn-bookmark-bns.active {
    background: #ed64a6;
    color: #fff;
}
.btn-bookmark-bns:hover {
    transform: scale(1.05);
}

/* Tags Section */
.bns-tags-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 0 10px;
}
.tags-label { font-weight: 700; font-size: 14px; color: #666; }
.tags-list { display: flex; gap: 10px; flex-wrap: wrap; }
.tag-pill {
    padding: 5px 15px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    color: #4a5568 !important;
}
.tag-pill:hover { border-color: var(--primary-color); color: var(--primary-color) !important; }

/* Content Area Tabs */
.bns-content-tabs {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.bns-tab-btn {
    padding: 18px 40px;
    font-size: 16px;
    font-weight: 700;
    color: #666;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.bns-tab-btn.active {
    color: var(--primary-color);
}
.bns-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.tab-body {
    padding: 30px;
}

.bns-tab-panel { display: none; }
.bns-tab-panel.active { display: block; }

/* Chapter List */
.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.toc-search {
    position: relative;
    flex: 1;
}
.toc-search input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}
.toc-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

.toc-sort { display: flex; gap: 10px; }
.toc-sort .sort-btn {
    padding: 10px 15px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.toc-sort .sort-btn.active { background: #edf2f7; color: #333; font-weight: 700; border-color: #cbd5e0; }

.bns-chapter-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #f0f0f0;
    border: 1px solid #f0f0f0;
    margin-bottom: 30px;
}

.chapter-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #fff;
    font-size: 14px;
    border: none;
    transition: background 0.2s;
    min-width: 0; /* Fix for grid columns expansion */
}

.chapter-item:hover { background: #fffcfc; color: var(--primary-color) !important; }
.chapter-item .ch-name { 
    font-weight: 500; 
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}
.chapter-item .ch-date { color: #a0aec0; font-size: 11px; }

/* Pagination BNS */
.bns-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.bns-pag-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #4a5568;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bns-pag-btn:hover:not([disabled]) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.bns-pag-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.bns-pag-btn[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

@media screen and (max-width: 1024px) {
    .bns-chapter-list { grid-template-columns: repeat(2, 1fr); }
}

@media screen and (max-width: 768px) {
    .bns-chapter-list { 
        grid-template-columns: 1fr;
        background: none;
        border: none;
        gap: 0;
    }
    .chapter-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f9f9f9;
        padding: 12px 10px;
    }
    .chapter-item .ch-name {
        flex: 1;
        margin-bottom: 0;
        margin-right: 15px;
    }
}
.vip-tag {
    background: #ed8936;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    text-transform: uppercase;
}

/* Synopsis */
.bns-synopsis {
    line-height: 1.8;
    color: #4a5568;
    font-size: 16px;
}

/* Dark Mode Overrides */
body.dark-mode .novel-detail-bns { background: #0f0f0f; color: #eee; }
body.dark-mode .bns-header-card, 
body.dark-mode .bns-content-tabs { background: #1a1a1a; color: #eee; border-color: #333; }
body.dark-mode .bns-title { color: #fff; }
body.dark-mode .meta-row .label { color: #aaa; }
body.dark-mode .meta-row .value { color: #eee; }
body.dark-mode .tag-pill { background: #2a2a2a; border-color: #333; color: #ccc !important; }
body.dark-mode .tab-nav { background: #222; border-color: #333; }
body.dark-mode .toc-search input { background: #222; border-color: #333; color: #fff; }
body.dark-mode .toc-sort .sort-btn { background: #222; border-color: #333; color: #fff; }
body.dark-mode .chapter-item { border-color: #222; }
body.dark-mode .chapter-item:hover { background: #222; }

@media screen and (max-width: 768px) {
    .bns-header-flex { flex-direction: column; align-items: center; text-align: center; }
    .bns-poster { flex: 0 0 auto; width: 180px; margin-bottom: 20px; }
    .bns-meta-grid { grid-template-columns: 1fr; gap: 8px; }
    .meta-row { justify-content: center; }
    .bns-actions { justify-content: center; }
    .toc-header { flex-direction: column; }
    .bns-tab-btn { padding: 15px 20px; flex: 1; }
}

/* --- Adblock Detection UI --- */
#vread-adblock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: vreadFadeIn 0.3s ease;
}

.vread-adblock-modal {
    background: #fff;
    max-width: 450px;
    width: 90%;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    transform: translateY(0);
    animation: vreadSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vread-adblock-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.vread-adblock-modal h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: 700;
}

.vread-adblock-modal p {
    color: #666;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.vread-adblock-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vread-btn-primary {
    background: #ff3d5a;
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.vread-btn-primary:hover {
    background: #e6354f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 61, 90, 0.3);
}

.vread-btn-secondary {
    background: transparent;
    color: #999;
    border: none;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

.vread-btn-secondary:hover {
    color: #666;
}

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

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

/* Dark mode support */
body.dark-mode .vread-adblock-modal {
    background: #1e1e1e;
}
body.dark-mode .vread-adblock-modal h2 {
    color: #fff;
}
body.dark-mode .vread-adblock-modal p {
    color: #bbb;
}


/* --- Paragraph Commenting UI --- */
.para-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.para-comment-trigger {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none !important;
    box-shadow: none !important;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0;
    z-index: 20;
    pointer-events: auto;
}

.para-wrapper:hover .para-comment-trigger {
    opacity: 0.6;
}

.para-comment-trigger:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

.para-comment-trigger .dashicons {
    font-size: 20px;
}

.para-comment-trigger .count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary-color);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 10px;
    font-weight: bold;
    min-width: 10px;
    text-align: center;
    line-height: 1;
}

/* Sidebar */
/* Paragraph Comment Sidebar */
.para-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -10px 0 30px rgba(0,0,0,0.15);
    z-index: 110000;
    transition: right 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    color: #333;
}

.para-sidebar.open {
    right: 0;
}

/* Theme Adaptation for Sidebar */
.reader-container.theme-sepia .para-sidebar { background: #f4ecd8; color: #5b4636; }
.reader-container.theme-dark .para-sidebar { background: #1a1a1a; color: #d1d1d1; border-left: 1px solid rgba(255,255,255,0.1); }

.para-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 109999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.para-overlay.active {
    display: block;
    opacity: 1;
}


.sidebar-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reader-container.theme-dark .sidebar-header { border-bottom-color: rgba(255,255,255,0.1); }

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.close-btn {
    background: rgba(0,0,0,0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover { background: var(--primary-color); color: #fff; }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.para-quote {
    font-style: italic;
    color: inherit;
    opacity: 0.8;
    padding: 15px;
    background: rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.6;
    border-radius: 0 8px 8px 0;
}

.reader-container.theme-dark .para-quote { background: rgba(255,255,255,0.05); }


.para-comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease forwards;
}

.para-comment-item .avt {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.com-meta {
    font-size: 12px;
    margin-bottom: 5px;
}

.com-meta span {
    color: var(--text-muted);
    margin-left: 5px;
}

.com-text {
    font-size: 14px;
    line-height: 1.5;
}

.sidebar-footer {
    padding: 25px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.reader-container.theme-dark .sidebar-footer { border-top-color: rgba(255,255,255,0.1); }

.para-comment-form textarea {
    width: 100%;
    height: 100px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
    color: #333;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.para-comment-form textarea:focus { border-color: var(--primary-color); }

.reader-container.theme-sepia .para-comment-form textarea { background: #fffdf7; border-color: #d8cfb3; }
.reader-container.theme-dark .para-comment-form textarea { background: #252525; border-color: #444; color: #eee; }


/* Mobile Responsive */
@media (max-width: 768px) {
    .para-comment-trigger {
        right: 0;
        opacity: 0.6;
        background: rgba(255,255,255,0.8);
        border-radius: 50%;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .para-sidebar {
        width: 100%;
        right: -100%;
    }
    .sidebar-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom) + 20px);
    }
}

/* --- TTS Player Styles --- */
.tts-player {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #fff;
    z-index: 2000;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.tts-player.active {
    bottom: 0;
}

.tts-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.tts-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 120px;
}

.tts-wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 15px;
}

.tts-wave span {
    width: 3px;
    background: var(--primary-color);
    animation: wave 1s ease-in-out infinite;
    border-radius: 10px;
}

.tts-wave span:nth-child(2) { animation-delay: 0.2s; height: 10px; }
.tts-wave span:nth-child(3) { animation-delay: 0.4s; height: 15px; }
.tts-wave span:nth-child(4) { animation-delay: 0.6s; height: 8px; }

@keyframes wave {
    0%, 100% { height: 5px; }
    50% { height: 100%; }
}

.tts-status {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}

.tts-main-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tts-main-controls button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin {
    animation: spin 2s linear infinite;
    display: inline-block;
}

.tts-main-controls button:hover {
    transform: scale(1.1);
}

.tts-main-controls .btn-play {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 50%;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(255, 61, 90, 0.4);
}

.tts-extra-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tts-extra-controls select {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
}

#tts-stop {
    font-size: 24px;
    opacity: 0.6;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}

.tts-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.1);
}

#tts-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s linear;
}

/* Switch Toggle */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch-toggle input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

@media screen and (max-width: 768px) {
    .tts-info { display: none; }
    .tts-inner { justify-content: center; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .tts-extra-controls { margin-left: 20px; }
}

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

/* Dashboard Mobile Fix */
@media screen and (max-width: 768px) {
    .dashboard-layout {
        display: block !important;
    }
    .dashboard-sidebar {
        margin-bottom: 30px !important;
        position: relative !important;
        z-index: 100 !important;
    }
    .vip-membership-box {
        position: relative !important;
        z-index: 110 !important;
        pointer-events: auto !important;
    }
    .buy-vxu-btn {
        min-height: 48px; /* Bigger touch target */
        display: flex;
        align-items: center;
    }
}

/* ===== Live Search Overlay (Top Slide-down) ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 9999999;
    display: none;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding-top: 5vh;
}

.search-overlay.active {
    display: block;
    opacity: 1;
}

.search-overlay-close {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all 0.3s ease;
}

.search-overlay-close:hover {
    background: var(--primary-color);
    transform: rotate(90deg);
}

.search-overlay-close i {
    font-size: 24px;
}

.search-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 0 20px;
    transform: translateY(-50px);
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.search-overlay.active .search-container {
    transform: translateY(0);
}

.search-box {
    position: relative;
    margin-bottom: 30px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    color: rgba(255, 255, 255, 0.4);
}

#live-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px 20px 18px 60px;
    font-size: 22px;
    color: #fff !important;
    outline: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#live-search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(255, 61, 90, 0.3);
}

/* Spinner */
.search-spinner {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: searchSpin 0.8s linear infinite;
}

@keyframes searchSpin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Results Area */
.search-results-container {
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 5px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-results-container::-webkit-scrollbar {
    width: 5px;
}

.search-results-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.search-result-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    text-decoration: none !important;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.01);
}

.search-res-thumb {
    width: 50px;
    height: 70px;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.search-res-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-res-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.search-res-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff !important;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-res-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-res-meta i {
    font-size: 14px;
    vertical-align: middle;
}

.search-res-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
}

.search-res-status.ongoing { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.search-res-status.completed { background: rgba(52, 152, 219, 0.15); color: #3498db; }

.search-no-results {
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Light Mode Overrides */
body:not(.dark-mode) .search-overlay {
    background: rgba(255, 255, 255, 0.9);
}

body:not(.dark-mode) .search-overlay-close {
    background: rgba(0, 0, 0, 0.06);
    color: #444;
}

body:not(.dark-mode) #live-search-input {
    background: #fff;
    border-color: #eee;
    color: #333 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .search-res-title {
    color: #222 !important;
}

body:not(.dark-mode) .search-result-item:hover {
    background: #f8f9fa;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

body:not(.dark-mode) .search-results-container {
    background: #fff;
    border-color: #eee;
}

/* Mobile Search Fixes */
@media (max-width: 768px) {
    .search-overlay { padding-top: 10vh; }
    .search-overlay-close { top: 15px; right: 15px; }
    .search-container { padding: 0 15px; }
    #live-search-input { font-size: 17px; padding: 14px 15px 14px 45px; }
    .search-icon { left: 15px; font-size: 18px; }
    .search-res-title { font-size: 14px; }
}


