body { background: #f8f9fa; }
body.theme-dark { background: #0b1220; }
.topbar-avatar {
	width: 24px;
	height: 24px;
	border-radius: 999px;
	object-fit: cover;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
.topbar-avatar-placeholder {
	width: 24px;
	height: 24px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.72rem;
	font-weight: 600;
	color: #334155;
	background: #e2e8f0;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
body.theme-dark .topbar-avatar-placeholder {
	color: #e2e8f0;
	background: #1f2937;
	box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.theme-toggle-btn {
	border: none;
	background: transparent;
	color: #475569;
}

.theme-toggle-btn:focus {
	box-shadow: none;
}

.theme-toggle-btn:hover {
	background: transparent;
}

body.theme-dark .theme-toggle-btn {
	color: #e2e8f0;
}
.profile-avatar-box {
	width: clamp(120px, 16vw, 200px);
	height: clamp(120px, 16vw, 200px);
	overflow: hidden;
	background: #f8f9fa;
	border-color: #e5e7eb;
}
.profile-avatar-img {
	width: 100%;
	height: 100%;
	max-width: 200px;
	max-height: 200px;
	object-fit: cover;
	border-radius: 12px;
}
.avatar-gallery-thumb {
	width: clamp(72px, 12vw, 96px);
	height: clamp(72px, 12vw, 96px);
	object-fit: cover;
	border-radius: 10px;
}
.reader-toolbar { position: sticky; top: 0; z-index: 5; background: #f8f9fa; padding: 6px 0; }
.toolbar-row { display: flex; align-items: center; gap: 10px; max-width: 1200px; margin: 0 auto; padding: 0 0px; }
.reader-toolbar-left, .reader-toolbar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.reader-toolbar-center { flex: 1 1 auto; display: flex; justify-content: center; align-items: center; gap: 12px; }
.reader-toolbar .btn { min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0.12rem 0.45rem; font-size: 0.88rem; }
.reader-toolbar .btn i { font-size: 0.95rem; }
.reader-toolbar .input-group { margin: 0 8px; }
.reader-progress { height: 4px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.reader-progress-bar { height: 4px; background: #4f46e5; transition: width .2s ease; }
.reader-title { font-weight: 600; font-size: 1rem; color: #111827; }
.reader-header { max-width: 1200px; margin: 0 auto 8px; position: relative; display: flex; align-items: center; justify-content: center; padding: 8px 0; }
.reader-header .reader-back { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
.reader-header .reader-mobile-actions { display: none; position: absolute; right: 0; gap: 6px; align-items: center; }
.reader-header .reader-title { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-weight: 600; text-align: center; padding: 0 10px; box-sizing: border-box; border: none; border-radius: 0; background: transparent; z-index: 2; max-width: none; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; height: 40px; line-height: 1; }
.reader-header .reader-actions { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: inline-flex; gap: 8px; align-items: center; }

/* Next chapter button in header (right corner) */
.reader-header .reader-next { position: absolute; right: 0; top: 50%; transform: translateY(-50%); margin-right: 0; }
/* ensure the next button doesn't touch other elements when container has inner padding */
.reader-header .reader-next > i { margin-left: 6px; }

/* Ensure dropdowns inside the reader header appear above reader controls */
.reader-header { overflow: visible; }
.reader-header .btn-group .dropdown-menu { z-index: 3050; }
.reader-frame { min-height: 50vh; width: 100%; max-width: 1200px; margin: 0 auto; border: 1px solid #e5e7eb; background: #111827; border-radius: 10px; display: flex; justify-content: center; align-items: flex-start; padding: 10px; overflow: auto; }
.reader-frame img { max-width: 100%; height: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.35); border-radius: 8px; transition: transform .2s ease; }
.reader-frame canvas { max-width: 100%; height: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.35); border-radius: 8px; background: #fff; }
.reader-frame.scroll-mode { display: block; }
.reader-frame.scroll-mode img { width: 100%; max-width: 900px; margin: 0 auto 20px; display: block; }
.reader-frame.scroll-mode canvas { width: 100%; max-width: 900px; margin: 0 auto 20px; display: block; }

/* center controls spacing refinement */
.reader-center-controls { gap: 12px; }

/* increase separation between toolbar and header/content */
.reader-toolbar { padding-top: 8px; padding-bottom: 8px; }
.reader-overlay { position: sticky; top: 45%; left: 0; right: 0; margin: 0 auto; max-width: 220px; text-align: center; background: rgba(17,24,39,0.85); color: #fff; padding: 8px 12px; border-radius: 999px; font-size: 0.85rem; z-index: 3; }
.reader-toolbar .btn { padding: 2px 8px; font-size: 0.85rem; }
.reader-toolbar select, .reader-toolbar input[type="range"] { font-size: 0.85rem; }
.reader-toolbar #readerLights { border-color: #1f2937; color: #1f2937; }

/* Center controls container in reader toolbar */
.reader-center-controls { flex: 0 0 auto; }
.reader-toolbar #readerLights:hover { background: #1f2937; color: #fff; }
.reader-toolbar #pageNumber { width: 48px !important; }
.reader-toolbar #pageTotal, .reader-toolbar .input-group-text { padding: 0.15rem 0.4rem; font-size: 0.8rem; }
#readerWrap.lights-off, body.lights-off { background: #0b0f19; }
body.lights-off .reader-toolbar { background: #0b0f19; }
body.lights-off .reader-frame { background: #000; border-color: #111827; }
#readerWrap:fullscreen .reader-toolbar { position: sticky; top: 0; background: #f8f9fa; padding-top: 8px; }
#readerWrap:fullscreen .reader-toolbar > .d-flex,
#readerWrap:fullscreen .reader-toolbar .reader-progress { max-width: 1200px; margin: 0 auto; }
#readerWrap:fullscreen .reader-frame { min-height: 88vh; }

/* reader wrapper to anchor overlay controls */
#readerWrap { position: relative; }

/* footer under reader (outside frame) */
.reader-footer { max-width: 1200px; margin: 10px auto 0; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 6px 0; }
.reader-footer .input-group { box-shadow: 0 6px 20px rgba(0,0,0,0.35); background: #ffffff; border-radius: 8px; padding: 6px; }
.reader-footer .input-group .input-group-text { background: transparent; border: none; font-weight: 600; }
.reader-footer .form-control { border: none; outline: none; box-shadow: none; font-size: 1rem; }
.reader-footer #pageNumber { width: 90px; }
.reader-footer #pageTotal { padding-left: 10px; padding-right: 10px; }
.reader-end-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.reader-end-actions .btn { display: inline-flex; align-items: center; }


/* scroll-to-top overlay button (visible in scroll mode) */
.reader-scroll-top { position: absolute; right: 18px; bottom: 110px; z-index: 60; border-radius: 999px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0,0,0,0.28); }
.reader-scroll-top i { font-size: 1rem; }

@media (max-width: 768px) {
	.reader-toolbar .reader-download { display: none; }
	.reader-toolbar { display: none; }
	.reader-footer { display: none; }
	.reader-end-actions { display: none; }
	.reader-header { padding: 6px 0; justify-content: flex-start; }
	.reader-header .reader-back { position: static; transform: none; }
	.reader-header .reader-title { position: static; transform: none; max-width: 100%; white-space: normal; height: auto; padding: 0; text-align: left; }
	.reader-header .reader-mobile-actions { display: inline-flex; position: static; margin-left: auto; }
}

/* EPUB reader layout */
.epub-reader { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 520px; }
.epub-topbar, .epub-bottombar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-bottom: 1px solid #ddd;
	background: #fff;
}
.epub-bottombar { border-top: 1px solid #ddd; border-bottom: none; }
.epub-title { flex: 1; text-align: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epub-main { flex: 1 1 auto; min-height: 0; }
.epub-viewer { height: 100%; width: 100%; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.epub-bottombar input[type="range"] { flex: 1; }
.epub-status { padding: 0 12px 8px; font-size: 0.85rem; }


/* Library grid improvements */
.library-card { color: inherit; }
.library-card .card-img-wrap { position: relative; width: 100%; padding-top: 72%; background: #1f2937; border-top-left-radius: .5rem; border-top-right-radius: .5rem; overflow: hidden; }
.library-card .card-img-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .28s ease, filter .28s ease; display: block; }
.library-card:hover .card-img-wrap img { transform: scale(1.03); filter: brightness(1.04) contrast(1.04) saturate(1.02); }
.library-card .card-img-wrap img { box-shadow: 0 1px 6px rgba(0,0,0,0.12); filter: brightness(1.02) saturate(1.02); }
.library-card .card-body { min-height: 72px; display: flex; align-items: center; justify-content: center; }
.library-list-card { border-radius: 12px; box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08); }
.library-list-card .card-body { padding: 0.9rem 1rem; }
.library-list-card .card-footer { padding: 0 1rem 0.9rem; }
.library-card-row { min-width: 0; }
.library-card-badges .badge { font-size: 0.72rem; }
.series-line { flex-wrap: nowrap; min-width: 0; }
.series-title-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.series-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.series-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.series-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-card.app-card { background: transparent; box-shadow: none; padding: 0; }
.section-card.app-card .news-title-box { background: transparent; padding: 0; margin-bottom: 10px; }
.section-card.app-card .breadcrumb-inline { flex: 1 1 auto; min-width: 0; }
.section-card.app-card .breadcrumb-inline .breadcrumb { margin-bottom: 0; flex-wrap: nowrap; overflow: hidden; }
.section-card.app-card .breadcrumb-inline .breadcrumb-item { white-space: nowrap; }
body.theme-dark .breadcrumb-inline.border {
	border-color: #1f2937 !important;
	background: #0f172a !important;
}
body.theme-dark .breadcrumb a { color: #cbd5e1; }
body.theme-dark .breadcrumb .active { color: #e5e7eb; }
body.theme-dark .btn-ghost { border-color: #1f2937; color: #e5e7eb; }
body.theme-dark .btn-ghost:hover { background: #111827; }
body.theme-dark .topbar-search input {
	background: #0f172a;
	border-color: #1f2937;
	color: #e5e7eb;
}
body.theme-dark .topbar-search i { color: #94a3b8; }
body.theme-dark .topbar-search:focus-within { background: #0f172a; border-color: #1f2937; }
body.theme-dark .library-list-card { border-color: #1f2937; }
body.theme-dark .library-card,
body.theme-dark .library-list-card,
body.theme-dark .card {
	background: #0f172a;
	border-color: #1f2937;
	color: #e5e7eb;
}
body.theme-dark .progress {
	background: #111827;
}
.progress-bar {
	min-width: 6px;
	transition: width .6s ease;
}
body.theme-dark .text-muted,
body.theme-dark .text-body-secondary,
body.theme-dark .form-text {
	color: #94a3b8 !important;
}
body.theme-dark .text-secondary {
	color: #94a3b8 !important;
}
body.theme-dark .text-dark {
	color: #e5e7eb !important;
}
body.theme-dark .text-black-50 {
	color: #94a3b8 !important;
}
body.theme-dark a.text-muted:hover {
	color: #e5e7eb !important;
}
body.theme-dark .list-group-item-action {
	color: #e5e7eb;
}
body.theme-dark .list-group-item-action:hover,
body.theme-dark .list-group-item-action:focus {
	color: #e5e7eb;
	background: #111827;
}
body.theme-dark .card a,
body.theme-dark .news-list a {
	color: #e5e7eb;
}
body.theme-dark .card-title,
body.theme-dark .section-title,
body.theme-dark .news-title,
body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark h5,
body.theme-dark h6 {
	color: #e5e7eb;
}
body.theme-dark .card-header {
	color: #e5e7eb;
	background: #0f172a;
	border-color: #1f2937;
}
body.theme-dark .badge.bg-light {
	background: #111827 !important;
	color: #e5e7eb !important;
	border-color: #1f2937 !important;
}
body.theme-dark .table,
body.theme-dark .table tbody tr,
body.theme-dark .table tbody td,
body.theme-dark .table tbody th {
	background: #0f172a;
	color: #e5e7eb;
}
body.theme-dark .table tbody tr {
	border-bottom-color: #1f2937;
}
body.theme-dark .table thead th,
body.theme-dark .table-light > :not(caption) > * > * {
	background: #111827;
	color: #e2e8f0;
}
body.theme-dark .table-hover > tbody > tr:hover > * {
	background: #111827;
}
@media (min-width: 992px) {
	.admin-dashboard-layout {
		flex-wrap: nowrap;
	}
	.admin-dashboard-main {
		flex: 1 1 auto;
		min-width: 0;
	}
	.admin-dashboard-sidebar {
		flex: 0 0 33.333333%;
		max-width: 33.333333%;
	}
}
@media (max-width: 991.98px) {
	.admin-dashboard-sidebar {
		max-width: none;
	}
}
body:not(.theme-dark) .admin-support-table.table-hover > tbody > tr:hover > * {
	background: #f2f3f7;
	color: inherit;
}
body:not(.theme-dark) .admin-support-table.table-hover > tbody > tr:hover a {
	color: inherit;
}
/* Admin support table (dark mode) */
body.theme-dark .admin-support-table {
	color: #e5e7eb;
}
body.theme-dark .admin-support-table tbody td,
body.theme-dark .admin-support-table tbody th {
	color: #e5e7eb;
}
body.theme-dark .admin-support-table a {
	color: #e5e7eb;
}
body.theme-dark .admin-support-table a:hover {
	color: #f8fafc;
}
body.theme-dark .admin-support-table .table-warning,
body.theme-dark .admin-support-table .table-warning > * {
	background: #1f2937;
	color: #e5e7eb;
}
body.theme-dark .admin-support-table .table-secondary,
body.theme-dark .admin-support-table .table-secondary > * {
	background: #0f172a;
	color: #e5e7eb;
}
body.theme-dark .admin-support-table .table-light,
body.theme-dark .admin-support-table .table-light > * {
	background: #0b1220;
	color: #e5e7eb;
}
body.theme-dark .badge.text-dark {
	color: #111827 !important;
}
.login-fail-label {
	display: inline-block;
	max-width: 220px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.lock-toggle-btn {
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
body.theme-dark .pagination .page-link {
	background: #0f172a;
	border-color: #1f2937;
	color: #e5e7eb;
}
body.theme-dark .pagination .page-item.active .page-link {
	background: #1f2937;
	border-color: #334155;
	color: #e5e7eb;
}
body.theme-dark .pagination .page-item.disabled .page-link {
	background: #0b1220;
	border-color: #1f2937;
	color: #64748b;
}
body.theme-dark .card .form-control,
body.theme-dark .card .form-select,
body.theme-dark .card .form-check-input,
body.theme-dark .card .form-check-label {
	color: #e5e7eb;
}
body.theme-dark .card .form-control,
body.theme-dark .card .form-select {
	background: #0b1220;
	border-color: #1f2937;
}
body.theme-dark .card .form-control::placeholder { color: #64748b; }
body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark textarea.form-control {
	background: #0b1220;
	border-color: #1f2937;
	color: #e5e7eb;
}
body.theme-dark .form-control::placeholder,
body.theme-dark textarea.form-control::placeholder {
	color: #64748b;
}
body.theme-dark .bg-white { background: #0f172a !important; }
body.theme-dark .border { border-color: #1f2937 !important; }
body.theme-dark .profile-avatar-box {
	background: #0b1220;
	border-color: #1f2937;
}
body.theme-dark .reader-toolbar { background: #0f172a; }
body.theme-dark .reader-progress { background: #1f2937; }
body.theme-dark .reader-title { color: #e5e7eb; }
body.theme-dark .reader-frame { border-color: #1f2937; }
body.theme-dark .reader-footer .input-group { background: #0f172a; }
body.theme-dark .epub-viewer { background: #0f172a; border-color: #1f2937; }
body.theme-dark .epub-topbar,
body.theme-dark .epub-bottombar {
	background: #0f172a;
	border-color: #1f2937;
}
body.theme-dark .reader-footer .input-group,
body.theme-dark .reader-footer .form-control,
body.theme-dark .reader-footer .input-group-text {
	color: #e5e7eb;
}
body.theme-dark .reader-footer .form-control::placeholder {
	color: #94a3b8;
}
body.theme-dark .pdf-viewer-dialog { background: #0f172a; color: #e5e7eb; }
body.theme-dark .pdf-viewer-header { border-bottom-color: #1f2937; }
body.theme-dark .pdf-viewer-actions .btn { border-color: #334155; color: #e5e7eb; }
body.theme-dark .loja-card {
	background: #0f172a;
	border-color: #1f2937;
	box-shadow: none;
}
body.theme-dark .loja-card .card-body {
	color: #e5e7eb;
}
body.theme-dark .loja-card .text-muted {
	color: #94a3b8 !important;
}
body.theme-dark .loja-card .form-control,
body.theme-dark .loja-card .form-select {
	background: #0b1220;
	border-color: #1f2937;
	color: #e5e7eb;
}
body.theme-dark .loja-card .form-control::placeholder {
	color: #64748b;
}
body.theme-dark .loja-card .alert {
	background: #0b1220;
	border-color: #1f2937;
	color: #e5e7eb;
}

/* Admin category thumbnail */
.admin-banner-thumb { width: 160px; height: 90px; object-fit: cover; object-position: center; border-radius: 6px; box-shadow: 0 1px 6px rgba(0,0,0,0.18); filter: brightness(1.06) saturate(1.03); display: block; }

/* Navbar logo */
.navbar-brand { position: relative; }
.navbar-logo { height: 58px; width: auto; object-fit: contain; display: block; position: relative; top: 0px; }
.navbar-logo-preview { max-height: 28px; height: 28px; width: auto; object-fit: contain; display: block; }

/* Lateral menu button */
.menu-side-btn {
	width: 31px;
	height: 31px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}


/* Dashboard list font size */
.dashboard-list .list-group-item {
	font-size: 0.95rem;
}

/* Admin users table row height */
.admin-users-table tbody td {
	padding-top: 0.35rem;
	padding-bottom: 0.35rem;
	vertical-align: middle;
}
.admin-users-table th,
.admin-users-table td {
	padding-left: 0.5rem;
	padding-right: 0.5rem;
}
.admin-users-table .btn {
	padding: 0.2rem 0.5rem;
	font-size: 0.78rem;
}
.admin-users-table .admin-actions {
	white-space: nowrap;
}

/* Admin users dots */
.legend-dot,
.tier-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 1px solid transparent;
	margin-right: 4px;
	vertical-align: middle;
}


/* Limit header width so it never exceeds 1200px on very large screens */
nav.navbar .container {
	max-width: 1200px;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

/* Limit main content width to 1200px so pages don't stretch on very large screens */
main.container {
	max-width: 1200px;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}


/* Library grid wrapper */
.library-grid-wrapper { width: 100%; }

@media (max-width: 768px) {
	.library-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
	.library-card .card-body { min-height: 56px; font-size: 0.95rem; }
	.library-list-card { box-shadow: none; border: 1px solid #e5e7eb; border-radius: 10px; }
	.library-list-card .card-body { padding: 0.65rem 0.75rem; }
	.library-list-card .card-footer { padding: 0 0.75rem 0.65rem; }
	.library-card-row { flex-wrap: wrap; }
	.library-card-row .btn { margin-top: 2px; }
	.library-card-badges { gap: 0.35rem; }
}

/* Login logo */
.login-logo {
	vertical-align: middle;
	width: 480px;
	max-width: 100%;
	height: auto;
	padding: 48px;
	display: inline-block;
}

/* PDF modal */
.pdf-viewer-modal {
	position: fixed !important;
	inset: 0 !important;
	background: rgba(0,0,0,0.6);
	z-index: 1050;
	display: none;
	align-items: center;
	justify-content: center;
}
.pdf-viewer-modal.is-open {
	display: flex;
}
.pdf-viewer-dialog {
	background: #fff;
	border-radius: 6px;
	max-width: 1200px;
	width: 95%;
	max-height: 90vh;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.pdf-viewer-dialog.is-expanded {
	width: 100vw;
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	border-radius: 0;
}
.pdf-viewer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .5rem .75rem;
	border-bottom: 1px solid #e9ecef;
	gap: 12px;
}
.pdf-viewer-title {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.pdf-viewer-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
}
.pdf-viewer-body {
	height: 80vh;
}
.pdf-viewer-dialog.is-expanded .pdf-viewer-body {
	height: calc(100vh - 48px);
}
.pdf-viewer-frame {
	border: 0;
	width: 100%;
	height: 100%;
}

