/**
 * MP Platform Pro — carousel, masonry, playlist, spotlight layouts.
 *
 * @package MP_Platform_Pro
 */

/**
 * Shared track card — MP Pro Carousel + Masonry (same surface; layout wrappers differ only).
 */
.mp-pro-track-card.mp-grid-item {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 0;
	overflow: hidden;
	border-radius: var(--mp-radius, 12px);
	background: var(--mp-card-bg, rgba(255, 255, 255, 0.06));
	border: 1px solid var(--mp-border, rgba(255, 255, 255, 0.12));
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
	box-sizing: border-box;
	transition:
		transform 0.22s ease,
		box-shadow 0.22s ease;
}

.mp-pro-track-card.mp-grid-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

/* Full-bleed cover region — fixed aspect for both widgets */
.mp-pro-track-card__media {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	min-height: 160px;
	/* Was 340px: too low vs column width when the Elementor widget is resized wide — face stopped scaling. */
	max-height: min(92vw, 800px);
	overflow: hidden;
	background-color: var(--mp-cover-placeholder, #2a2a2e);
}

.mp-pro-track-card__cover.mp-grid-cover {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	min-height: 100% !important;
	border-radius: 0 !important;
	background-size: cover !important;
	background-position: center !important;
	background-repeat: no-repeat !important;
}

.mp-pro-track-card__overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 1;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.58) 0%,
		rgba(0, 0, 0, 0.12) 42%,
		rgba(0, 0, 0, 0) 65%
	);
}

.mp-pro-track-card__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px 14px 14px;
	flex: 1 1 auto;
	min-width: 0;
}

.mp-pro-track-card .mp-grid-title {
	margin: 0;
	font-weight: 600;
	font-size: 0.95rem;
	line-height: 1.3;
	color: var(--mp-text, rgba(255, 255, 255, 0.96));
}

.mp-pro-track-card .mp-grid-artist {
	margin: 0;
	font-size: 0.85rem;
	line-height: 1.35;
	color: var(--mp-text-muted, rgba(255, 255, 255, 0.68));
}

.mp-pro-track-card .mp-grid-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.mp-pro-track-card .mp-play-track,
.mp-pro-track-card .mp-pro-track-card__play {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin: 0;
	padding: 10px 14px;
	border: none;
	border-radius: calc(var(--mp-radius, 12px) * 0.5);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	box-sizing: border-box;
	background: var(--mp-accent, #3b82f6);
	color: #fff;
	transition:
		opacity 0.18s ease,
		transform 0.15s ease;
}

.mp-pro-track-card .mp-play-track:hover,
.mp-pro-track-card .mp-pro-track-card__play:hover {
	opacity: 0.93;
	transform: scale(1.01);
}

/* Carousel: horizontal row only */
.mp-pro-carousel {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 8px;
	-webkit-overflow-scrolling: touch;
}

.mp-pro-carousel .mp-pro-carousel__item.mp-pro-track-card {
	flex: 0 0 min(280px, 78vw);
	max-width: min(280px, 78vw);
	scroll-snap-align: start;
}

/* Masonry: columns only */
.mp-pro-masonry {
	column-count: 3;
	column-gap: 16px;
	width: 100%;
	max-width: 100%;
}

.elementor-element.elementor-widget-mp-pro-track-masonry .elementor-widget-container {
	width: 100%;
	max-width: 100%;
}

@media (max-width: 767px) {
	.mp-pro-masonry {
		column-count: 1;
	}
}

/* Column layout: flex-level children need inline-level participation or width collapses to 0. */
.mp-pro-masonry .mp-pro-masonry__item.mp-pro-track-card {
	display: inline-flex;
	flex-direction: column;
	width: 100%;
	vertical-align: top;
	break-inside: avoid;
	margin-bottom: 16px;
	box-sizing: border-box;
	/* Keep artwork flush: generic `.mp-grid-item` padding must not inset `.mp-pro-track-card__media`. */
	padding: 0;
	gap: 0;
}

/*
 * Single-card masonry: fixed column-count leaves empty column tracks. Use one column.
 * Avoid `width: fit-content` on `.elementor-widget-container` — inside flex rows it can
 * intrinsic-size to 0 and hide the widget on the live front-end; editor iframe often differs.
 */
.elementor-element.elementor-widget-mp-pro-track-masonry:has(
		.mp-pro-masonry > .mp-pro-masonry__item:only-child
	) {
	align-self: flex-start;
	flex-shrink: 0;
	max-width: 100%;
}

.elementor-element.elementor-widget-mp-pro-track-masonry
	.mp-pro-masonry:has(> .mp-pro-masonry__item:only-child) {
	column-count: 1;
	display: inline-block;
	vertical-align: top;
	max-width: 100%;
}

.elementor-element.elementor-widget-mp-pro-track-masonry
	.mp-pro-masonry:has(> .mp-pro-masonry__item:only-child)
	> .mp-pro-masonry__item {
	width: auto;
	max-width: 100%;
}

.mp-pro-playlist {
	display: flex;
	flex-direction: column;
	gap: 0;
	border-radius: var(--mp-radius, 12px);
	overflow: hidden;
	border: 1px solid var(--mp-border, rgba(255, 255, 255, 0.1));
}

.mp-pro-playlist__row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--mp-border, rgba(255, 255, 255, 0.08));
	background: var(--mp-bg-alt, #181818);
}

