/**
 * FreeGameLoop — Component Styles
 *
 * Supplementary CSS loaded after style.css. Covers UI pieces that are
 * generated by JavaScript (lightbox, scroll-to-top, live search results,
 * toast notifications) and any WordPress admin-bar integration tweaks.
 *
 * @package FreeGameLoop
 */

/* ============================================================
   LIVE SEARCH RESULTS DROPDOWN
   ============================================================ */
#fgl-live-search-results {
	position: absolute;
	top: calc( 100% + 4px );
	left: 0;
	right: 0;
	z-index: 50;
	background: var(--fgl-bg);
	border: 1px solid var(--fgl-border);
	border-radius: var(--fgl-radius-md);
	box-shadow: var(--fgl-shadow-lg);
	max-height: 400px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.fgl-header-search-panel {
	position: relative;
}

.fgl-live-result:hover {
	background: var(--fgl-card-alt);
}

/* ============================================================
   LIGHTBOX (built by game-interactions.js)
   Base styles so the JS-injected overlay inherits theme vars.
   ============================================================ */
#fgl-lightbox {
	transition: opacity 200ms ease;
}

#fgl-lightbox img {
	transition: opacity 250ms ease;
}

/* ============================================================
   SCROLL-TO-TOP BUTTON (injected by main.js)
   We give it a hover state via CSS since the element exists
   in the DOM after DOMContentLoaded.
   ============================================================ */
#fgl-scroll-top:hover {
	transform: translateY(-3px) !important;
	box-shadow: var(--fgl-shadow-lg);
}

/* ============================================================
   WORDPRESS ADMIN BAR OFFSET
   Pushes the sticky header down when WP admin bar is visible.
   ============================================================ */
.admin-bar .fgl-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .fgl-header {
		top: 46px;
	}
}

/* ============================================================
   PRINT STYLES — hide non-content UI for print/PDF
   ============================================================ */
@media print {
	.fgl-header,
	.fgl-footer,
	.fgl-sidebar,
	.fgl-ad-slot,
	.fgl-ad-sticky-mobile,
	#fgl-scroll-top,
	.fgl-hero-nav,
	.fgl-share-row,
	.fgl-game-card-fav {
		display: none !important;
	}

	.fgl-layout-main-sidebar {
		grid-template-columns: 1fr;
	}

	body {
		font-size: 12pt;
		color: #000;
		background: #fff;
	}

	a { color: #000; text-decoration: underline; }

	.fgl-article-content img {
		max-width: 60%;
	}
}

/* ============================================================
   WORDPRESS CORE OVERRIDES — align block editor output
   ============================================================ */
.fgl-article-content .wp-block-image figcaption,
.fgl-article-content figure figcaption {
	text-align: center;
	font-size: .82rem;
	color: var(--fgl-text-soft);
	margin-top: 8px;
}

.fgl-article-content .wp-block-table {
	overflow-x: auto;
}

.fgl-article-content .wp-block-table table {
	min-width: 100%;
	border: 1px solid var(--fgl-border);
	border-radius: var(--fgl-radius-md);
	overflow: hidden;
}

.fgl-article-content .wp-block-table td,
.fgl-article-content .wp-block-table th {
	padding: 10px 14px;
	border-bottom: 1px solid var(--fgl-border);
	text-align: left;
	font-size: .92rem;
}

.fgl-article-content .wp-block-table th {
	background: var(--fgl-card-alt);
	font-weight: 700;
}

.fgl-article-content .wp-block-pullquote {
	border-top: 4px solid var(--fgl-cyan);
	border-bottom: 4px solid var(--fgl-cyan);
	padding: var(--fgl-space-5);
	text-align: center;
}

.fgl-article-content .wp-block-pullquote blockquote {
	border-left: none;
	background: none;
	padding: 0;
}

.fgl-article-content .wp-block-code,
.fgl-article-content pre {
	background: var(--fgl-card-alt);
	border: 1px solid var(--fgl-border);
	border-radius: var(--fgl-radius-md);
	padding: var(--fgl-space-4);
	font-size: .88rem;
	overflow-x: auto;
}

.fgl-article-content .wp-block-quote {
	border-left: 4px solid var(--fgl-cyan);
	background: var(--fgl-card-alt);
	padding: var(--fgl-space-4) var(--fgl-space-5);
	border-radius: 0 var(--fgl-radius-md) var(--fgl-radius-md) 0;
	margin: var(--fgl-space-5) 0;
}

.fgl-article-content .wp-block-separator {
	border-color: var(--fgl-border);
	margin-block: var(--fgl-space-5);
}

/* Wide / full alignment within the content container */
.fgl-article-content .alignwide {
	margin-inline: calc( -1 * var(--fgl-space-5) );
}

.fgl-article-content .alignfull {
	margin-inline: calc( -1 * var(--fgl-space-5) );
	border-radius: 0;
}

/* ============================================================
   COOKIE NOTICE BANNER (optional — shown by functions.php hook
   if user hasn't accepted yet)
   ============================================================ */
.fgl-cookie-notice {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: calc( var(--fgl-z-sticky-ad) + 5 );
	background: var(--fgl-card);
	border-top: 1px solid var(--fgl-border);
	padding: var(--fgl-space-4) var(--fgl-space-5);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--fgl-space-4);
	flex-wrap: wrap;
	box-shadow: var(--fgl-shadow-lg);
}

