/**
 * LPM Display Widgets — Carousel & Category Grid
 * Styles for product/category displays and [lpm_top_sellers]
 * and their Elementor widget equivalents.
 *
 * @package Lucid_Pulse_Marketplace
 */

/* =============================================================
   SECTION WRAPPER & HEADING
   ============================================================= */
.lpm-widget-wrap {
	margin: 32px 0;
}

.lpm-section-title {
	font-size: 1.6rem;
	font-weight: 700;
	color: #1d2327;
	margin: 0 0 20px 0;
	line-height: 1.2;
}

/* =============================================================
   SWIPER OVERRIDES
   ============================================================= */
.lpm-carousel-outer {
	position: relative;
	padding: 0 44px;
}

.lpm-carousel-outer .swiper {
	overflow: hidden;
}

.lpm-carousel-outer .swiper-button-prev,
.lpm-carousel-outer .swiper-button-next {
	width: 36px;
	height: 36px;
	background: #1d2327;
	border-radius: 50%;
	color: #fff;
	top: 50%;
	transform: translateY(-50%);
	margin-top: 0;
}

.lpm-carousel-outer .swiper-button-prev {
	left: 0;
}

.lpm-carousel-outer .swiper-button-next {
	right: 0;
}

.lpm-carousel-outer .swiper-button-prev::after,
.lpm-carousel-outer .swiper-button-next::after {
	font-size: 14px;
	font-weight: 900;
}

.lpm-carousel-outer .swiper-button-prev:hover,
.lpm-carousel-outer .swiper-button-next:hover {
	background: #ff6c00;
}

.lpm-carousel-outer .swiper-button-disabled {
	opacity: 0.35;
	pointer-events: none;
}

.lpm-carousel-outer .swiper-pagination {
	position: relative;
	margin-top: 16px;
	bottom: auto;
}

.lpm-carousel-outer .swiper-pagination-bullet {
	background: #c3c4c7;
	opacity: 1;
}

.lpm-carousel-outer .swiper-pagination-bullet-active {
	background: #ff6c00;
}

/* =============================================================
   PRODUCT CARD — base styles (shared with products-listing)
   ============================================================= */
.lpm-product-card {
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
	transition: box-shadow .2s, transform .2s;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.lpm-product-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
	transform: translateY(-2px);
}

.lpm-product-card-image {
	position: relative;
	aspect-ratio: 1;
	background: #f0f0f1;
	overflow: hidden;
}

.lpm-product-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lpm-product-card-image .lpm-no-image {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: #a7aaad;
	font-size: 14px;
}

.lpm-badge {
	position: absolute;
	top: 10px;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
}

.lpm-badge-sale {
	right: 10px;
	background: #d63638;
	color: #fff;
}

.lpm-badge-featured {
	left: 10px;
	background: #2271b1;
	color: #fff;
}

.lpm-badge-outofstock {
	left: 10px;
	right: 10px;
	text-align: center;
	background: rgba(0, 0, 0, .7);
	color: #fff;
}

