/**
 * Public /products/ archive and single-product page styles.
 *
 * Independent of the theme's featured-deal widgets - its own class
 * namespace (.affiprod-*) throughout - but reuses the theme's design
 * tokens (--tb-* custom properties from style.css) so it still reads
 * as part of the same site rather than a bolted-on page.
 *
 * Loaded only on the products archive/single views - see
 * Frontend\Product_Templates::enqueue_assets().
 */

.affiprod-archive,
.affiprod-product {
	padding-block: 48px 72px;
	background-color: var(--tb-background, #ffffff);
}

.affiprod-archive__container,
.affiprod-product__container {
	width: min(100% - 40px, var(--tb-container-width, 1180px));
	margin-inline: auto;
}

/* Archive header */

.affiprod-archive__header {
	margin-bottom: 32px;
}

.affiprod-archive__title {
	margin: 0 0 12px;
	color: var(--tb-heading, #202938);
	font-family: "Poppins", Arial, Helvetica, sans-serif;
	font-size: clamp(2.2rem, 5vw, 3.2rem);
	line-height: 1.15;
}

.affiprod-archive__intro {
	max-width: 640px;
	margin: 0;
	color: var(--tb-text-light, #667085);
	font-size: 1.05rem;
	line-height: 1.7;
}

.affiprod-archive__empty {
	padding: 28px;
	color: var(--tb-text-light, #667085);
	background-color: var(--tb-background-soft, #f6f9f9);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: var(--tb-radius-medium, 12px);
}

/* "That filter doesn't exist" notice - a dismissible callout, not a
   full-width banner, so it reads more like a tooltip than a system
   alert. */

.affiprod-archive__notices {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

.affiprod-archive__notice {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	max-width: 560px;
	padding: 12px 14px;
	background-color: var(--tb-white, #ffffff);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-left: 4px solid var(--tb-accent, #f0932b);
	border-radius: var(--tb-radius-medium, 12px);
	box-shadow: var(--tb-shadow-small, 0 4px 14px rgba(52, 64, 85, 0.06));
}

.affiprod-archive__notice-text {
	flex: 1 1 auto;
	color: var(--tb-heading, #202938);
	font-size: 0.92rem;
	line-height: 1.5;
}

.affiprod-archive__notice-close {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	padding: 0;
	color: var(--tb-text-light, #667085);
	background: transparent;
	border: 0;
	border-radius: 50%;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	transition: color var(--tb-transition, 180ms ease), background-color var(--tb-transition, 180ms ease);
}

.affiprod-archive__notice-close:hover,
.affiprod-archive__notice-close:focus-visible {
	color: var(--tb-heading, #202938);
	background-color: var(--tb-background-soft, #f6f9f9);
}

/* Category/Campaign filter bar */

.affiprod-archive__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px;
	margin-bottom: 28px;
}

.affiprod-archive__filter-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 180px;
}

.affiprod-archive__filter-field label {
	color: var(--tb-text-light, #667085);
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.affiprod-archive__filter-field select {
	padding: 10px 12px;
	color: var(--tb-heading, #202938);
	background-color: var(--tb-white, #ffffff);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: var(--tb-radius-medium, 12px);
	font-size: 0.95rem;
}

.affiprod-archive__filter-field select:focus-visible {
	outline: 2px solid var(--tb-primary, #007a74);
	outline-offset: 1px;
}

/*
 * Campaign/Tag are dependent on Category (see
 * Product_Archive_Filters::get_campaign_terms_for_category()) - grayed
 * out and inert until a Category is picked, rather than offering a
 * full site-wide list that would mostly dead-end in zero results.
 */
.affiprod-archive__filter-field select:disabled {
	color: var(--tb-text-light, #667085);
	background-color: var(--tb-background-soft, #f6f9f9);
	border-color: var(--tb-border, #e2e8f0);
	cursor: not-allowed;
	opacity: 0.65;
}

.affiprod-archive__filter-submit {
	padding: 10px 18px;
	color: var(--tb-white, #ffffff);
	background-color: var(--tb-primary, #007a74);
	border: 0;
	border-radius: var(--tb-radius-medium, 12px);
	font-weight: 600;
	cursor: pointer;
}

/* Product grid + card */

.affiprod-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 24px;
}

.affiprod-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background-color: var(--tb-white, #ffffff);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: var(--tb-radius-medium, 12px);
	box-shadow: var(--tb-shadow-small, 0 4px 14px rgba(52, 64, 85, 0.06));
	transition: transform var(--tb-transition, 180ms ease), box-shadow var(--tb-transition, 180ms ease);
}

.affiprod-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--tb-shadow-medium, 0 10px 30px rgba(52, 64, 85, 0.09));
}

.affiprod-card__image-link {
	position: relative;
	display: block;
	background-color: var(--tb-background-soft, #f6f9f9);
}

.affiprod-card__image {
	display: block;
	width: 100%;
	height: 200px;
	object-fit: contain;
	padding: 16px;
}

.affiprod-card__image--placeholder {
	background: linear-gradient(135deg, var(--tb-primary, #007a74) 0%, var(--tb-secondary, #43b3ae) 100%);
}

.affiprod-card__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 4px 10px;
	color: #ffffff;
	background-color: var(--tb-alert, #ff6f61);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.affiprod-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	padding: 18px 20px 20px;
	border-top: 1px solid var(--tb-border, #e2e8f0);
}

.affiprod-card__submeta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 4px;
}

.affiprod-card__brand {
	margin: 0;
	color: var(--tb-primary, #007a74);
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.affiprod-card__condition {
	padding: 2px 8px;
	color: var(--tb-text-light, #667085);
	background-color: var(--tb-background-soft, #f6f9f9);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.affiprod-card__title {
	margin: 0 0 10px;
	font-family: "Poppins", Arial, Helvetica, sans-serif;
	font-size: 1.1rem;
	line-height: 1.4;
}

.affiprod-card__title a {
	color: var(--tb-heading, #202938);
	text-decoration: none;
}

.affiprod-card__title a:hover,
.affiprod-card__title a:focus-visible {
	color: var(--tb-primary, #007a74);
}

.affiprod-card__prices {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 14px;
}

.affiprod-card__previous-price {
	color: var(--tb-text-light, #667085);
	font-size: 0.92rem;
}

.affiprod-card__current-price {
	color: var(--tb-primary, #007a74);
	font-weight: 700;
	font-size: 1.15rem;
}

.affiprod-card__shipping {
	margin: 0 0 10px;
	color: var(--tb-text-light, #667085);
	font-size: 0.82rem;
}

.affiprod-card__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	width: 100%;
	margin-top: auto;
	padding: 10px 16px;
	color: var(--tb-primary, #007a74);
	background-color: transparent;
	border: 2px solid var(--tb-primary, #007a74);
	border-radius: var(--tb-radius-small, 6px);
	font-weight: 700;
	text-decoration: none;
	transition: color var(--tb-transition, 180ms ease), background-color var(--tb-transition, 180ms ease);
}

.affiprod-card__button:hover,
.affiprod-card__button:focus-visible {
	color: #ffffff;
	background-color: var(--tb-primary, #007a74);
}

/* Single product page */

.affiprod-product__breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 24px;
	color: var(--tb-text-light, #667085);
	font-size: 0.92rem;
}

.affiprod-product__breadcrumb a {
	color: var(--tb-primary, #007a74);
	text-decoration: none;
}

.affiprod-product__breadcrumb a:hover {
	text-decoration: underline;
}

/*
 * Three columns: a vertical thumbnail strip, the main image viewer,
 * and the details column - adapted from an eBay-style listing layout
 * (see single-product.php's file comment for what was deliberately
 * left out, like Buy It Now/quantity/seller card, since this is an
 * affiliate referral site, not a storefront).
 */
.affiprod-product__layout {
	display: grid;
	grid-template-columns: 84px minmax(0, 1fr) minmax(320px, 420px);
	gap: 24px;
	align-items: start;
}

/*
 * Explicit grid-column on all three children, rather than relying on
 * source order - single-product.php only renders .affiprod-product__thumbs
 * when there are 2+ gallery images, so for the common case (0 or 1
 * photos) the layout has just two DOM children. Without an explicit
 * placement, grid auto-placement would slot .affiprod-product__viewer
 * into column 1 (the narrow 84px thumb rail) and
 * .affiprod-product__info into column 2 (the wide viewer column),
 * leaving column 3 empty - squashing the main image and leaving a
 * blank gap where the details column should be.
 */
.affiprod-product__thumbs {
	position: sticky;
	top: 24px;
	grid-column: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 520px;
	overflow-y: auto;
}

.affiprod-product__thumb {
	flex: 0 0 auto;
	padding: 0;
	overflow: hidden;
	background-color: var(--tb-white, #ffffff);
	border: 2px solid var(--tb-border, #e2e8f0);
	border-radius: var(--tb-radius-small, 6px);
	cursor: pointer;
	transition: border-color var(--tb-transition, 180ms ease);
}

.affiprod-product__thumb img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	padding: 4px;
}

.affiprod-product__thumb:hover,
.affiprod-product__thumb.is-active {
	border-color: var(--tb-primary, #007a74);
}

.affiprod-product__viewer {
	position: sticky;
	top: 24px;
	grid-column: 2;
}

.affiprod-product__nav-arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-height: 0;
	padding: 0;
	color: var(--tb-heading, #202938);
	background-color: rgba(255, 255, 255, 0.92);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: 50%;
	font-size: 1.4rem;
	line-height: 1;
	transform: translateY(-50%);
	transition: color var(--tb-transition, 180ms ease), background-color var(--tb-transition, 180ms ease);
}

.affiprod-product__nav-arrow--prev {
	left: 12px;
}

.affiprod-product__nav-arrow--next {
	right: 12px;
}

.affiprod-product__nav-arrow:hover,
.affiprod-product__nav-arrow:focus-visible {
	color: #ffffff;
	background-color: var(--tb-primary, #007a74);
	border-color: var(--tb-primary, #007a74);
}

.affiprod-product__image {
	display: block;
	width: 100%;
	max-height: 460px;
	object-fit: contain;
	padding: 12px;
	background-color: #ffffff;
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: var(--tb-radius-medium, 12px);
}

.affiprod-product__image--placeholder {
	height: 360px;
	background: linear-gradient(135deg, var(--tb-primary, #007a74) 0%, var(--tb-secondary, #43b3ae) 100%);
	border-radius: var(--tb-radius-medium, 12px);
}

.affiprod-product__info {
	grid-column: 3;
}

.affiprod-product__submeta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 6px;
}

.affiprod-product__meta {
	margin: 0;
	color: var(--tb-primary, #007a74);
	font-size: 0.85rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.affiprod-product__condition {
	padding: 3px 10px;
	color: var(--tb-text-light, #667085);
	background-color: var(--tb-background-soft, #f6f9f9);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.affiprod-product__title {
	margin: 0 0 18px;
	font-family: "Poppins", Arial, Helvetica, sans-serif;
	font-size: clamp(1.8rem, 3vw, 2.5rem);
	line-height: 1.2;
	color: var(--tb-heading, #202938);
}

/*
 * Price and QR code share a row - the QR code fills the empty space
 * to the right of the price on desktop, and wraps below the price on
 * narrow screens (see the max-width: 820px rule further down).
 */
.affiprod-product__price-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 18px;
}

.affiprod-product__prices {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 12px;
}

.affiprod-product__qr {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

.affiprod-product__qr-image {
	width: 64px;
	height: 64px;
	object-fit: contain;
	background-color: var(--tb-white, #ffffff);
	border: 1px solid var(--tb-border, #e2e8f0);
	border-radius: var(--tb-radius-small, 6px);
}

.affiprod-product__qr-label {
	color: var(--tb-text-light, #667085);
	font-size: 0.85rem;
}

.affiprod-product__previous-price {
	color: var(--tb-text-light, #667085);
	font-size: 1.05rem;
}

.affiprod-product__current-price {
	color: var(--tb-primary, #007a74);
	font-weight: 700;
	font-size: 1.8rem;
}

.affiprod-product__discount {
	color: var(--tb-alert, #ff6f61);
	font-size: 0.95rem;
	font-weight: 700;
}

/* Condensed spec strip under the price - a handful of specifics plus a jump link to the full table below */
.affiprod-product__quick-specs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	margin-bottom: 18px;
	padding: 12px 14px;
	background-color: var(--tb-background-soft, #f6f9f9);
	border-radius: var(--tb-radius-small, 6px);
	font-size: 0.85rem;
	color: var(--tb-text-light, #667085);
}

.affiprod-product__quick-spec strong {
	color: var(--tb-text, #344055);
}

.affiprod-product__quick-specs-more {
	margin-left: auto;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.affiprod-product__description {
	max-width: 60ch;
	margin-bottom: 20px;
	color: var(--tb-text, #344055);
	line-height: 1.7;
}

.affiprod-product__description > *:first-child {
	margin-top: 0;
}

.affiprod-product__description > *:last-child {
	margin-bottom: 0;
}

.affiprod-product__availability,
.affiprod-product__end-date {
	margin: 0 0 10px;
	color: var(--tb-text, #344055);
	font-size: 0.95rem;
	font-weight: 600;
}

.affiprod-product__section-title {
	margin: 26px 0 10px;
	color: var(--tb-heading, #202938);
	font-family: "Poppins", Arial, Helvetica, sans-serif;
	font-size: 1.1rem;
}

/* Item specifics - eBay-style two-column label/value spec sheet */
.affiprod-product__specifics-list {
	margin: 0;
	columns: 2;
	column-gap: 28px;
}

.affiprod-product__specifics-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid var(--tb-border, #e2e8f0);
	break-inside: avoid;
	font-size: 0.9rem;
}

.affiprod-product__specifics-row dt {
	color: var(--tb-text-light, #667085);
	font-weight: 600;
}

.affiprod-product__specifics-row dd {
	margin: 0;
	color: var(--tb-text, #344055);
	text-align: right;
}

.affiprod-product__shipping-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
	color: var(--tb-text, #344055);
	font-size: 0.92rem;
}

.affiprod-product__shipping-notes {
	margin: 0;
	color: var(--tb-text-light, #667085);
	font-size: 0.88rem;
	line-height: 1.6;
}

.affiprod-product__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	margin-top: 8px;
	padding: 14px 26px;
	color: #ffffff;
	background-color: var(--tb-primary, #007a74);
	border: 2px solid var(--tb-primary, #007a74);
	border-radius: var(--tb-radius-small, 6px);
	font-weight: 700;
	font-size: 1.05rem;
	text-decoration: none;
	transition: color var(--tb-transition, 180ms ease), background-color var(--tb-transition, 180ms ease);
}

.affiprod-product__cta:hover,
.affiprod-product__cta:focus-visible {
	color: var(--tb-primary, #007a74);
	background-color: transparent;
}

.affiprod-product__disclosure {
	max-width: 60ch;
	margin-top: 20px;
	color: var(--tb-text-light, #667085);
	font-size: 0.85rem;
	line-height: 1.6;
}

.affiprod-product__disclosure summary {
	cursor: pointer;
}

.affiprod-product__disclosure p {
	margin: 8px 0 0;
}

.affiprod-product__back {
	display: inline-block;
	margin-top: 40px;
	color: var(--tb-primary, #007a74);
	font-weight: 600;
	text-decoration: none;
}

.affiprod-product__back:hover {
	text-decoration: underline;
}

/* "Similar items" strip at the bottom of the single product page */
.affiprod-similar {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--tb-border, #e2e8f0);
}

.affiprod-similar__header {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin-bottom: 20px;
}

.affiprod-similar__title {
	margin: 0;
	color: var(--tb-heading, #202938);
	font-family: "Poppins", Arial, Helvetica, sans-serif;
	font-size: 1.4rem;
}

.affiprod-similar__label {
	color: var(--tb-text-light, #667085);
	font-size: 0.8rem;
}

.affiprod-similar__grid {
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* Responsive */

@media (max-width: 900px) {
	.affiprod-product__layout {
		display: flex;
		flex-direction: column;
	}

	.affiprod-product__viewer {
		/*
		 * Stays relative (not static) here on purpose - the prev/next
		 * arrows are position:absolute against this element. Dropping
		 * to static would remove it as their containing block, so
		 * they'd escape up to the next positioned ancestor (none) and
		 * pin themselves to the viewport edges instead of the image.
		 */
		position: relative;
		order: 1;
	}

	.affiprod-product__thumbs {
		position: static;
		order: 2;
		flex-direction: row;
		max-height: none;
		overflow-x: auto;
		overflow-y: visible;
	}

	.affiprod-product__thumbs .affiprod-product__thumb {
		flex: 0 0 64px;
		width: 64px;
	}

	.affiprod-product__info {
		order: 3;
	}
}

@media (max-width: 640px) {
	.affiprod-product__specifics-list {
		columns: 1;
	}
}

@media (max-width: 480px) {
	.affiprod-archive__container,
	.affiprod-product__container {
		width: min(100% - 24px, var(--tb-container-width, 1180px));
	}

	.affiprod-grid {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 16px;
	}
}
