/*
Theme Name: VREAD BNS Edition
Theme URI: https://vread.top
Author: NTN
Description: Giao diện WordPress cao cấp dành cho website Tiểu thuyết, thiết kế theo phong cách Bạch Ngọc Sách.
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: vread-top
Tags: manga, webtoon, dark-mode, responsive, comic, bns
*/

:root {
    /* Color Palette */
    --primary-color: #ff3d5a;
    --primary-hover: #e6354f;
    --background-dark: #0f0f0f;
    --surface-dark: #1a1a1a;
    --surface-lighter: #2a2a2a;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --border-color: #333333;
    
    /* Light Mode Variables (to be toggled) */
    --bg-light: #f4f4f4;
    --surface-light: #ffffff;
    --text-light: #333333;
    --text-muted-light: #666666;
    
    /* Layout Constants */
    --container-width: 1200px;
    --header-height: 70px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background-dark);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.light-mode {
    background-color: var(--bg-light);
    color: var(--text-light);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Anti-Copy Protection */
.chapter-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-size: 20px;
    line-height: 1.8;
}

/* Comments Section Styling */
.comments-area {
    margin-top: 40px;
    padding: 30px;
    border-top: 1px solid var(--border-color);
}
.reader-container.theme-sepia .comments-area { border-color: #d8cfb3; }
.reader-container.theme-dark .comments-area { border-color: #333; }

.comment-list { list-style: none; padding: 0; }
.comment { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px dashed rgba(128,128,128,0.2); }
.comment-author cite { font-weight: bold; font-style: normal; }
.comment-meta { font-size: 12px; opacity: 0.7; margin-bottom: 10px; }

.comment-respond { margin-top: 30px; }
.comment-form textarea { width: 100%; padding: 15px; border-radius: 8px; border: 1px solid rgba(128,128,128,0.3); background: rgba(128,128,128,0.05); color: inherit; }
.form-submit input { background: var(--primary-color); color: #fff; border: none; padding: 10px 25px; border-radius: 4px; cursor: pointer; font-weight: bold; }

/* ===== Reader Footer Navigation ===== */
.reader-footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 190;
    background: rgba(15, 15, 15, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.footer-nav-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    max-width: 400px;
    margin: 0 auto;
}

.btn-chapter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    flex: 1;
    border: 2px solid transparent;
}

.btn-chapter i {
    font-size: 16px;
    line-height: 1;
}

.btn-prev {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.12);
}
.btn-prev:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-toc {
    background: rgba(255, 61, 90, 0.1);
    color: var(--primary-color);
    border-color: rgba(255, 61, 90, 0.25);
}
.btn-toc:hover {
    background: rgba(255, 61, 90, 0.2);
}

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

.btn-chapter[href="#"] {
    opacity: 0.3;
    pointer-events: none;
}

/* Theme overrides for footer nav */
.reader-container.theme-light .reader-footer-nav {
    background: rgba(255, 255, 255, 0.97);
    border-top-color: rgba(0, 0, 0, 0.1);
}
.reader-container.theme-light .btn-prev {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
    border-color: rgba(0, 0, 0, 0.12);
}

.reader-container.theme-sepia .reader-footer-nav {
    background: rgba(235, 225, 200, 0.97);
    border-top-color: rgba(91, 70, 54, 0.12);
}
.reader-container.theme-sepia .btn-prev {
    background: rgba(91, 70, 54, 0.08);
    color: #5b4636;
    border-color: rgba(91, 70, 54, 0.15);
}

/* ===== Mobile Optimizations ===== */
@media screen and (max-width: 768px) {
    /* Hide site header ad on mobile */
    .ad-global-header { display: none !important; }

    /* Hide desktop ads in reader */
    .ad-reader-top { display: none !important; }

    /* Reader - Reduce padding for more reading space */
    .reader-area {
        padding: 16px 0 30px !important;
    }
    .container-narrow {
        padding: 0 16px !important;
    }

    /* Chapter title sizing */
    .chapter-title {
        font-size: 1.2rem !important;
        line-height: 1.4 !important;
        margin-bottom: 8px !important;
    }

    /* Content optimization for mobile reading */
    .chapter-content {
        font-size: 18px !important;
        line-height: 1.85 !important;
    }
    .chapter-content p {
        margin-bottom: 20px !important;
    }

    /* Reader header compact */
    .reader-header {
        margin-bottom: 20px !important;
        padding-bottom: 12px !important;
    }
    .reader-meta {
        gap: 12px !important;
        font-size: 12px !important;
    }

    /* Home - Hero Slider to Horizontal Scroll */
    .hero-slider {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 15px;
        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.2rem !important; }
    .slider-content p { display: none; }
}

/* ===== BNS THEME STYLES ===== */
.bns-homepage-content {
	padding: 20px 0;
	background: #f4f5f6; /* Nền xám nhạt như BNS */
	color: #333;
}
.bns-homepage-content img { border-radius: 4px; }
.bns-homepage-content a { text-decoration: none; color: inherit; }
.bns-homepage-content a:hover { color: #0ea5e9; }

/* Contributor Block */
.bns-contributor-block {
	border: 1px solid #10b981;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 30px;
	position: relative;
	background: #fff;
}
.bns-section-title {
	position: absolute;
	top: -15px;
	left: 50%;
	transform: translateX(-50%);
	background: #f4f5f6;
	padding: 0 15px;
	font-size: 18px;
	font-weight: 700;
	color: #333;
	margin: 0;
}
.bns-contributor-grid {
	display: flex;
	gap: 15px;
	overflow-x: auto;
	padding-top: 10px;
}
.bns-contributor-grid::-webkit-scrollbar { height: 6px; }
.bns-contributor-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.bns-contributor-item {
	flex: 0 0 calc(12.5% - 15px);
	min-width: 120px;
}
.bns-card-thumb {
	position: relative;
	aspect-ratio: 2/3;
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.bns-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bns-full-badge {
	position: absolute;
	top: 0;
	left: 0;
	background: #ef4444;
	color: #fff;
	font-size: 10px;
	font-weight: bold;
	padding: 2px 6px;
	border-bottom-right-radius: 4px;
	z-index: 2;
}
.bns-vertical-badge { background: rgba(0,0,0,0.6); writing-mode: vertical-rl; text-orientation: mixed; right: 0; left: auto; top: 0; bottom: 0; border-radius: 0; padding: 5px 2px; }
.bns-novel-title {
	font-size: 14px;
	font-weight: 600;
	margin-top: 8px;
	line-height: 1.4;
	text-align: center;
}

/* Main Layout */
.bns-main-layout {
	display: flex;
	gap: 20px;
}
.bns-sidebar { flex: 0 0 280px; }
.bns-content { flex: 1; min-width: 0; }

/* Sidebar Widgets */
.bns-sidebar-widget {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	margin-bottom: 20px;
	overflow: hidden;
}
.bns-widget-title {
	font-size: 16px;
	font-weight: 700;
	padding: 12px 15px;
	margin: 0;
	border-bottom: 1px solid #e5e7eb;
}
.bns-list-new, .bns-list-chapters { list-style: none; padding: 0; margin: 0; }
.bns-list-new li {
	display: flex;
	gap: 10px;
	padding: 12px 15px;
	border-bottom: 1px dashed #e5e7eb;
}
.bns-list-new li:last-child { border-bottom: none; }
.bns-list-thumb { flex: 0 0 40px; }
.bns-list-thumb img { width: 40px; height: 55px; object-fit: cover; border-radius: 2px; }
.bns-list-info h4 { font-size: 13px; margin: 0 0 4px 0; line-height: 1.4; }
.bns-list-info .bns-author { font-size: 11px; color: #6b7280; }

.bns-list-chapters li {
	display: flex;
	justify-content: space-between;
	padding: 10px 15px;
	border-bottom: 1px dashed #e5e7eb;
	font-size: 13px;
}
.bns-list-chapters li:last-child { border-bottom: none; }
.bns-chap-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }

/* Section Header */
.bns-section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	border-bottom: 2px solid #e5e7eb;
	padding-bottom: 8px;
}
.bns-main-title { font-size: 20px; font-weight: 700; margin: 0; }
.bns-view-more { font-size: 13px; color: #0ea5e9; font-weight: 500; }

/* Grid Cards */
.bns-grid-2col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 15px;
	margin-bottom: 30px;
}
.bns-grid-3col {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 15px;
}
.bns-detailed-card {
	display: flex;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 10px;
	gap: 15px;
	transition: box-shadow 0.2s;
}
.bns-detailed-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.bns-detailed-card .bns-card-thumb { flex: 0 0 100px; height: 140px; }
.bns-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bns-card-info h3 { font-size: 16px; margin: 0 0 5px 0; line-height: 1.4; }
.bns-meta-small { display: flex; flex-direction: column; gap: 4px; font-size: 12px; margin-bottom: 8px; }
.bns-meta-small .bns-author { color: #6b7280; }
.bns-stats { display: flex; gap: 10px; font-weight: 500; }

.bns-excerpt {
	font-size: 12px;
	color: #4b5563;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Ribbon */
.bns-ribbon {
	position: absolute;
	right: 0;
	bottom: 0;
	background: #dc2626;
	color: #fff;
	font-size: 11px;
	font-weight: bold;
	padding: 3px 10px;
	border-top-left-radius: 8px;
	z-index: 2;
}
.bns-ribbon-top1 { background: #dc2626; }
.bns-ribbon-top2 { background: #ea580c; }
.bns-ribbon-top3 { background: #d97706; }
.bns-ribbon-top4, .bns-ribbon-top5, .bns-ribbon-top6 { background: #b91c1c; }

/* 3 Columns Rankings */
.bns-3-cols {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 20px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 20px;
}
.bns-ranking-title { font-size: 16px; font-weight: 700; margin: 0 0 15px 0; text-align: center; }
.bns-ranking-list { list-style: none; padding: 0; margin: 0; }
.bns-rank-top1 {
	display: flex;
	gap: 10px;
	margin-bottom: 15px;
	align-items: center;
}
.bns-rank-num { font-size: 18px; font-weight: 900; color: #cbd5e1; font-style: italic; width: 20px; text-align: center; }
.bns-num-1 { color: #ef4444; }
.bns-num-2 { color: #f97316; }
.bns-num-3 { color: #f59e0b; }
.bns-rank-info { flex: 1; min-width: 0; }
.bns-rank-info h4 { font-size: 14px; margin: 0 0 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bns-tag { display: inline-block; padding: 2px 6px; background: #ecfdf5; color: #10b981; border-radius: 4px; font-size: 10px; margin-top: 4px;}
.bns-rank-thumb { flex: 0 0 45px; }
.bns-rank-thumb img { width: 45px; height: 60px; object-fit: cover; border-radius: 4px; }

.bns-rank-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-top: 1px dashed #e5e7eb;
	font-size: 14px;
}
.bns-rank-item a { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bns-rank-dash { color: #9ca3af; }

/* Dark Mode Support */
body.theme-dark .bns-homepage-content { background: var(--background-dark); color: #fff; }
body.theme-dark .bns-contributor-block, body.theme-dark .bns-sidebar-widget, body.theme-dark .bns-detailed-card, body.theme-dark .bns-3-cols { background: var(--surface-dark); border-color: var(--border-color); }
body.theme-dark .bns-section-title { background: var(--background-dark); color: #fff; }
body.theme-dark .bns-widget-title { border-color: var(--border-color); background: var(--surface-lighter) !important; color: #fff;}
body.theme-dark .bns-list-new li, body.theme-dark .bns-list-chapters li, body.theme-dark .bns-section-header, body.theme-dark .bns-rank-item { border-color: var(--border-color); }
body.theme-dark .bns-excerpt { color: #9ca3af; }

@media (max-width: 992px) {
	.bns-main-layout { flex-direction: column; }
	.bns-sidebar { flex: auto; width: 100%; display: flex; gap: 15px;}
	.bns-sidebar-widget { flex: 1; }
	.bns-grid-2col, .bns-grid-3col { grid-template-columns: 1fr; }
	.bns-3-cols { grid-template-columns: 1fr; gap: 15px; }
}
@media (max-width: 768px) {
	.bns-sidebar { flex-direction: column; }
	.bns-contributor-item { flex: 0 0 35%; }
}