.lpm-product-card-body {
	padding: 16px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.lpm-product-card-title {
	color: #000 !important;
}

a.lpm-product-card-title-link {
	margin: 0 0 8px;
	font-size: 18px;
	line-height: 1.2;
	color: #000 !important;
	text-decoration: none;
	display: block;
}

.lpm-product-card-title a:hover {
	color: #2a2a2a !important;
}

.lpm-product-card-price {
	margin-bottom: 6px;
}

.lpm-product-card-price-wrap {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
}

.lpm-product-card-price-inner {
	display: contents;
}

.lpm-price-old {
	font-size: 13px;
	color: #ff0000;
	text-decoration: line-through;
	margin-right: 6px;
}

.lpm-price-current {
	font-size: 18px;
	font-weight: 700;
	color: #1d2327;
}

.lpm-product-card-stock-inner {
	display: inline-block;
	width: 100%;
	text-align: right;
	margin: 5px;
}

.lpm-product-card-stock {
	font-size: 12px;
	color: #fff !important;
	background-color: #ff6c00;
	padding: 5px 7px;
	border-radius: 5px;
}

.lpm-product-card-seller {
	padding: 0;
	margin: 0 0 8px;
}

.lpm-product-card-seller-link {
	color: #fff !important;
	text-decoration: none;
	font-weight: 500;
	font-size: 12px;
	background-color: #000;
	text-align: center;
	padding: 5px 8px;
	border-radius: 10px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
	width: 100%;
	display: flex;
	align-content: center;
	justify-content: center;
}

.lpm-product-card-seller-link:hover {
	color: #fff;
}

.lpm-product-card-actions {
	display: flex;
	gap: 8px;
	margin-top: auto;
	flex-wrap: nowrap;
}

.lpm-btn-sm {
	padding: 8px 14px;
	font-size: 13px;
	border-radius: 6px;
	text-decoration: none;
	font-weight: 600;
	display: inline-block;
	text-align: center;
	width: stretch;
	cursor: pointer;
	border: none;
}

.lpm-btn-primary {
	background: #fff !important;
	color: #000 !important;
	border: 1px solid #000 !important;
}

.lpm-btn-primary:hover {
	background: #1e1e1e !important;
	color: #fff !important;
}

.lpm-btn-secondary {
	background: #1e1e1e !important;
	color: #fff !important;
	border: 1px solid #000 !important;
}

.lpm-btn-secondary:hover {
	background: #fff !important;
	color: #000 !important;
}

/* Swiper slide height equalisation */
.lpm-featured-carousel .swiper-slide,
.lpm-category-carousel .swiper-slide {
	height: auto;
	display: flex;
}

.lpm-featured-carousel .swiper-slide .lpm-product-card {
	width: 100%;
}

/* Keep Elementor's dynamically-rendered preview useful until Swiper initialises. */
.elementor-editor-active .lpm-featured-carousel:not(.swiper-initialized) .swiper-wrapper,
.elementor-editor-active .lpm-category-carousel:not(.swiper-initialized) .swiper-wrapper {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
}

.elementor-editor-active .lpm-featured-carousel:not(.swiper-initialized) .swiper-slide,
.elementor-editor-active .lpm-category-carousel:not(.swiper-initialized) .swiper-slide {
	width: auto !important;
}

/* =============================================================
   CATEGORY TILE
   ============================================================= */
.lpm-category-tile {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	transition: box-shadow .2s, transform .2s;
	height: 100%;
	color: inherit;
}

.lpm-category-tile:hover {
	box-shadow: 0 6px 18px rgba(0, 0, 0, .1);
	transform: translateY(-2px);
	border-color: #ff6c00;
	text-decoration: none;
	color: inherit;
}

.lpm-category-tile-image {
	position: relative;
	width: 100%;
	/* Default aspect ratio — overridable via Elementor Style > Tile Image > Height */
	aspect-ratio: 16/9;
	background: #f0f0f1;
	overflow: hidden;
	flex-shrink: 0;
}

.lpm-category-tile-image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform .35s ease;
}

.lpm-category-tile:hover .lpm-category-tile-image img {
	transform: scale(1.04);
}

.lpm-category-tile-placeholder {
	font-size: 40px;
	color: #c3c4c7;
}

.lpm-category-tile-body {
	padding: 12px 14px 14px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.lpm-category-tile-name {
	font-size: 15px;
	font-weight: 700;
	color: #1d2327;
	line-height: 1.3;
	width: 100%;
}

.lpm-category-tile-count {
	font-size: 12px;
	color: #646970;
	width: 100%;
}

.lpm-category-image-shape-rounded .lpm-category-tile-image {
	border-radius: 16px;
}

.lpm-category-image-shape-circle .lpm-category-tile-image {
	aspect-ratio: 1 / 1 !important;
	border-radius: 50%;
}

/* Parent tile variant */
.lpm-category-tile--parent {
	border-width: 2px;
	border-color: #1d2327;
}

/* Child tile variant */
.lpm-category-tile--child .lpm-category-tile-name {
	font-size: 13px;
}

/* =============================================================
   CATEGORY GRID
   ============================================================= */
.lpm-category-grid-wrap {
	margin: 32px 0;
}

.lpm-category-grid {
	display: grid;
	gap: 20px;
}

.lpm-category-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.lpm-category-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.lpm-category-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.lpm-category-grid--cols-5 { grid-template-columns: repeat(5, 1fr); }
.lpm-category-grid--cols-6 { grid-template-columns: repeat(6, 1fr); }
.lpm-category-grid--cols-7 { grid-template-columns: repeat(7, 1fr); }
.lpm-category-grid--cols-8 { grid-template-columns: repeat(8, 1fr); }
.lpm-category-grid--cols-9 { grid-template-columns: repeat(9, 1fr); }

/* Sub-category two-tier layout */
.lpm-category-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.lpm-category-subgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 10px;
}

/* =============================================================
   CATEGORY CAROUSEL (Swiper)
   ============================================================= */
.lpm-category-carousel-wrap {
	margin: 32px 0;
}

.lpm-category-carousel .swiper-slide {
	height: auto;
	display: flex;
}

.lpm-category-carousel .swiper-slide .lpm-category-tile {
	width: 100%;
}

/* =============================================================
   TOP SELLERS
   ============================================================= */
.lpm-top-sellers {
	display: grid;
	gap: 20px;
}

.lpm-top-sellers--cols-1 { grid-template-columns: 1fr; }
.lpm-top-sellers--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lpm-top-sellers--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lpm-top-sellers--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lpm-top-sellers--cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lpm-top-sellers--cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.lpm-top-seller-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	padding: 24px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 16px;
	box-shadow: 0 3px 12px rgba(15, 23, 42, .06);
	text-align: center;
	transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.lpm-top-seller-card:hover {
	transform: translateY(-3px);
	border-color: #ff6c00;
	box-shadow: 0 10px 28px rgba(15, 23, 42, .12);
}

