/* =============================================================
   Aquareader — Reader Page Styles
   All selectors scoped to body.aqua-reader-page (set in functions.php)
   to prevent any bleed onto non-reader pages.
   ============================================================= */

/* ── Suppress parent theme sticky nav + tap-stealing overlays ── */
#manga-reading-nav-head {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    visibility: hidden !important;
}
.page-prev-link,
.page-next-link {
    display: none !important;
    pointer-events: none !important;
}
#aqua-reader-topbar,
#aqua-reader-bottombar {
    z-index: 99999 !important;
}

/* ── Screen-reader only utility (hides chapter h1 visually) ─── */
.aqua-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── Chrome suppression ─────────────────────────────────────── */
.aqua-reader-page .site-header,
.aqua-reader-page #secondaryNav,
.aqua-reader-page .c-header__top,
.aqua-reader-page .page-header,
.aqua-reader-page .c-breadcrumb,
.aqua-reader-page .breadcrumb-wrap,
.aqua-reader-page .announcements-wrap,
.aqua-reader-page .c-footer,
.aqua-reader-page footer.site-footer { display: none !important; }

/* Hide Madara's native chapter panels (prevent duplicates) */
.aqua-reader-page .c-chapter-list,
.aqua-reader-page #chapter-list,
.aqua-reader-page .wp-manga-chapter-list-all,
.aqua-reader-page .modal-content .c-modal__body .chapter-list {
	display: none !important;
}

/* Prevent WP admin bar from pushing the layout */
.aqua-reader-page html,
.aqua-reader-page body {
	margin-top: 0 !important;
	padding-top: 0 !important;
}
/* Admin bar still renders, but floats without shifting document */
.aqua-reader-page #wpadminbar { position: fixed !important; }

