/**
 * Public: plugin site header bar, listing layouts, parent hub, subcategory grid, single product gallery.
 */

/* Optional top bar (logo + primary menu) when theme is not Astra / Crack Best Deals — avoids duplicate masthead */
.crbd-plugin-site-header {
	background: var(--crbd-plugin-header-bg, #ffffff);
	border-bottom: 1px solid rgba(15, 23, 42, 0.08);
	box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
	margin-bottom: 0;
}

.crbd-plugin-site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	padding: 0.85rem 0;
	min-height: 56px;
}

.crbd-plugin-site-header__brand {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
}

.crbd-plugin-site-header__brand .custom-logo-link,
.crbd-plugin-site-header__brand .custom-logo {
	display: block;
	line-height: 0;
}

.crbd-plugin-site-header__brand .custom-logo {
	max-height: 48px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.crbd-plugin-site-header__title {
	font-size: 1.25rem;
	font-weight: 700;
	text-decoration: none;
	color: #0c1222;
}

.crbd-plugin-site-header__title:hover {
	color: #2563eb;
}

.crbd-plugin-site-header__nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: flex-end;
	min-width: 0;
}

.crbd-plugin-site-header__menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 0.35rem 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.crbd-plugin-site-header__menu a {
	text-decoration: none;
	font-weight: 600;
	font-size: 0.95rem;
	color: #334155;
}

.crbd-plugin-site-header__menu a:hover {
	color: #2563eb;
}

@media (max-width: 782px) {
	.crbd-plugin-site-header__inner {
		flex-direction: column;
		align-items: stretch;
	}

	.crbd-plugin-site-header__nav {
		justify-content: flex-start;
		width: 100%;
		border-top: 1px solid rgba(15, 23, 42, 0.06);
		padding-top: 0.75rem;
	}

	.crbd-plugin-site-header__menu {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}
}

/* Theme masthead (Astra / child theme) stays above product templates */
body.crbd-affiliate-single-product #masthead,
body.crbd-affiliate-single-product .site-header,
body.crbd-affiliate-single-product .ast-primary-header-bar,
body.crbd-affiliate-tax-archive #masthead,
body.crbd-affiliate-tax-archive .site-header,
body.crbd-affiliate-tax-archive .ast-primary-header-bar,
body.crbd-affiliate-subcategory-listing #masthead,
body.crbd-affiliate-subcategory-listing .site-header,
body.crbd-affiliate-subcategory-listing .ast-primary-header-bar,
body.crbd-affiliate-parent-category-hub #masthead,
body.crbd-affiliate-parent-category-hub .site-header,
body.crbd-affiliate-parent-category-hub .ast-primary-header-bar {
	position: relative;
	z-index: 100;
}

/* Archive title + intro (left-aligned) */
.crbd-archive-header {
	text-align: left;
	margin: 0 0 1.75rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid #e5e5e5;
}