.lpm-top-seller-rank {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 28px;
	padding: 0 8px;
	background: #ff6c00;
	border-radius: 999px;
	color: #fff;
	font-size: 12px;
	font-weight: 800;
}

.lpm-top-seller-avatar {
	display: block;
	width: 112px;
	height: 112px;
	margin: 0 auto 16px;
	border: 4px solid #fff;
	border-radius: 50%;
	background: #f1f5f9;
	box-shadow: 0 0 0 1px #dbe3ec, 0 5px 16px rgba(15, 23, 42, .12);
	overflow: hidden;
	flex: 0 0 auto;
}

.lpm-top-seller-avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lpm-top-seller-avatar-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #1d2327, #475569);
	color: #fff;
	font-size: 38px;
	font-weight: 800;
}

.lpm-top-seller-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: inherit;
	width: 100%;
	min-width: 0;
}

.lpm-top-seller-align-left .lpm-top-seller-body { align-items: flex-start; }
.lpm-top-seller-align-center .lpm-top-seller-body { align-items: center; }
.lpm-top-seller-align-right .lpm-top-seller-body { align-items: flex-end; }
.lpm-top-seller-align-left .lpm-top-seller-rating,
.lpm-top-seller-align-left .lpm-top-seller-stats { justify-content: flex-start; }
.lpm-top-seller-align-center .lpm-top-seller-rating,
.lpm-top-seller-align-center .lpm-top-seller-stats { justify-content: center; }
.lpm-top-seller-align-right .lpm-top-seller-rating,
.lpm-top-seller-align-right .lpm-top-seller-stats { justify-content: flex-end; }

.lpm-top-seller-name {
	margin: 0 0 8px;
	font-size: 19px;
	line-height: 1.25;
}

.lpm-top-seller-name a {
	color: #172033;
	text-decoration: none;
}

.lpm-top-seller-name a:hover {
	color: #ff6c00;
}

.lpm-top-seller-rating {
	display: flex;
	align-items: center;
	justify-content: inherit;
	gap: 5px;
	margin-bottom: 12px;
	color: #172033;
}

.lpm-top-seller-rating > span {
	color: #f59e0b;
	font-size: 17px;
	line-height: 1;
}

.lpm-top-seller-rating small {
	color: #64748b;
}

.lpm-top-seller-stats {
	display: flex;
	justify-content: inherit;
	gap: 8px;
	width: 100%;
	margin-bottom: 10px;
	color: #526072;
	font-size: 12px;
}

.lpm-top-seller-stats span {
	display: inline-flex;
	gap: 3px;
	padding: 5px 8px;
	background: #f1f5f9;
	border-radius: 999px;
}

.lpm-top-seller-location {
	margin: 0 0 14px;
	color: #64748b;
	font-size: 13px;
}

.lpm-top-seller-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	margin-top: auto;
	padding: 9px 18px;
	background: #1d2327;
	border-radius: 8px;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.lpm-top-seller-button:hover {
	background: #ff6c00;
	color: #fff;
	transform: translateY(-1px);
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 1024px) {
	.lpm-top-sellers--cols-4,
	.lpm-top-sellers--cols-5,
	.lpm-top-sellers--cols-6 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.lpm-category-grid--cols-5,
	.lpm-category-grid--cols-6,
	.lpm-category-grid--cols-7,
	.lpm-category-grid--cols-8,
	.lpm-category-grid--cols-9 {
		grid-template-columns: repeat(3, 1fr);
	}

	.lpm-category-grid--cols-4 {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.lpm-carousel-outer {
		padding: 0 32px;
	}

	.lpm-category-grid--cols-2,
	.lpm-category-grid--cols-3,
	.lpm-category-grid--cols-4,
	.lpm-category-grid--cols-5,
	.lpm-category-grid--cols-6,
	.lpm-category-grid--cols-7,
	.lpm-category-grid--cols-8,
	.lpm-category-grid--cols-9 {
		grid-template-columns: repeat(2, 1fr);
	}

	.lpm-section-title {
		font-size: 1.3rem;
	}

	.lpm-top-sellers--cols-3,
	.lpm-top-sellers--cols-4,
	.lpm-top-sellers--cols-5,
	.lpm-top-sellers--cols-6 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.lpm-carousel-outer {
		padding: 0 28px;
	}

	.lpm-category-grid--cols-2,
	.lpm-category-grid--cols-3,
	.lpm-category-grid--cols-4,
	.lpm-category-grid--cols-5,
	.lpm-category-grid--cols-6,
	.lpm-category-grid--cols-7,
	.lpm-category-grid--cols-8,
	.lpm-category-grid--cols-9 {
		grid-template-columns: 1fr 1fr;
	}

	.lpm-top-sellers--cols-2,
	.lpm-top-sellers--cols-3,
	.lpm-top-sellers--cols-4,
	.lpm-top-sellers--cols-5,
	.lpm-top-sellers--cols-6 {
		grid-template-columns: 1fr;
	}
}
