/**
 * AV NEWS ePaper Manager — HTML5 PDF Viewer Stylesheet
 *
 * Modern, high-performance, mobile-responsive PDF.js viewer
 * with AV NEWS Red styling (#D71920).
 *
 * @package AVNEWS_Epaper
 */

* {
	box-sizing: border-box;
}

body.avnews-reader-body {
	margin: 0;
	padding: 0;
	background: #14171C;
	color: #F3F4F6;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
	overflow-x: hidden;
	min-height: 100vh;
	width: 100%;
	-webkit-font-smoothing: antialiased;
}

.avnews-reader-container {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	width: 100%;
	position: relative;
	background: #14171C;
}

/* ==========================================================================
   1. Reader Top Toolbar Header
   ========================================================================== */

.avnews-reader-header {
	height: 58px;
	background: #1A1D24;
	border-bottom: 1.5px solid #282C37;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 16px;
	z-index: 100;
	flex-shrink: 0;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.header-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 240px;
}

/* Back button */
.btn-back-epaper {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #FFFFFF;
	text-decoration: none;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.btn-back-epaper:hover {
	background: #D71920;
	color: #FFFFFF;
	transform: translateX(-2px);
}

.btn-brand {
	display: inline-flex;
	align-items: baseline;
	gap: 2px;
	text-decoration: none;
	font-weight: 900;
	font-size: 19px;
	letter-spacing: -0.5px;
	line-height: 1;
}

.brand-av {
	color: #D71920;
}

.brand-news {
	color: #FFFFFF;
}

.edition-heading {
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.edition-title {
	margin: 0;
	font-size: 13.5px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 260px;
	color: #F9FAFB;
}

.edition-meta-tags {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	font-size: 11px;
}

.city-pill {
	background: #D71920;
	color: #FFFFFF;
	padding: 1px 7px;
	border-radius: 3px;
	font-weight: 700;
	font-size: 10.5px;
}

.date-pill {
	color: #9CA3AF;
	font-weight: 500;
}

/* Center Page Controls */
.header-center {
	display: flex;
	align-items: center;
	justify-content: center;
}

.nav-page-controls {
	display: inline-flex;
	align-items: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	padding: 3px 6px;
	gap: 4px;
}

.nav-btn {
	background: transparent;
	border: none;
	color: #F3F4F6;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.18s ease;
}

.nav-btn:hover:not(:disabled) {
	background: #D71920;
	color: #FFFFFF;
}

.nav-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.page-indicator {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 700;
	padding: 0 6px;
}

.page-indicator input {
	width: 44px !important;
	height: 28px !important;
	background: #111419 !important;
	border: 1.5px solid #374151 !important;
	border-radius: 4px !important;
	color: #FFFFFF !important;
	text-align: center !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	padding: 0 4px !important;
	margin: 0 2px !important;
	outline: none !important;
	box-shadow: none !important;
}

.page-indicator input:focus {
	border-color: #D71920 !important;
}

.page-total {
	color: #9CA3AF;
	font-size: 12px;
}

/* Right Tools & Actions */
.header-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.zoom-controls {
	display: flex;
	align-items: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 6px;
	overflow: hidden;
}

.tool-btn {
	background: transparent;
	border: none;
	color: #D1D5DB;
	width: 34px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.18s ease;
	text-decoration: none;
}

.tool-btn:hover {
	background: rgba(255, 255, 255, 0.15);
	color: #FFFFFF;
}

.tool-btn.fit-btn {
	width: auto;
	padding: 0 8px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

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

.tool-btn.btn-wa-share {
	background: #25D366;
	color: #FFFFFF !important;
	border-radius: 6px;
	width: 34px;
	height: 32px;
}

.tool-btn.btn-wa-share:hover {
	background: #20BA5A;
	transform: scale(1.05);
}

.btn-download {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: #D71920;
	color: #FFFFFF !important;
	font-size: 12.5px;
	font-weight: 700;
	padding: 6px 12px;
	border-radius: 6px;
	text-decoration: none !important;
	transition: all 0.2s ease;
}

.btn-download:hover {
	background: #B5141A;
	transform: translateY(-1px);
}

/* Share Dropdown */
.share-dropdown {
	position: relative;
}

.share-menu {
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 8px;
	background: #1F242D;
	border: 1px solid #374151;
	border-radius: 8px;
	padding: 6px;
	min-width: 140px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
	display: flex;
	flex-direction: column;
	gap: 4px;
	z-index: 200;
}

.share-item {
	display: block;
	padding: 7px 12px;
	font-size: 12px;
	font-weight: 600;
	color: #E5E7EB;
	text-decoration: none;
	border-radius: 4px;
	text-align: left;
	background: transparent;
	border: none;
	cursor: pointer;
	width: 100%;
}

.share-item:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #FFFFFF;
}

/* ==========================================================================
   2. Main Document Viewport & PDF Stage
   ========================================================================== */

.avnews-reader-viewport {
	width: 100%;
	height: calc(100vh - 105px);
	min-height: 560px;
	position: relative;
	background: #14171C;
	padding: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.avnews-pdf-stage {
	width: 100%;
	height: 100%;
	position: relative;
	background: #1A1D24;
	display: flex;
	flex-direction: column;
}

.avnews-main-pdf-frame {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
	background: #1A1D24;
}

.btn-engine-toggle {
	width: auto !important;
	padding: 0 10px !important;
	font-size: 11.5px !important;
	font-weight: 700 !important;
	border-radius: 6px !important;
	background: rgba(255, 255, 255, 0.08) !important;
	border: 1px solid rgba(255, 255, 255, 0.15) !important;
	color: #E5E7EB !important;
	transition: all 0.2s ease;
}

.btn-engine-toggle:hover,
.btn-engine-toggle.is-active {
	background: #D71920 !important;
	border-color: #D71920 !important;
	color: #FFFFFF !important;
}

/* Toast Notification */
.avnews-reader-toast {
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: #111827;
	border: 1.5px solid #D71920;
	color: #FFFFFF;
	padding: 10px 22px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 9999;
	pointer-events: none;
}

.avnews-reader-toast.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.avnews-error-banner {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #1F242D;
	border: 1px solid #374151;
	border-radius: 12px;
	padding: 32px 24px;
	text-align: center;
	max-width: 440px;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.avnews-error-banner h3 {
	margin: 0 0 10px 0;
	color: #EF4444;
	font-size: 18px;
}

.avnews-error-banner p {
	color: #9CA3AF;
	font-size: 13.5px;
	margin: 0 0 18px 0;
	line-height: 1.5;
}

.btn-back {
	display: inline-block;
	background: #D71920;
	color: #FFFFFF;
	font-size: 13px;
	font-weight: 700;
	padding: 8px 18px;
	border-radius: 6px;
	text-decoration: none;
}

/* ==========================================================================
   3. Bottom Page Drawer / Thumbnails
   ========================================================================== */

.avnews-reader-footer {
	background: #1A1D24;
	border-top: 1px solid #282C37;
	position: relative;
	z-index: 90;
	flex-shrink: 0;
}

.btn-toggle-carousel {
	width: 100%;
	background: transparent;
	border: none;
	color: #9CA3AF;
	font-size: 12px;
	font-weight: 700;
	padding: 8px 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-toggle-carousel:hover {
	color: #FFFFFF;
	background: rgba(255, 255, 255, 0.05);
}

.pages-drawer {
	display: none;
	max-height: 140px;
	padding: 12px 16px;
	overflow-x: auto;
	background: #111419;
	border-top: 1px solid #282C37;
}

.pages-drawer.is-open {
	display: block;
}

.thumbnails-track {
	display: flex;
	gap: 12px;
}

.page-thumb-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	flex-shrink: 0;
}

.thumb-box {
	width: 52px;
	height: 70px;
	background: #282C37;
	border: 2px solid transparent;
	border-radius: 4px;
	color: #FFFFFF;
	font-weight: 800;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.page-thumb-item:hover .thumb-box {
	border-color: #D71920;
	transform: translateY(-2px);
}

.page-thumb-item.active .thumb-box {
	border-color: #D71920;
	background: #D71920;
	color: #FFFFFF;
}

.thumb-label {
	font-size: 10px;
	color: #9CA3AF;
	font-weight: 600;
}

/* ==========================================================================
   4. Mobile Responsive Toolbar & Viewport
   ========================================================================== */

@media (max-width: 768px) {
	.avnews-reader-header {
		padding: 0 8px;
		height: 52px;
	}

	.header-left {
		min-width: auto;
		gap: 8px;
	}

	.edition-heading {
		display: none; /* Keep toolbar clean on small screens */
	}

	.btn-brand {
		font-size: 16px;
	}

	.zoom-controls {
		display: none; /* On mobile, touch pinch-to-zoom is native */
	}

	.btn-download .btn-text {
		display: none;
	}

	.btn-download {
		padding: 6px 9px;
	}

	.avnews-reader-viewport {
		padding: 0;
		height: calc(100vh - 98px);
		min-height: 480px;
	}
}

/* ==========================================================================
   5. SEO Article Footer & Details Section
   ========================================================================== */

.avnews-reader-article-footer {
	background: #111317;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	padding: 36px 20px 48px 20px;
	color: #E5E7EB;
}

.article-footer-inner {
	max-width: 1100px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1.4fr 0.8fr;
	gap: 32px;
	align-items: center;
}

.article-kicker {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	color: #D71920;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	margin-bottom: 6px;
}

.article-heading {
	font-size: clamp(20px, 2.5vw, 26px);
	font-weight: 800;
	color: #FFFFFF;
	margin: 0 0 12px 0;
	line-height: 1.3;
}

.article-desc {
	font-size: 14px;
	color: #9CA3AF;
	line-height: 1.6;
	margin: 0 0 18px 0;
}

.article-badges-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.spec-pill {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 6px;
	padding: 5px 12px;
	font-size: 12.5px;
	color: #D1D5DB;
}

.spec-pill strong {
	color: #FFFFFF;
}

.article-actions-col {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: flex-start;
}

.btn-download-large {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #D71920;
	color: #FFFFFF !important;
	padding: 12px 24px;
	font-size: 14px;
	font-weight: 700;
	border-radius: 8px;
	text-decoration: none !important;
	transition: all 0.2s ease;
	box-shadow: 0 4px 14px rgba(215, 25, 32, 0.35);
}

.btn-download-large:hover {
	background: #B5141A;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(215, 25, 32, 0.5);
}

.btn-back-home {
	font-size: 13px;
	font-weight: 600;
	color: #9CA3AF !important;
	text-decoration: none !important;
	transition: color 0.2s ease;
}

.btn-back-home:hover {
	color: #FFFFFF !important;
	text-decoration: underline !important;
}

.avnews-embedded-fallback {
	width: 100%;
	height: 82vh;
	min-height: 600px;
	background: #18181b;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
	.article-footer-inner {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	.btn-download-large {
		width: 100%;
		justify-content: center;
	}
}