.crbd-archive-header .crbd-archive-title,
.crbd-archive-header .page-title {
	margin: 0 0 0.65rem;
	font-size: clamp(1.5rem, 2.5vw, 2.15rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: #1a1a1a;
}

.crbd-archive-description,
.crbd-archive-header .archive-description {
	margin: 0;
	max-width: 52rem;
	font-size: 1rem;
	line-height: 1.55;
	color: #4a4a4a;
}

.crbd-archive-description p:last-child {
	margin-bottom: 0;
}

/* Main column + optional widget sidebar */
.crbd-listing-layout {
	display: grid;
	gap: 2rem;
	align-items: start;
}

@media (min-width: 992px) {
	.crbd-listing-layout.has-sidebar {
		grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
	}
}

.crbd-listing-primary {
	min-width: 0;
}

.crbd-listing-aside {
	position: sticky;
	top: 1rem;
	padding: 1.25rem;
	background: #fafafa;
	border: 1px solid #eaeaea;
	border-radius: 10px;
	font-size: 0.95rem;
}

.crbd-listing-aside .widget {
	margin: 0 0 1.5rem;
}

.crbd-listing-aside .widget:last-child {
	margin-bottom: 0;
}

.crbd-listing-aside .widget-title {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	font-weight: 700;
	color: #1a1a1a;
}

@media (max-width: 991px) {
	.crbd-listing-aside {
		position: static;
	}
}

.crbd-parent-hub .crbd-subcat-block {
	margin-bottom: 2.5rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid #e8e8e8;
}

.crbd-parent-hub .crbd-subcat-block:last-child {
	border-bottom: 0;
}

.crbd-parent-hub .crbd-subcat-title {
	margin: 0 0 1rem;
	font-size: 1.35rem;
}

.crbd-parent-hub .crbd-preview-grid {
	display: grid;
	gap: 1rem;
	margin-bottom: 0.75rem;
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.crbd-parent-hub .crbd-preview-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 900px) {
	.crbd-parent-hub .crbd-preview-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 992px) and (max-width: 1199px) {
	.crbd-listing-layout.has-sidebar .crbd-parent-hub .crbd-preview-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1200px) {
	.crbd-listing-layout.has-sidebar .crbd-parent-hub .crbd-preview-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.crbd-parent-hub .crbd-preview-grid .crbd-product-card {
	display: flex;
	flex-direction: column;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	padding: 1rem;
	background: #fff;
}

.crbd-parent-hub .crbd-card-image {
	display: block;
	margin: 0 0 0.75rem;
	border-radius: 8px;
	overflow: hidden;
	background: #f5f5f5;
}

.crbd-parent-hub .crbd-card-image img {
	width: 100%;
	height: auto;
	vertical-align: middle;
}

.crbd-parent-hub .crbd-card-title {
	font-size: 1.05rem;
	margin: 0 0 0.5rem;
}

.crbd-parent-hub .crbd-card-title a {
	text-decoration: none;
}

.crbd-parent-hub .crbd-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: auto;
	padding-top: 0.75rem;
}

.crbd-parent-hub .crbd-btn {
	display: inline-block;
	padding: 0.5rem 0.85rem;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	border: 0;
	cursor: pointer;
}

.crbd-parent-hub .crbd-btn--amazon {
	background: #ff9900;
	color: #111;
}

.crbd-parent-hub .crbd-btn--flipkart {
	background: #2874f0;
	color: #fff;
}

.crbd-parent-hub .crbd-btn--details {
	background: #232f3e;
	color: #fff;
}

.crbd-parent-hub .crbd-view-all {
	display: inline-block;
	font-weight: 600;
}

/* Product cards: 3 columns (2 with narrow main + sidebar until xl) */
.crbd-subcategory-products .crbd-product-grid-3col,
.crbd-tax-product-list .crbd-product-grid-3col {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.crbd-subcategory-products .crbd-product-grid-3col,
	.crbd-tax-product-list .crbd-product-grid-3col {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 900px) {
	.crbd-subcategory-products .crbd-product-grid-3col,
	.crbd-tax-product-list .crbd-product-grid-3col {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 992px) and (max-width: 1199px) {
	.crbd-listing-layout.has-sidebar .crbd-product-grid-3col {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1200px) {
	.crbd-listing-layout.has-sidebar .crbd-product-grid-3col {
		grid-template-columns: repeat(3, 1fr);
	}
}

.crbd-subcategory-products .crbd-product-card {
	display: flex;
	flex-direction: column;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	padding: 1rem;
	background: #fff;
}

.crbd-subcategory-products .crbd-card-image {
	display: block;
	margin: 0 0 0.75rem;
	border-radius: 8px;
	overflow: hidden;
	background: #f5f5f5;
}

.crbd-subcategory-products .crbd-card-image img {
	width: 100%;
	height: auto;
	vertical-align: middle;
}

.crbd-subcategory-products .crbd-card-title {
	font-size: 1.1rem;
	margin: 0 0 0.5rem;
}

.crbd-subcategory-products .crbd-card-title a {
	text-decoration: none;
}

.crbd-subcategory-products .crbd-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: auto;
	padding-top: 0.75rem;
}

.crbd-subcategory-products .crbd-btn {
	display: inline-block;
	padding: 0.5rem 0.85rem;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	border: 0;
	cursor: pointer;
}

.crbd-subcategory-products .crbd-btn--amazon {
	background: #ff9900;
	color: #111;
}

.crbd-subcategory-products .crbd-btn--flipkart {
	background: #2874f0;
	color: #fff;
}

.crbd-subcategory-products .crbd-btn--details {
	background: #232f3e;
	color: #fff;
}

/* Single: main + thumbs */
.crbd-single-product .crbd-product-media {
	margin: 1.25rem 0 1.5rem;
}

.crbd-single-product .crbd-product-main {
	margin: 0 0 0.75rem;
	border-radius: 10px;
	overflow: hidden;
	background: #f5f5f5;
	text-align: center;
}

.crbd-single-product .crbd-product-main img {
	width: 100%;
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

.crbd-single-product .crbd-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.crbd-single-product .crbd-thumb {
	padding: 0;
	margin: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	cursor: pointer;
	background: #f0f0f0;
	line-height: 0;
}

.crbd-single-product .crbd-thumb.is-active {
	border-color: #111;
}

.crbd-single-product .crbd-thumb img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	display: block;
}

@media (min-width: 600px) {
	.crbd-single-product .crbd-thumb img {
		width: 80px;
		height: 80px;
	}
}

.crbd-single-product .crbd-description p {
	margin: 0 0 0.5rem;
}

.crbd-single-product .crbd-entry {
	margin-top: 1.5rem;
}