/* Dark reading background */
.aqua-reader-page body,
.aqua-reader-page .c-page-content,
.aqua-reader-page .content-area,
.aqua-reader-page .read-container,
.aqua-reader-page .reading-content,
.aqua-reader-page .page-break { background: #111 !important; }

/* Remove container padding so images go edge-to-edge on mobile */
.aqua-reader-page .container { padding-left: 0 !important; padding-right: 0 !important; }
.aqua-reader-page .row { margin-left: 0 !important; margin-right: 0 !important; }
.aqua-reader-page .main-col { padding-left: 0 !important; padding-right: 0 !important; }

/* Hide the hidden Madara nav visually (WP Manga JS still reads it) */
.aqua-nav-source {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	pointer-events: none !important;
}

/* ── Top bar ────────────────────────────────────────────────── */
.aqua-reader-topbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	min-height: 52px;
	background: rgba(17, 17, 17, 0.97);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Bars hidden state (start hidden on load) */
.aqua-reader-topbar.bars-hidden {
	opacity: 0;
	pointer-events: none;
	transform: translateY(-100%);
}

.aqua-reader-bottombar.bars-hidden {
	opacity: 0;
	pointer-events: none;
	transform: translateY(100%);
}

/* Admin bar offset */
.admin-bar .aqua-reader-topbar {
	top: 32px;
}
@media screen and (max-width: 782px) {
	.admin-bar .aqua-reader-topbar {
		top: 46px;
	}
}

.aqua-reader-topbar__home {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	color: #fff;
	transition: background 0.15s;
}
.aqua-reader-topbar__home:hover { background: rgba(255, 255, 255, 0.1); }

.aqua-reader-topbar__thumb {
	flex-shrink: 0;
	width: 28px;
	height: 40px;
	object-fit: cover;
	border-radius: 3px;
}

.aqua-reader-topbar__meta {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.aqua-reader-topbar__title {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #fff !important;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
	transition: color 0.2s ease;
}

.aqua-reader-topbar__title:hover {
	color: #48CAE4 !important;
}

.aqua-reader-topbar__chapter {
	display: block;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.5);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

.aqua-reader-topbar__actions { flex-shrink: 0; display: flex; gap: 4px; }

/* ── Chapter progress (count pill + bar) ─────────────────────────── */
.aqua-reader-topbar__chapline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.aqua-reader-topbar__chapline .aqua-reader-topbar__chapter { flex: 1 1 auto; min-width: 0; }
.aqua-reader-topbar__count {
	flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
	font-size: 10px; font-weight: 700; color: #48CAE4;
	background: rgba(72,202,228,0.12); border: 1px solid rgba(72,202,228,0.25);
	padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.4;
}
.aqua-reader-topbar__left { font-style: normal; font-weight: 500; color: rgba(255,255,255,0.45); }
@media screen and (max-width: 360px) { .aqua-reader-topbar__left { display: none; } }
.aqua-reader-topbar__progress {
	position: absolute; left: 0; bottom: 0; width: 100%; height: 3px;
	background: rgba(255,255,255,0.08); overflow: hidden;
}
.aqua-reader-topbar__progress-fill {
	display: block; height: 100%;
	background: linear-gradient(90deg, #48CAE4 0%, #00B4D8 100%);
	border-radius: 0 3px 3px 0; transition: width 0.3s ease;
}

.aqua-reader-topbar__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	background: transparent;
	color: rgba(255, 255, 255, 0.75);
	border-radius: 8px;
	cursor: pointer;
	padding: 0;
	transition: background 0.15s, color 0.15s;
}
.aqua-reader-topbar__btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ── Reading content area ───────────────────────────────────── */
.aqua-reader-page .entry-content,
.aqua-reader-page .entry-content_wrap { padding: 0 !important; margin: 0 !important; }

.aqua-reader-page .reading-content {
	padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 20px) !important;
}

/* Manga images — centred, max-width capped */
.aqua-reader-page .wp-manga-chapter-img {
	display: block !important;
	max-width: 800px;
	width: 100% !important;
	height: auto !important;
	margin: 0 auto !important;
}

/* Remove spacing between page-break divs */
.aqua-reader-page .page-break { margin: 0 !important; padding: 0 !important; }

/* ── Sticky bottom bar ──────────────────────────────────────── */
.aqua-reader-bottombar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	display: flex;
	align-items: stretch;
	height: 56px;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	background: rgba(15, 15, 15, 0.98);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.aqua-reader-bottombar__btn {
	flex: 0 0 76px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	text-decoration: none;
	transition: background 0.15s, opacity 0.15s;
	padding: 0 10px;
}
.aqua-reader-bottombar__btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.aqua-reader-bottombar__btn.is-disabled {
	opacity: 0.3;
	pointer-events: none;
	cursor: default;
}

.aqua-reader-bottombar__chapters {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	font-size: 13px;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.9);
	background: none;
	border: none;
	border-left: 1px solid rgba(255, 255, 255, 0.08);
	border-right: 1px solid rgba(255, 255, 255, 0.08);
	cursor: pointer;
	padding: 0;
	transition: background 0.15s;
}
.aqua-reader-bottombar__chapters:hover { background: rgba(255, 255, 255, 0.06); }

/* ── Chapter panel (bottom sheet) ───────────────────────────── */
.aqua-chapter-panel {
	position: fixed;
	inset: 0;
	z-index: 1100;
	pointer-events: none;
}
.aqua-chapter-panel.is-open { pointer-events: all; }

.aqua-chapter-panel__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	opacity: 0;
	transition: opacity 0.25s;
}
.aqua-chapter-panel.is-open .aqua-chapter-panel__backdrop { opacity: 1; }

.aqua-chapter-panel__sheet {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	max-height: 72vh;
	background: #1c1c1e;
	border-radius: 16px 16px 0 0;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	overflow: hidden;
}
.aqua-chapter-panel.is-open .aqua-chapter-panel__sheet { transform: translateY(0); }

