/* --- ADP MODERN SCROLL & MODAL CSS --- */

/* 1. Smooth Fade-In Animation for New Rows */
.thumbnails-002 {
	opacity: 0;
	transform: translateY(15px);
	animation: adpFadeUp 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes adpFadeUp {
	to { opacity: 1; transform: translateY(0); }
}

/* 2. Completely hide Coppermine's native pagination rows */
.nav-container-fix, .gallery-nav-footer {
	display: none !important;
}

/* 3. The New Centered Control Panel */
#adp-scroll-panel {
	text-align: center;
	padding: 40px 20px;
	margin-top: 20px;
	clear: both;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 15px;
}

.adp-stats-text {
	font-size: 14px;
	color: #666;
	font-weight: bold;
}

.adp-button-group {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
}

.adp-btn {
	padding: 12px 24px;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	border: none;
	border-radius: 4px;
	transition: all 0.2s;
}

.adp-btn-primary { background-color: var(--blue); color: #fff; }
.adp-btn-primary:hover { background-color: var(--bluehover); }

.adp-btn-secondary { background-color: #554e47; color: #fff; }
.adp-btn-secondary:hover { background-color: #3b3631; }

/* 4. The Dark Modal Background Overlay */
#adpModalOverlay {
	position: fixed;
	top: 0; left: 0; width: 100%; height: 100%;
	background: rgba(15, 15, 15, 0.85);
	backdrop-filter: blur(5px);
	z-index: 99999;
	display: flex; align-items: center; justify-content: center;
	opacity: 0; transition: opacity 0.2s ease;
}

/* 5. The White Pop-up Window Box */
#adpModalContent {
	width: 90%; max-width: 1100px; height: 85vh;
	background: #fff; border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.5);
	position: relative; overflow: hidden;
	transform: scale(0.95); transition: transform 0.2s ease;
}

/* 6. Close Button in Corner */
#adpModalClose {
	position: absolute; top: 12px; right: 20px;
	font-size: 30px; font-weight: bold; color: #333;
	cursor: pointer; z-index: 100001; transition: color 0.2s;
}
#adpModalClose:hover { color: #c04a2d; }

/* 7. The Iframe inside the Modal Box */
#adpModalFrame {
	width: 100%; height: 100%; border: none; background: #fff;
}

/* 8. Floating "Back to Top" Button */
#adp-back-to-top {
	position: fixed;
	bottom: 30px;
	right: 30px;
	background-color: var(--blue);
	color: #fff;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(0,0,0,0.3);
	z-index: 99990; /* Sits just below the modal pop-up layer */
	opacity: 0;
	visibility: hidden;
	transform: translateY(15px);
	transition: all 0.3s ease;
}

#adp-back-to-top.adp-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

#adp-back-to-top:hover {
	background-color: var(--bluehover);
	box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* 9. Top Sorting Dropdown */
.adp-sort-box {
	float: right;
	display: flex;
	align-items: center;}

#adp-sort-select {
	padding: 8px 15px;
	background-color: #554e47; /* Matches your header */
	color: #fff;
	font-size: 14px;
	font-weight: bold;
	border: 1px solid #777;
	border-radius: 4px;
	cursor: pointer;
	outline: none;
	transition: background-color 0.2s;
}

#adp-sort-select:hover {
	background-color: #c04a2d; /* AdPharm Red */
	border-color: #c04a2d;
}

#adp-sort-select option {
	background-color: #fff;
	color: #333;
	font-weight: normal;
}

/* 10. Mobile Responsive Fixes for Header & Sorting */
@media screen and (max-width: 768px) {
	
	/* SCENARIO A: Fix for JS-injected Flexbox headers (Search Results) */
	td.tableh1[style*="flex"] {
		flex-direction: column !important;
		align-items: flex-start !important;
		padding-bottom: 15px !important; /* Give it some breathing room at the bottom */
	}

	/* SCENARIO B: Fix for native Coppermine nested tables (Brand Pages) */
	.tableh1 table tr {
		display: flex !important;
		flex-direction: column !important;
		align-items: flex-start !important;
	}
	.tableh1 table td.statlink, 
	.tableh1 table td#sortorder_cell {
		display: block !important;
		width: 100% !important;
		text-align: left !important;
	}

	/* UNIVERSAL: Expand the sort box container */
	.adp-sort-box {
		float: none !important;
		width: 100% !important;
		margin-top: .25em !important;
	}

	/* UNIVERSAL: Make the dropdown button span 100% of the screen */
	#adp-sort-select {
		width: 100% !important;
		box-sizing: border-box !important;
		padding: 12px 15px !important; 
		text-align: center;
	}
}

/* 11. Fixed Footer for Infinite Scroll */

/* Pin the footer to the bottom of the screen */
#footer1 {
	position: fixed !important;
	bottom: 0 !important;
	left: 0 !important;
	width: 100% !important;
	max-width: 100% !important; /* Overrides old legacy width */
	background-color: rgba(245, 245, 245, 0.95) !important; /* Slightly transparent light grey */
	backdrop-filter: blur(5px); /* Modern frosted glass effect */
	border-top: 1px solid #d7d3cf !important;
	z-index: 9990 !important; /* Sits below the Back to Top button and Modals */
	padding: 10px 0 !important;
	box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
	text-align: center;
}

/* Add padding to the bottom of the page so the last row of ads doesn't get hidden behind the new footer */
body {
	padding-bottom: 90px !important; 
}

/* Nudge the 'Back to Top' button up so it sits nicely above the fixed footer */
#adp-back-to-top {
	bottom: 100px !important; 
}

/* 12. Perfect Equidistant Footer Spacing */

/* 1. Fix the Top Link Row (.BOTTOMNAV) */
.BOTTOMNAV {
	display: flex !important;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	font-size: 0 !important; /* Magic trick: completely hides the hardcoded &nbsp; spaces */
	width: 100% !important;  /* Ensure it spans the whole footer */
	left: 0 !important;      /* Kill any legacy left/right nudging */
	position: relative !important;
}

.BOTTOMNAV a {
	font-size: 13px !important; /* Restores the text size */
	line-height: 1.2 !important; 
	padding: 0 12px !important; /* Sets perfect mathematical spacing left and right */
	border-right: 1px solid #d7d3cf !important; /* Draws the pipe separator */
}

/* Remove the line after the absolute final item */
.BOTTOMNAV a:last-child {
	border-right: none !important;
}

/* 2. Fix the Bottom Credits Row (ul.credits) */
ul.credits {
	display: flex !important;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	padding: 0 !important;
	margin: 18px 0 0 0 !important;
	width: 100% !important;  /* Ensure it spans the whole footer */
	left: 0 !important;      /* OVERRIDE LEGACY CSS: Kills the old left: -20px rule! */
	position: relative !important;
}

ul.credits li {
	font-size: 12px !important;
	line-height: 1.2em;
	padding: 0 12px !important;
	border-right: 1px solid #d7d3cf !important;
	display: block !important;
}

/* Remove the line after the absolute final item */
ul.credits li:last-child {
	border-right: none !important;
}