.fgl-cookie-notice p {
	margin: 0;
	font-size: .88rem;
}

.fgl-cookie-notice a {
	color: var(--fgl-cyan-dark);
	text-decoration: underline;
	text-underline-offset: 2px;
}

html[data-theme="dark"] .fgl-cookie-notice a {
	color: var(--fgl-cyan);
}

/* ============================================================
   WP COMMENT FORM — override core nesting quirks
   ============================================================ */
.fgl-comment-form .comment-notes {
	font-size: .85rem;
	color: var(--fgl-text-soft);
	margin-bottom: var(--fgl-space-4);
}

.fgl-comment-form label {
	display: block;
	font-weight: 700;
	font-size: .85rem;
	margin-bottom: var(--fgl-space-2);
}

.fgl-comment-form input[type="text"],
.fgl-comment-form input[type="email"],
.fgl-comment-form textarea {
	width: 100%;
	padding: 12px 16px;
	background: var(--fgl-card-alt);
	border: 1px solid var(--fgl-border);
	border-radius: var(--fgl-radius-md);
	color: var(--fgl-text);
	margin-bottom: var(--fgl-space-4);
	transition: border-color var(--fgl-transition-fast), box-shadow var(--fgl-transition-fast);
}

.fgl-comment-form input:focus,
.fgl-comment-form textarea:focus {
	border-color: var(--fgl-cyan);
	box-shadow: 0 0 0 3px rgba(6, 182, 212, .15);
	outline: none;
}

.fgl-comment-form textarea {
	min-height: 130px;
	resize: vertical;
}

/* ============================================================
   PAGINATION — WP paginate_links() output fixes
   ============================================================ */
.fgl-pagination .page-numbers {
	min-width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--fgl-radius-md);
	background: var(--fgl-card);
	border: 1px solid var(--fgl-border);
	font-weight: 700;
	font-size: .9rem;
	padding-inline: 10px;
	color: var(--fgl-text);
	transition: border-color var(--fgl-transition-fast), color var(--fgl-transition-fast);
}

.fgl-pagination .page-numbers:hover {
	border-color: var(--fgl-cyan);
	color: var(--fgl-cyan-dark);
}

html[data-theme="dark"] .fgl-pagination .page-numbers:hover {
	color: var(--fgl-cyan);
}

.fgl-pagination .page-numbers.current {
	background: var(--fgl-gradient-cyan);
	color: #fff;
	border-color: transparent;
}

.fgl-pagination .page-numbers.dots {
	background: transparent;
	border-color: transparent;
	color: var(--fgl-text-soft);
}