.aqua-chapter-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	flex-shrink: 0;
}
.aqua-chapter-panel__title { font-size: 15px; font-weight: 700; color: #fff; }
.aqua-chapter-panel__close {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.55);
	cursor: pointer;
	padding: 4px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	transition: color 0.15s;
}
.aqua-chapter-panel__close:hover { color: #fff; }

.aqua-chapter-panel__list {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	flex: 1;
	padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
}

/* Chapter list structure */
.aqua-chapter-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.aqua-chapter-list li {
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.aqua-chapter-list a {
	display: block;
	padding: 12px 20px;
	font-size: 14px;
	color: #e0e0e0 !important;
	text-decoration: none !important;
	transition: background 0.15s, color 0.15s;
}

.aqua-chapter-list a:hover {
	background: rgba(255, 255, 255, 0.06);
	color: #FFD700 !important;
}

.aqua-chapter-list li.current a {
	color: #fff !important;
	background: #005F99;
	font-weight: 600;
}

/* Legacy item class for backwards compat */
.aqua-chapter-panel__item {
	display: flex;
	align-items: center;
	padding: 12px 20px;
	font-size: 14px;
	color: #e0e0e0 !important;
	text-decoration: none !important;
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
	transition: background 0.1s;
}
.aqua-chapter-panel__item:hover { background: rgba(255, 255, 255, 0.06); color: #48CAE4 !important; }
.aqua-chapter-panel__item.is-current { 
	color: #fff !important;
	background: #005F99;
	font-weight: 600;
}

/* ── End-of-chapter card ────────────────────────────────────── */
.aqua-eoc {
	max-width: 520px;
	margin: 40px auto 0;
	padding: 28px 24px;
	background: #1c1c1e;
	border-radius: 14px;
	text-align: center;
}

.aqua-eoc__series {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 24px;
	text-align: left;
}

.aqua-eoc__thumb {
	flex-shrink: 0;
	width: 80px;
	height: 112px;
	object-fit: cover;
	border-radius: 6px;
}

.aqua-eoc__meta { flex: 1; min-width: 0; }

.aqua-eoc__caught {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.45);
	margin: 0 0 6px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.aqua-eoc__title {
	display: block;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	line-height: 1.3;
	margin-bottom: 4px;
}

.aqua-eoc__chapter { font-size: 12px; color: rgba(255, 255, 255, 0.4); }

.aqua-eoc__actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
}

.aqua-eoc__btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 10px 20px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.15s, transform 0.1s;
}
.aqua-eoc__btn:hover { opacity: 0.82; transform: translateY(-1px); text-decoration: none; }
.aqua-eoc__btn--series { background: rgba(255, 255, 255, 0.13); color: #fff; }
.aqua-eoc__btn--home   { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.65); }
.aqua-eoc__btn--next   {
	width: 100%;
	justify-content: center;
	margin-top: 12px;
	background: #e63946;
	color: #fff;
}
.aqua-eoc__btn--next:hover { color: #fff; }

/* ── Tap to show controls hint (Asura-style) ────────────────── */
.aqua-tap-hint {
	position: fixed;
	bottom: 80px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(30, 30, 30, 0.85);
	color: #fff;
	padding: 10px 28px;
	border-radius: 24px;
	font-size: 14px;
	font-weight: 500;
	z-index: 99999;
	pointer-events: none;
	/* Continuous pulse — never stops until dismissed */
	animation: tapHintPulse 1.5s ease-in-out infinite;
	transition: opacity 0.5s ease;
}

.aqua-tap-hint.fade-out {
	opacity: 0;
	animation: none;
}

/* Glow pulses brightness up and down continuously */
@keyframes tapHintPulse {
	0% {
		box-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
		opacity: 0.7;
	}
	50% {
		box-shadow: 0 0 20px rgba(255, 255, 255, 0.5),
					0 0 40px rgba(255, 255, 255, 0.2);
		opacity: 1;
	}
	100% {
		box-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
		opacity: 0.7;
	}
}

/* ── Scroll to top button ───────────────────────────────────── */
.aqua-scroll-top {
	position: fixed !important;
	bottom: 70px !important;
	right: 24px !important;
	width: 42px !important;
	height: 42px !important;
	border-radius: 50% !important;
	background: #005F99 !important;
	color: #fff !important;
	border: none !important;
	cursor: pointer !important;
	z-index: 9998 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: 0 2px 12px rgba(72, 202, 228, 0.35) !important;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.15s ease;
	font-size: 0 !important;
	line-height: 0 !important;
	padding: 0 !important;
}

.aqua-scroll-top svg {
	display: block;
	flex-shrink: 0;
}

.aqua-scroll-top.visible {
	opacity: 1 !important;
	pointer-events: all !important;
}

.aqua-scroll-top:hover {
	transform: translateY(-2px);
	background: #0077bb !important;
	box-shadow: 0 4px 16px rgba(72, 202, 228, 0.5) !important;
}

/* ── Bottom chapter navigation (after last image) ───────────── */
.aqua-chapter-nav-bottom {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	max-width: 800px;
	margin: 20px auto 24px auto;
	padding: 0 20px;
}

.aqua-nav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 28px;
	border-radius: 6px;
	background: #005F99;
	color: #fff !important;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	transition: all 0.2s ease;
	border: none;
	cursor: pointer;
}

.aqua-nav-btn svg {
	flex-shrink: 0;
}

.aqua-nav-btn:hover {
	background: #0077bb;
	transform: translateY(-1px);
}

.aqua-nav-btn.disabled {
	background: #333 !important;
	opacity: 0.5;
	pointer-events: none;
	cursor: not-allowed;
}

@media (max-width: 480px) {
	.aqua-chapter-nav-bottom {
		padding: 0 12px;
	}
	
	.aqua-nav-btn {
		padding: 10px 20px;
		font-size: 14px;
	}
}

/* ── EOC card spacing fix ──────────────────────────────────── */
.aqua-eoc {
	margin-bottom: 12px !important;
}

/* ── Continue Reading Banner ────────────────────────────────── */
.aqua-continue-banner {
	position: fixed;
	bottom: 72px;
	left: 50%;
	transform: translateX(-50%);
	background: #005F99;
	color: #fff;
	padding: 10px 16px 10px 20px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	z-index: 99999;
	white-space: nowrap;
	box-shadow: 0 4px 20px rgba(72, 202, 228, 0.35);
	animation: bannerSlideUp 0.3s ease;
}

@keyframes bannerSlideUp {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

.aqua-continue-banner .continue-arrow {
	font-size: 18px;
	line-height: 1;
}

.aqua-continue-banner .continue-text {
	flex: 1;
}

.aqua-continue-banner .continue-close {
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: #fff;
	font-size: 14px;
	cursor: pointer;
	padding: 2px 6px;
	border-radius: 4px;
	line-height: 1;
	transition: background 0.2s ease;
}

.aqua-continue-banner .continue-close:hover {
	background: rgba(255, 255, 255, 0.35);
}

.aqua-continue-banner__close svg {
	width: 14px;
	height: 14px;
}

@media (max-width: 480px) {
	.aqua-continue-banner {
		bottom: 70px;
		padding: 12px 16px;
	}
	
	.aqua-continue-banner__content {
		font-size: 14px;
	}
}

/* ── Comments section (below chapter images) ────────────────── */
.aqua-reader-page .aqua-reader-comments {
	display: block !important;
	max-width: 800px;
	margin: 12px auto 0 auto !important;
	padding: 16px !important;
	padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	background: #12121a;
}

/* Ensure all comment elements are visible and readable */
.aqua-reader-page .entry-comments,
.aqua-reader-page .comment-wrap,
.aqua-reader-page #comments,
.aqua-reader-page .wpd-thread-head,
.aqua-reader-page .wpd-comment,
.aqua-reader-page .wpd-comment-wrap {
	display: block !important;
	visibility: visible !important;
}

/* Ensure comment text is readable on the dark reader background.
   (dark-theme.css maps these globally; this re-asserts them inside the
   reader's #111 surface in case of specificity collisions.) */
.aqua-reader-page .aqua-reader-comments,
.aqua-reader-page .aqua-reader-comments p,
.aqua-reader-page .aqua-reader-comments .comment-text,
.aqua-reader-page .aqua-reader-comments .comment-content,
.aqua-reader-page .aqua-reader-comments .comment-author,
.aqua-reader-page .aqua-reader-comments .wpd-comment-text,
.aqua-reader-page .aqua-reader-comments li,
.aqua-reader-page .aqua-reader-comments span {
	color: #e0e0e0 !important;
}
.aqua-reader-page .aqua-reader-comments a { color: #48CAE4 !important; }
.aqua-reader-page .aqua-reader-comments input,
.aqua-reader-page .aqua-reader-comments textarea {
	background: #1a1d2e !important;
	border: 1px solid rgba(255, 255, 255, 0.12) !important;
	color: #e0e0e0 !important;
}

/* ── Sticky ad: must clear the bottom bar ───────────────────── */
.aqua-reader-page .maai-ad--sticky { bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important; }

/* ── Top bar title link ─────────────────────────────────────── */
.aqua-reader-topbar__title-link {
	color: #fff;
	text-decoration: none;
}
.aqua-reader-topbar__title-link:hover {
	color: #48CAE4;
}

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (min-width: 600px) {
	.aqua-reader-page .wp-manga-chapter-img { max-width: 900px; }
	.aqua-reader-bottombar__btn { flex: 0 0 90px; }
}
