/**
 * Related Products Widget Styles
 *
 * Card-based grid layout for related products with featured images and descriptions.
 *
 * @package SmartAcre\ProductDemo
 * @since 0.3.0
 */

/* ==========================================================================
   Container
   ========================================================================== */

.mep-related-products {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

/**
 * Flexbox grid with wrapping - 3 cards per row on desktop
 */
.mep-related-products__grid {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

/* ==========================================================================
   Card Styles
   ========================================================================== */

/**
 * Individual product card as clickable link
 * Width calculated for 3 per row with 20px gaps
 */
.mep-related-products__card {
	width: calc(33.333% - 14px);
	background: var(--mep-white, #ffffff);
	box-shadow: 0px 4px 42px rgba(0, 0, 0, 0.15) !important;
	border-radius: 16px;
	padding: 30px;
	display: flex;
	flex-direction: column;
	text-decoration: none !important;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.mep-related-products__card * {
	text-decoration: none !important;
}

.mep-related-products__card:hover {
	background: var(--mep-navy, #02244e);
	box-shadow: 0px 4px 42px rgba(0, 0, 0, 0.15) !important;
	cursor: pointer;
}

.mep-related-products__card:hover .mep-related-products__tag,
.mep-related-products__card:hover .mep-related-products__title,
.mep-related-products__card:hover .mep-related-products__description,
.mep-related-products__card:hover .mep-related-products__link,
.mep-related-products__card:hover .mep-related-products__arrow {
	color: #ffffff;
}

.mep-related-products__card:focus {
	outline: 2px solid var(--mep-navy, #02244e);
	outline-offset: 2px;
}

/* ==========================================================================
   Image Container
   ========================================================================== */

/**
 * Featured image container with gray background
 */
.mep-related-products__image-container {
	width: 100%;
	height: 166px;
	background: var(--mep-gray-bg, #f8fafc);
	border-radius: 7px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 40px;
	flex-shrink: 0;
}

.mep-related-products__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ==========================================================================
   Content Area
   ========================================================================== */

.mep-related-products__content {
	display: flex;
	flex-direction: column;
	gap: 20px;
	flex-grow: 1;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/**
 * Sub-category tag
 */
.mep-related-products__tag {
	margin: 0;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	font-size: 14px !important;
	font-weight: 600;
	line-height: 1.6;
	color: var(--mep-navy, #02244e);
	text-decoration: none !important;
	transition: color 0.2s ease;
}

/**
 * Product title
 */
.mep-related-products__title {
	margin: 0;
	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	font-size: 20px !important;
	font-weight: 700;
	line-height: 1.2;
	color: var(--mep-navy, #02244e);
	text-decoration: none !important;
	transition: color 0.2s ease;
}

/**
 * Descriptive names
 */
.mep-related-products__description {
	margin: 0;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	font-size: 16px !important;
	font-weight: 400;
	line-height: 1.6;
	color: #2e2e2e;
	text-decoration: none !important;
	transition: color 0.2s ease;
}

/* ==========================================================================
   Learn More Link
   ========================================================================== */

.mep-related-products__link {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 40px;
	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	font-size: 16px !important;
	font-weight: 600;
	line-height: 1.6;
	color: var(--mep-navy, #02244e);
	text-decoration: none !important;
	transition: color 0.2s ease;
}

.mep-related-products__link span {
	text-decoration: none !important;
	transition: color 0.2s ease;
}

.mep-related-products__arrow {
	transition: color 0.2s ease;
}

/* ==========================================================================
   No Image State
   ========================================================================== */

/**
 * When no featured image, adjust spacing
 */
.mep-related-products__card:not(:has(.mep-related-products__image-container)) .mep-related-products__content {
	padding-top: 0;
}

/* ==========================================================================
   Responsive Behavior
   ========================================================================== */

/**
 * Tablet breakpoint - 2 cards per row
 */
@media (max-width: 1024px) {
	.mep-related-products__card {
		width: calc(50% - 10px);
	}
}

/**
 * Mobile breakpoint - 1 card per row
 */
@media (max-width: 768px) {
	.mep-related-products__grid {
		flex-direction: column;
	}

	.mep-related-products__card {
		width: 100%;
	}

	.mep-related-products__image-container {
		height: 200px;
		margin-bottom: 30px;
	}

	.mep-related-products__link {
		margin-top: 30px;
	}
}

/**
 * Small mobile adjustments
 */
@media (max-width: 480px) {
	.mep-related-products__card {
		padding: 20px;
	}

	.mep-related-products__title {
		font-size: 18px !important;
	}

	.mep-related-products__description {
		font-size: 14px !important;
	}

	.mep-related-products__link {
		font-size: 14px !important;
		margin-top: 20px;
	}
}

/* ==========================================================================
   Elementor Editor Compatibility
   ========================================================================== */

/**
 * Ensure proper display in Elementor editor
 */
.elementor-editor-active .mep-related-products {
	min-height: 50px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.mep-related-products__grid {
		display: block;
	}

	.mep-related-products__card {
		width: 100%;
		box-shadow: none;
		border: 1px solid #e0e0e0;
		padding: 20px;
		margin-bottom: 20px;
		page-break-inside: avoid;
	}

	.mep-related-products__card:hover {
		transform: none;
		box-shadow: none;
	}

	.mep-related-products__image-container {
		height: 150px;
		margin-bottom: 20px;
	}

	.mep-related-products__link {
		margin-top: 20px;
	}

	.mep-related-products__arrow {
		display: none;
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/**
 * Ensure images are not interactive separately from the card
 * The entire card is the clickable area
 */
.mep-related-products__image {
	pointer-events: none;
}
