/**
 * CartNexa Related Products Widget CSS
 * Isolated per-widget styling with luxury baby aesthetic
 */

.cn-related-products-wrapper {
	width: 100%;
	font-family: var(--cn-font-family, sans-serif);
	box-sizing: border-box;
}

.cn-rel-header {
	margin-bottom: 20px;
}

.cn-rel-header-title {
	font-size: 22px;
	font-weight: 800;
	color: var(--cn-dark, #233547);
	margin: 0;
}

.cn-rel-track {
	display: grid;
	gap: 20px;
}

/* Column Rules */
.cn-cols-2 .cn-rel-track { grid-template-columns: repeat(2, 1fr); }
.cn-cols-3 .cn-rel-track { grid-template-columns: repeat(3, 1fr); }
.cn-cols-4 .cn-rel-track { grid-template-columns: repeat(4, 1fr); }

/* Native Touch Carousel Mode */
.cn-rel-layout-carousel .cn-rel-track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 8px;
}

.cn-rel-layout-carousel .cn-rel-track::-webkit-scrollbar {
	display: none;
}

.cn-rel-layout-carousel .cn-rel-card-col {
	flex: 0 0 280px;
	scroll-snap-align: start;
}

/* Product Card Base */
.cn-rel-card {
	background-color: #FFFFFF;
	border: 1px solid var(--cn-border, #E6EEF2);
	border-radius: var(--cn-radius, 18px);
	padding: 16px;
	display: flex;
	flex-direction: column;
	height: 100%;
	box-sizing: border-box;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 2px 8px rgba(35, 53, 71, 0.04);
}

.cn-rel-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(35, 53, 71, 0.08);
	border-color: var(--cn-primary, #25C4C8);
}

/* Thumbnail Container */
.cn-rel-card-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	overflow: hidden;
	background-color: var(--cn-soft-bg, #F8FCFD);
	margin-bottom: 14px;
}

.cn-rel-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.cn-rel-card:hover .cn-rel-img {
	transform: scale(1.06);
}

/* Sale Badge */
.cn-rel-sale-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background-color: #EF4444;
	color: #FFFFFF;
	font-size: 10px;
	font-weight: 800;
	padding: 3px 8px;
	border-radius: 50px;
	z-index: 2;
	letter-spacing: 0.5px;
}

/* Details Body */
.cn-rel-card-body {
	display: flex;
	flex-direction: column;
	flex: 1;
}

.cn-rel-rating {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}

.cn-rel-stars {
	position: relative;
	display: inline-flex;
	line-height: 0;
}

.cn-rel-stars-bg,
.cn-rel-stars-fg {
	display: flex;
	gap: 2px;
}

.cn-rel-stars-bg svg {
	width: 12px;
	height: 12px;
	fill: #E4E7EC;
	flex-shrink: 0;
}

.cn-rel-stars-fg {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	white-space: nowrap;
}

.cn-rel-stars-fg svg {
	width: 12px;
	height: 12px;
	fill: #FFC107;
	flex-shrink: 0;
}

.cn-rel-review-count {
	font-size: 12px;
	color: var(--cn-body, #667085);
	font-weight: 600;
}

.cn-rel-card-title {
	font-size: 15px;
	font-weight: 700;
	margin: 0 0 8px 0;
	line-height: 1.3;
}

.cn-rel-card-title a {
	color: var(--cn-dark, #233547);
	text-decoration: none;
	transition: color 0.2s ease;
}

.cn-rel-card-title a:hover {
	color: var(--cn-primary, #25C4C8);
}

.cn-rel-card-price {
	font-size: 16px;
	font-weight: 800;
	color: var(--cn-primary, #25C4C8);
	margin-bottom: 14px;
	margin-top: auto;
}

.cn-rel-card-price del {
	color: var(--cn-body, #667085);
	font-weight: 500;
	font-size: 14px;
	margin-right: 4px;
}

.cn-rel-card-price ins {
	text-decoration: none;
}

/* Quick Add / Action Button Base (Scoped Widget CSS - Theme Override Reset) */
.cn-related-products-wrapper a.cn-rel-add-btn,
.cn-related-products-wrapper button.cn-rel-add-btn,
.cn-related-products-wrapper .cn-rel-add-btn {
	width: 100%;
	height: 50px;
	min-height: 50px;
	padding: 12px 20px;
	background-color: #EAF9FC;
	color: #18C6D9;
	font-family: var(--cn-font-family, inherit);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	border: none;
	border-radius: 18px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-decoration: none;
	outline: none;
	box-shadow: none;
	transition: all 0.3s ease;
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
}

.cn-related-products-wrapper a.cn-rel-add-btn span,
.cn-related-products-wrapper button.cn-rel-add-btn span,
.cn-related-products-wrapper .cn-rel-add-btn span {
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
}

.cn-related-products-wrapper a.cn-rel-add-btn svg,
.cn-related-products-wrapper button.cn-rel-add-btn svg,
.cn-related-products-wrapper .cn-rel-add-btn svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	fill: none;
	flex-shrink: 0;
	transition: all 0.3s ease;
}

/* Hover State Default */
.cn-related-products-wrapper a.cn-rel-add-btn:hover,
.cn-related-products-wrapper button.cn-rel-add-btn:hover,
.cn-related-products-wrapper .cn-rel-add-btn:hover,
.cn-related-products-wrapper a.cn-rel-add-btn:focus,
.cn-related-products-wrapper button.cn-rel-add-btn:focus,
.cn-related-products-wrapper .cn-rel-add-btn:focus {
	background-color: #18C6D9;
	color: #FFFFFF;
	text-decoration: none;
	outline: none;
	box-shadow: none;
}

.cn-related-products-wrapper a.cn-rel-add-btn:hover svg,
.cn-related-products-wrapper button.cn-rel-add-btn:hover svg,
.cn-related-products-wrapper .cn-rel-add-btn:hover svg {
	stroke: #FFFFFF;
}

/* Responsive Rules */
@media (max-width: 768px) {
	.cn-cols-3 .cn-rel-track,
	.cn-cols-4 .cn-rel-track {
		grid-template-columns: repeat(2, 1fr);
	}
}
