/**
 * BOfferly Print Styles
 *
 * Optimised print layout for articles, research papers, Qur'an pages,
 * Hadith pages, and other long-form content.
 * Hides interactive UI and forces a light colour scheme for printing.
 *
 * @package BOfferly
 * @since   1.0.0
 */

/* ============================================
   PRINT - BASE RESET
   ============================================ */
@media print {
	/* Force light theme for printing */
	*,
	*::before,
	*::after {
		background: transparent !important;
		color: #000000 !important;
		box-shadow: none !important;
		text-shadow: none !important;
		filter: none !important;
		backdrop-filter: none !important;
		-webkit-backdrop-filter: none !important;
	}

	html,
	body {
		background: #FFFFFF !important;
		color: #000000 !important;
		font-family: 'Inter', Georgia, 'Times New Roman', serif;
		font-size: 11pt;
		line-height: 1.5;
		margin: 0;
		padding: 0;
		width: 100%;
	}

	/* Remove backgrounds on body */
	body::before,
	body::after {
		display: none !important;
	}

	/* ============================================
	   HIDE NON-PRINTABLE ELEMENTS
	   ============================================ */
	.site-header,
	.top-bar,
	.site-footer,
	.site-sidebar,
	#secondary,
	.mega-menu-navigation,
	.main-navigation,
	.mobile-navigation,
	.mobile-navigation-overlay,
	.search-overlay,
	.mobile-menu-toggle,
	.search-toggle,
	.bofferly-search-toggle,
	.bofferly-back-to-top,
	.bofferly-reading-progress,
	.reading-progress-info,
	.continue-reading-btn,
	.bofferly-dark-mode-toggle,
	.bofferly-user-menu,
	.bofferly-notification-bell,
	.bofferly-social-share,
	.share-buttons,
	.bofferly-bookmark-wrapper,
	.bofferly-bookmark-button,
	.bofferly-bookmark-wrapper,
	.bofferly-note-wrapper,
	.bofferly-note-button,
	.bofferly-note-panel,
	.bofferly-note-modal,
	.related-content-section,
	.comments-area,
	.comment-form,
	.hero-3d-container,
	.hero-pattern-overlay,
	.hero-gradient-overlay,
	.hero-scroll-indicator,
	.newsletter-section,
	.newsletter-form,
	.donation-cta-section,
	.membership-cta-section,
	#related-content,
	.pagination-list,
	.bofferly-pagination,
	.nav-badge,
	.search-filters,
	.category-filter,
	.archive-filters,
	.filter-group,
	.notes-toolbar,
	.bookmarks-filter-nav,
	.notes-filter-nav,
	.history-filter-nav,
	.dashboard-nav,
	.settings-tabs-nav,
	.modal-overlay,
	.toast,
	.notification-toast,
	.wp-block-button,
	button:not(.print-button),
	[role="dialog"],
	[role="tablist"],
	[aria-hidden="true"] {
		display: none !important;
	}

	/* ============================================
	   CONTAINER & LAYOUT
	   ============================================ */
	.container,
	.container-fluid,
	.container-narrow {
		max-width: 100% !important;
		width: 100% !important;
		padding: 0 !important;
		margin: 0 !important;
	}

	.content-area,
	.content-area.with-sidebar {
		display: block !important;
		grid-template-columns: none !important;
	}

	.main-content,
	.article-content,
	.page-content {
		max-width: 100% !important;
		width: 100% !important;
	}

	.site-content {
		padding-top: 0 !important;
	}

	/* ============================================
	   TYPOGRAPHY
	   ============================================ */
	h1, h2, h3, h4, h5, h6 {
		color: #000000 !important;
		background: none !important;
		-webkit-text-fill-color: #000000 !important;
		page-break-after: avoid;
		break-after: avoid;
		font-weight: 700;
		font-family: Georgia, 'Times New Roman', serif;
	}

	h1 { font-size: 20pt; margin: 0 0 0.5em; }
	h2 { font-size: 16pt; margin: 1.25em 0 0.5em; }
	h3 { font-size: 14pt; margin: 1em 0 0.5em; }
	h4 { font-size: 12pt; margin: 1em 0 0.5em; }
	h5, h6 { font-size: 11pt; margin: 1em 0 0.5em; }

	p {
		margin: 0 0 1em;
		orphans: 3;
		widows: 3;
	}

	/* ============================================
	   ARTICLE HEADER
	   ============================================ */
	.article-header,
	.page-header,
	.archive-header {
		margin-bottom: 1.5em;
		padding-bottom: 1em;
		border-bottom: 2px solid #000000;
		text-align: left !important;
	}

	.article-title,
	.page-title {
		font-size: 22pt;
		color: #000000 !important;
		background: none !important;
		-webkit-text-fill-color: #000000 !important;
		margin: 0 0 0.35em;
		line-height: 1.2;
	}

	.article-meta {
		font-size: 10pt;
		color: #333333 !important;
		display: flex;
		flex-wrap: wrap;
		gap: 1em;
		margin-top: 0.5em;
	}

	.meta-item {
		color: #333333 !important;
	}

	.meta-item svg {
		width: 12px;
		height: 12px;
		color: #333333 !important;
	}

	/* Badges */
	.article-type-badge,
	.premium-badge,
	.verified-badge {
		color: #000000 !important;
		background: none !important;
		border: 1px solid #999999 !important;
		padding: 0.15em 0.5em;
		font-size: 8pt;
		border-radius: 3px;
	}

	/* ============================================
	   ARTICLE CONTENT
	   ============================================ */
	.article-content,
	.entry-content,
	.page-content {
		font-size: 11pt;
		line-height: 1.55;
		color: #000000 !important;
	}

	.article-content h2 {
		margin-top: 1.5em;
		border-bottom: 1px solid #CCCCCC;
		padding-bottom: 0.25em;
	}

	.article-content h3 {
		margin-top: 1.25em;
	}

	.article-content p {
		margin-bottom: 0.85em;
	}

	.article-content blockquote {
		margin: 1em 0;
		padding: 0.75em 1em;
		border-left: 3px solid #000000;
		background: #F5F5F5 !important;
		font-style: italic;
		page-break-inside: avoid;
	}

	.article-content ul,
	.article-content ol {
		margin: 0.75em 0;
		padding-left: 1.5em;
	}

	.article-content li {
		margin-bottom: 0.35em;
		page-break-inside: avoid;
	}

	.article-content a {
		color: #000000 !important;
		text-decoration: underline;
	}

	/* Show link URLs after the link text */
	.article-content a[href]::after {
		content: ' (' attr(href) ')';
		font-size: 9pt;
		color: #666666 !important;
		font-style: italic;
		word-break: break-all;
	}

	/* Don't append URLs to internal links */
	.article-content a[href^="/"]::after,
	.article-content a[href^="#"]::after,
	.article-content a[href^="mailto:"]::after {
		content: '';
	}

	.article-content img {
		max-width: 100% !important;
		height: auto !important;
		border-radius: 0 !important;
		margin: 1em 0;
		page-break-inside: avoid;
	}

	.article-content figure {
		margin: 1em 0;
		page-break-inside: avoid;
	}

	.article-content figcaption {
		font-size: 9pt;
		color: #666666 !important;
		text-align: center;
		margin-top: 0.35em;
		font-style: italic;
	}

	.article-content hr {
		border: none;
		border-top: 1px solid #CCCCCC;
		margin: 1.5em 0;
	}

	/* ============================================
	   ISLAMIC CONTENT (ARABIC, HADITH, DUA)
	   ============================================ */
	.ayah-arabic-text,
	.hadith-arabic-text,
	.dua-arabic-text,
	.arabic-text,
	.feed-arabic,
	.hadith-item-arabic {
		font-family: 'Amiri', 'Traditional Arabic', 'Times New Roman', serif !important;
		font-size: 16pt !important;
		line-height: 1.9 !important;
		background: #F8F8F8 !important;
		border-right: 3px solid #000000 !important;
		border-left: none !important;
		padding: 0.75em 1em !important;
		direction: rtl;
		text-align: right;
		color: #000000 !important;
		margin: 1em 0 !important;
		page-break-inside: avoid;
	}

	.ayah-translation-text,
	.hadith-translation-text,
	.dua-translation-text,
	.feed-translation,
	.hadith-item-translation {
		font-size: 11pt;
		color: #000000 !important;
		font-style: normal;
		margin: 0.5em 0;
	}

	.ayah-transliteration-text,
	.dua-transliteration-text,
	.feed-transliteration {
		font-style: italic;
		font-size: 10pt;
		color: #444444 !important;
	}

	.reference-block,
	.dua-reference-info,
	.hadith-reference-info,
	.dua-benefits-info {
		background: #F5F5F5 !important;
		border-left: 3px solid #666666 !important;
		padding: 0.5em 0.75em;
		font-size: 9pt;
		margin: 0.75em 0;
		page-break-inside: avoid;
	}

	.reference-label,
	.translation-label,
	.transliteration-label,
	.benefits-label {
		color: #444444 !important;
		font-size: 8pt;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.05em;
	}

	/* ============================================
	   CARDS & BLOCKS
	   ============================================ */
	.content-card,
	.premium-card,
	.hadith-card,
	.dua-card,
	.ayah-card,
	.scholar-card,
	.article-card {
		background: #FFFFFF !important;
		border: 1px solid #CCCCCC !important;
		border-radius: 4px !important;
		padding: 1em !important;
		margin-bottom: 1em !important;
		box-shadow: none !important;
		page-break-inside: avoid;
	}

	.card-thumbnail {
		display: none !important;
	}

	.card-title {
		font-size: 12pt;
		color: #000000 !important;
		margin: 0 0 0.35em;
	}

	.card-excerpt {
		font-size: 10pt;
		color: #333333 !important;
	}

	.card-body {
		padding: 0 !important;
	}

	/* ============================================
	   AUTHOR BOX
	   ============================================ */
	.author-box {
		background: #F5F5F5 !important;
		border: 1px solid #CCCCCC !important;
		padding: 1em;
		margin: 1.5em 0;
		page-break-inside: avoid;
	}

	.author-avatar img {
		border: 1px solid #CCCCCC;
	}

	.author-name {
		font-size: 12pt;
		color: #000000 !important;
	}

	.author-bio {
		font-size: 10pt;
		color: #333333 !important;
	}

	/* ============================================
	   BREADCRUMBS
	   ============================================ */
	.bofferly-breadcrumbs {
		border-bottom: 1px solid #CCCCCC !important;
		padding: 0.5em 0;
		margin-bottom: 1em;
	}

	.breadcrumb-list {
		display: flex;
		gap: 0.5em;
		font-size: 9pt;
		color: #666666 !important;
	}

	.breadcrumb-item,
	.breadcrumb-link,
	.breadcrumb-current {
		color: #666666 !important;
	}

	/* ============================================
	   PAGE BREAKS
	   ============================================ */
	.page-break {
		page-break-after: always;
	}

	.avoid-break {
		page-break-inside: avoid;
	}

	/* ============================================
	   TABLES
	   ============================================ */
	table {
		width: 100%;
		border-collapse: collapse;
		font-size: 10pt;
		page-break-inside: avoid;
	}

	table th,
	table td {
		border: 1px solid #999999 !important;
		padding: 0.5em;
		text-align: left;
		color: #000000 !important;
		background: #FFFFFF !important;
	}

	table th {
		background: #F5F5F5 !important;
		font-weight: 700;
	}

	/* ============================================
	   FOOTER FOOTNOTE
	   ============================================ */
	.print-footer {
		display: block !important;
		margin-top: 2em;
		padding-top: 1em;
		border-top: 1px solid #CCCCCC;
		font-size: 9pt;
		color: #666666 !important;
		text-align: center;
	}

	.print-footer::before {
		content: 'Printed from BOfferly — ' attr(data-url);
		display: block;
	}

	/* ============================================
	   PAGE MARGINS
	   ============================================ */
	@page {
		margin: 1.5cm 1.5cm 1.5cm 1.5cm;
		size: A4 portrait;
	}

	@page :first {
		margin-top: 1cm;
	}

	/* Widows/Orphans */
	.article-content p,
	.article-content li {
		orphans: 3;
		widows: 3;
	}

	/* ============================================
	   SPECIFIC PAGES
	   ============================================ */
	/* Qur'an Viewer Print */
	.single-ayah .article-content {
		font-size: 12pt;
	}

	.single-ayah .ayah-arabic-text {
		font-size: 20pt !important;
		padding: 1em !important;
	}

	/* Hadith Viewer Print */
	.single-hadith .hadith-arabic-text {
		font-size: 16pt !important;
	}

	/* Research Paper Print */
	.single-research .article-content {
		font-size: 11pt;
	}

	.single-research .article-content h2 {
		font-size: 14pt;
		border-bottom: 1px solid #000000;
	}

	.single-research .article-content h3 {
		font-size: 12pt;
	}

	/* E-book Preview Print */
	.single-ebook .ebook-preview-meta {
		display: flex;
		gap: 2em;
		padding: 1em 0;
		border-top: 1px solid #CCCCCC;
		border-bottom: 1px solid #CCCCCC;
		margin: 1em 0;
	}

	/* ============================================
	   DARK MODE OVERRIDE FOR PRINT
	   ============================================ */
	body.bofferly-dark,
	body.dark-mode,
	[data-theme="dark"] {
		background: #FFFFFF !important;
		color: #000000 !important;
	}

	body.bofferly-dark *,
	body.dark-mode *,
	[data-theme="dark"] * {
		background: transparent !important;
		color: #000000 !important;
		border-color: #999999 !important;
	}

	body.bofferly-dark .ayah-arabic-text,
	body.bofferly-dark .hadith-arabic-text,
	body.bofferly-dark .dua-arabic-text {
		background: #F8F8F8 !important;
		border-right-color: #000000 !important;
	}

	/* ============================================
	   LINKS IN PRINT
	   ============================================ */
	a[href^="http"]:not([href*="bofferly"])::after {
		content: ' (' attr(href) ')';
		font-size: 9pt;
		color: #666666 !important;
	}

	a[href^="mailto:"]::after {
		content: ' (' attr(href) ')';
	}

	/* ============================================
	   HIDE WP ADMIN BAR FOR PRINT
	   ============================================ */
	#wpadminbar,
	#wpadminbar * {
		display: none !important;
	}

	/* Reset body offset if admin bar is present */
	html.admin-bar,
	body.admin-bar {
		margin-top: 0 !important;
		padding-top: 0 !important;
	}
}

/* ============================================
   PRINT PREVIEW (on-screen simulation)
   ============================================ */
.print-preview {
	background: #FFFFFF;
	color: #000000;
	max-width: 21cm;
	margin: 0 auto;
	padding: 1.5cm;
	font-family: Georgia, serif;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.print-preview h1,
.print-preview h2,
.print-preview h3 {
	font-family: Georgia, serif;
}

.print-preview .ayah-arabic-text {
	font-family: 'Amiri', serif;
	font-size: 18pt;
	direction: rtl;
	text-align: right;
	padding: 1em;
	background: #F8F8F8;
	border-right: 3px solid #000000;
}