.mp-pro-playlist__row .mp-row-cover {
	width: 40px;
	height: 40px;
	border-radius: calc(var(--mp-radius, 12px) / 2);
	background: rgba(255, 255, 255, 0.06) center / cover no-repeat;
	flex-shrink: 0;
}

.mp-pro-playlist__row:last-child {
	border-bottom: none;
}

/* MP Pro Playlist — Minimal preset (assets/presets/playlist_minimal.json) */
.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist {
	background-color: #ffffff;
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	overflow: hidden;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row {
	gap: 2px 12px;
	padding: 14px 18px;
	border-bottom: 1px solid #e5e5e5;
	background: #ffffff;
	color: #111111;
	font-size: 16px;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row:nth-child(even) {
	background: #fafafa;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row:hover {
	background: #f2f2f2;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row .mp-row-title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: #111111;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row .mp-row-artist {
	font-size: 14px;
	color: #666666;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row .mp-row-duration {
	font-size: 13px;
	color: #777777;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row .mp-row-cover {
	width: 56px;
	height: 56px;
	border-radius: 4px;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row .mp-play-track {
	min-height: 32px;
	min-width: 32px;
	padding: 0 12px;
	box-sizing: border-box;
	font-size: 13px;
	line-height: 1.2;
	border-radius: 6px;
	border: 1px solid #dcdcdc;
	background: #ffffff;
	color: #111111;
}

.mp-widget.mp-theme-playlist_minimal .mp-pro-playlist__row .mp-play-track:hover {
	background: #f2f2f2;
	color: #000000;
	border-color: #dcdcdc;
}

/* MP Pro Playlist — Dark preset (assets/presets/playlist_dark.json) */
.mp-widget.mp-theme-playlist_dark .mp-pro-playlist {
	background-color: #1a1a1a;
	border: 1px solid #2a2a2a;
	border-radius: 6px;
	overflow: hidden;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row {
	gap: 2px 12px;
	padding: 14px 18px;
	border-bottom: 1px solid #2a2a2a;
	background: #1a1a1a;
	color: #ffffff;
	font-size: 16px;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row:nth-child(even) {
	background: #1f1f1f;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row:hover {
	background: #2a2a2a;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row .mp-row-title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: #ffffff;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row .mp-row-artist {
	font-size: 14px;
	color: #cccccc;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row .mp-row-duration {
	font-size: 13px;
	color: #bbbbbb;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row .mp-row-cover {
	width: 56px;
	height: 56px;
	border-radius: 4px;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row .mp-play-track {
	min-height: 32px;
	min-width: 32px;
	padding: 0 12px;
	box-sizing: border-box;
	font-size: 13px;
	line-height: 1.2;
	border-radius: 6px;
	border: 1px solid #444444;
	background: #333333;
	color: #ffffff;
}

.mp-widget.mp-theme-playlist_dark .mp-pro-playlist__row .mp-play-track:hover {
	background: #444444;
	color: #ffffff;
	border-color: #444444;
}

/* MP Pro Playlist — Light preset (assets/presets/playlist_light.json) */
.mp-widget.mp-theme-playlist_light .mp-pro-playlist {
	background-color: #ffffff;
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	overflow: hidden;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row {
	gap: 2px 12px;
	padding: 14px 18px;
	border-bottom: 1px solid #e8e8e8;
	background: #ffffff;
	color: #222222;
	font-size: 16px;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row:nth-child(even) {
	background: #fafafa;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row:hover {
	background: #f2f2f2;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row .mp-row-title {
	font-size: 16px;
	font-weight: 500;
	line-height: 1.3;
	color: #222222;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row .mp-row-artist {
	font-size: 14px;
	color: #777777;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row .mp-row-duration {
	font-size: 13px;
	color: #777777;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row .mp-row-cover {
	width: 56px;
	height: 56px;
	border-radius: 4px;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row .mp-play-track {
	min-height: 32px;
	min-width: 32px;
	padding: 0 12px;
	box-sizing: border-box;
	font-size: 13px;
	line-height: 1.2;
	border-radius: 6px;
	border: 1px solid #dddddd;
	background: #ffffff;
	color: #444444;
}

.mp-widget.mp-theme-playlist_light .mp-pro-playlist__row .mp-play-track:hover {
	background: #f0f0f0;
	color: #000000;
	border-color: #dddddd;
}

.mp-pro-artist-spotlight {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 24px;
	border-radius: var(--mp-radius, 12px);
	background: var(--mp-card-bg, rgba(255, 255, 255, 0.05));
	border: 1px solid var(--mp-border, rgba(255, 255, 255, 0.1));
	box-sizing: border-box;
}

/* Tighten widget footprint in flex layouts (same class of issue as Masonry). */
.elementor-element.elementor-widget-mp-pro-artist-spotlight {
	align-self: flex-start;
	flex-shrink: 0;
	max-width: 100%;
}

.mp-pro-artist-spotlight__row {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 24px;
	box-sizing: border-box;
}

/* Hero: wrapper only — no full-area background here (cover image lives on .mp-grid-cover; avoids masking inline background-image). */
.mp-pro-artist-spotlight__hero {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	box-sizing: border-box;
	/* Do not flex-grow to full row width: keeps hero column hugging the card, headline uses remaining space. */
	flex: 0 1 auto;
	align-self: flex-start;
	min-width: min(100%, 150px);
	width: auto;
	max-width: 100%;
	min-height: 200px;
	overflow: hidden;
	border-radius: var(--mp-radius, 12px);
	background: transparent !important;
}

.mp-pro-artist-spotlight__content {
	flex: 1 1 240px;
	min-width: 0;
}

/* Prevent grid/flex shrink from collapsing the cover column to 0 width/height (background needs a real box). */
.mp-pro-artist-spotlight__hero .mp-pro-track-card.mp-grid-item {
	width: 100%;
	min-width: 150px;
}

/* Ensure the card media box paints a visible region when grid sizing is odd (background-image needs non-zero area). */
.mp-pro-artist-spotlight__hero .mp-pro-track-card__media {
	position: relative !important;
	width: 100%;
	min-width: 150px;
	min-height: 200px !important;
	aspect-ratio: 1 / 1 !important;
	/* Default: do not inherit shared track-card grey behind the cover (it reads as “stuck placeholder”). */
	background-color: transparent;
}

/* Grey placeholder only when no manual image is selected (see PHP: .mp-pro-artist-spotlight__media--has-image). */
.mp-pro-artist-spotlight__hero .mp-pro-track-card__media:not(.mp-pro-artist-spotlight__media--has-image) {
	background-color: var(--mp-cover-placeholder, #2a2a2e);
}

/* Clip to spotlight column; __media inside still owns aspect-ratio + placeholder bg */
.mp-pro-artist-spotlight__hero .mp-pro-artist-spotlight__hero-media {
	max-width: 100%;
}

/* Cover image above media; gradient overlay above cover */
.mp-pro-artist-spotlight__hero .mp-pro-track-card__cover.mp-grid-cover {
	z-index: 2;
	min-height: 100%;
	height: 100%;
	min-width: 150px;
}

.mp-pro-artist-spotlight__hero .mp-pro-track-card__overlay {
	z-index: 6 !important;
}

.mp-pro-artist-spotlight__actions {
	display: flex;
	justify-content: flex-start;
	flex-wrap: wrap;
	gap: 8px;
}

.mp-pro-artist-spotlight__actions .mp-play-track {
	margin: 0;
}

/* -------------------------------------------------------------------------
   Template pack — admin + Elementor modal
   ------------------------------------------------------------------------- */
.mp-template-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
	margin-top: 20px;
	max-width: 1200px;
}

.mp-template-gallery--modal {
	max-height: min(70vh, 640px);
	overflow-y: auto;
	padding: 4px 0 12px;
}

.mp-template-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mp-template-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.mp-template-card__thumb {
	aspect-ratio: 16 / 9;
	background: #1d2327;
	overflow: hidden;
}

.mp-template-card__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mp-template-card__placeholder {
	width: 100%;
	height: 100%;
	min-height: 140px;
	background: linear-gradient(135deg, #2c3338 0%, #1d2327 100%);
}

.mp-template-card__body {
	padding: 14px 16px 16px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mp-template-card__title {
	margin: 0;
	font-size: 15px;
	line-height: 1.35;
}

.mp-template-card__desc {
	margin: 0;
	font-size: 13px;
	color: #646970;
	line-height: 1.45;
	flex: 1;
}

.mp-template-card__actions {
	margin: 0;
	padding-top: 4px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* Elementor modal (in #wpbody or editor canvas context) */
#mp-platform-pro-template-modal-root .mp-platform-pro-modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

#mp-platform-pro-template-modal-root .mp-platform-pro-modal {
	background: #fff;
	border-radius: 8px;
	max-width: 960px;
	width: 100%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}

#mp-platform-pro-template-modal-root .mp-platform-pro-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid #dcdcde;
}

#mp-platform-pro-template-modal-root .mp-platform-pro-modal__head h2 {
	margin: 0;
	font-size: 16px;
}

#mp-platform-pro-template-modal-root .mp-platform-pro-modal__close {
	font-size: 22px;
	line-height: 1;
	padding: 4px 8px;
	color: #50575e;
}

#mp-platform-pro-template-modal-root .mp-template-gallery--modal {
	padding: 16px 18px 20px;
}

/* Editor panel button (minimal) */
#mp-platform-pro-template-btn i {
	font-size: 18px;
}

