/* =========================================================
   MrWin Radio Player
   ========================================================= */

.mrwin-radio-player {
	display: flex;
	align-items: stretch;
	background: #2d2d2d;
	border-radius: 6px;
	overflow: hidden;
	max-width: 100%;
	color: #fff;
	font-family: inherit;
	line-height: 1.2;
	box-sizing: border-box;
}

/* ----- Cover image — padded inset thumbnail ----- */

.mrwin-radio-cover {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	padding: 12px 0 12px 12px;
}

.mrwin-radio-cover img {
	display: block;
	width: 120px;
	height: 120px;
	border-radius: 6px;
	object-fit: cover;
	object-position: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
	flex-shrink: 0;
}

/* ----- Body (right of cover) ----- */

.mrwin-radio-body {
	flex: 1;
	min-width: 0;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 10px;
}

/* ----- Top row: play button + title ----- */

.mrwin-radio-top {
	display: flex;
	align-items: center;
	gap: 14px;
}

.mrwin-radio-btn-play {
	position: relative; /* anchors the loading spinner ring */
	flex-shrink: 0;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: #e53935;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition:
		background 0.15s ease,
		transform 0.1s ease;
}

.mrwin-radio-btn-play:hover,
.mrwin-radio-btn-play:focus-visible {
	background: #c62828;
	transform: scale(1.06);
	outline: 2px solid rgba(229, 57, 53, 0.4);
	outline-offset: 3px;
}

.mrwin-radio-btn-play svg {
	width: 26px;
	height: 26px;
	fill: #fff;
	position: relative; /* sits above the ::after spinner ring */
	z-index: 1;
}

/* Default: show play, hide pause */
.mrwin-radio-btn-play .icon-pause {
	display: none;
}

/* Pause icon visible while loading or playing */
.mrwin-radio-player.is-loading .mrwin-radio-btn-play .icon-play,
.mrwin-radio-player.is-playing .mrwin-radio-btn-play .icon-play {
	display: none;
}

.mrwin-radio-player.is-loading .mrwin-radio-btn-play .icon-pause,
.mrwin-radio-player.is-playing .mrwin-radio-btn-play .icon-pause {
	display: block;
}

/* ----- Loading spinner ring around the play button ----- */

.mrwin-radio-player.is-loading .mrwin-radio-btn-play {
	background: #c62828;
}

.mrwin-radio-player.is-loading .mrwin-radio-btn-play::after {
	content: '';
	position: absolute;
	inset: -5px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.15);
	border-top-color: #fff;
	border-right-color: rgba(255, 255, 255, 0.5);
	animation: mrwin-spin 0.75s linear infinite;
	pointer-events: none;
}

@keyframes mrwin-spin {
	to {
		transform: rotate(360deg);
	}
}

.mrwin-radio-name {
	font-size: clamp(12px, 1.4vw, 16px);
	font-weight: 600;
	/* Wrap first, shrink via clamp, ellipsis only when truly out of space */
	white-space: normal;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ----- Middle row: progress bar + time ----- */

.mrwin-radio-progress {
	display: flex;
	align-items: center;
	gap: 10px;
}

.mrwin-radio-bar {
	flex: 1;
	height: 3px;
	background: #555;
	border-radius: 2px;
}

.mrwin-radio-time {
	font-size: 12px;
	color: #999;
	min-width: 36px;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* ----- Bottom row: equalizer + volume ----- */

.mrwin-radio-controls {
	display: flex;
	align-items: center;
	gap: 10px;
}

.mrwin-radio-eq {
	display: flex;
	align-items: flex-end;
	gap: 3px;
	height: 20px;
	flex-shrink: 0;
}

.mrwin-radio-eq span {
	display: block;
	width: 5px;
	background: #e53935;
	border-radius: 2px 2px 0 0;
	transform-origin: bottom;
}

.mrwin-radio-eq span:nth-child(1) {
	height: 40%;
}
.mrwin-radio-eq span:nth-child(2) {
	height: 70%;
}
.mrwin-radio-eq span:nth-child(3) {
	height: 100%;
}
.mrwin-radio-eq span:nth-child(4) {
	height: 55%;
}
.mrwin-radio-eq span:nth-child(5) {
	height: 30%;
}

/* Equalizer animates only when audio is actually playing, not while loading */
.mrwin-radio-player.is-playing:not(.is-loading) .mrwin-radio-eq span {
	animation: mrwin-eq 0.7s ease-in-out infinite alternate;
}

.mrwin-radio-player.is-playing:not(.is-loading) .mrwin-radio-eq span:nth-child(1) {
	animation-delay: 0s;
}
.mrwin-radio-player.is-playing:not(.is-loading) .mrwin-radio-eq span:nth-child(2) {
	animation-delay: 0.15s;
}
.mrwin-radio-player.is-playing:not(.is-loading) .mrwin-radio-eq span:nth-child(3) {
	animation-delay: 0.05s;
}
.mrwin-radio-player.is-playing:not(.is-loading) .mrwin-radio-eq span:nth-child(4) {
	animation-delay: 0.2s;
}
.mrwin-radio-player.is-playing:not(.is-loading) .mrwin-radio-eq span:nth-child(5) {
	animation-delay: 0.1s;
}

@keyframes mrwin-eq {
	0% {
		transform: scaleY(0.3);
	}
	100% {
		transform: scaleY(1);
	}
}

/* ----- Volume section ----- */

.mrwin-radio-vol {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	min-width: 0;
}

.mrwin-radio-vol-slider {
	-webkit-appearance: none;
	appearance: none;
	flex: 1;
	min-width: 50px;
	height: 4px;
	border-radius: 2px;
	background: linear-gradient(to right, #e53935 var(--vol, 80%), #555 var(--vol, 80%));
	outline: none;
	cursor: pointer;
	padding: 0;
	border: none;
}

.mrwin-radio-vol-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #e53935;
	cursor: pointer;
}

.mrwin-radio-vol-slider::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: #555;
}

.mrwin-radio-vol-slider::-moz-range-progress {
	height: 4px;
	border-radius: 2px 0 0 2px;
	background: #e53935;
}

.mrwin-radio-vol-slider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #e53935;
	cursor: pointer;
	border: none;
}

.mrwin-radio-vol-pct {
	font-size: 11px;
	color: #999;
	min-width: 32px;
	text-align: right;
	font-variant-numeric: tabular-nums;
	flex-shrink: 0;
}

.mrwin-radio-vol-btns {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex-shrink: 0;
}

.mrwin-radio-vol-up,
.mrwin-radio-vol-dn {
	width: 24px;
	height: 20px;
	background: #404040;
	border: none;
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 2px;
	padding: 0;
	transition: background 0.15s ease;
}

.mrwin-radio-vol-up:hover,
.mrwin-radio-vol-dn:hover {
	background: #555;
}

/* =========================================================
   Responsive — mobile (≤ 540 px)
   Image moves to the top centered at its natural square size.
   Controls get larger touch targets.
   ========================================================= */

@media (max-width: 540px) {
	.mrwin-radio-player {
		flex-direction: column;
	}

	/*
	 * Cover becomes a centered block at the top.
	 * The image keeps its 1:1 ratio — never stretched.
	 * Padding creates the dark breathing room visible around it.
	 */
	.mrwin-radio-cover {
		width: 100%;
		padding: 16px 16px 8px;
		justify-content: center;
	}

	.mrwin-radio-cover img {
		width: 150px;
		height: 150px;
		border-radius: 8px;
		/* box-shadow kept from desktop rule */
	}

	/* On very small screens scale the image down slightly
	   while keeping the aspect ratio perfectly square */
	@media (max-width: 360px) {
		.mrwin-radio-cover img {
			width: 110px;
			height: 110px;
		}
	}

	.mrwin-radio-body {
		padding: 10px 16px 16px;
		gap: 12px;
	}

	/* Bigger play button for easy tapping */
	.mrwin-radio-btn-play {
		width: 62px;
		height: 62px;
	}

	.mrwin-radio-btn-play svg {
		width: 30px;
		height: 30px;
	}

	.mrwin-radio-name {
		font-size: clamp(13px, 2.5vw, 17px);
	}

	/* Larger touch targets on the +/− buttons */
	.mrwin-radio-vol-up,
	.mrwin-radio-vol-dn {
		width: 36px;
		height: 28px;
		font-size: 16px;
		border-radius: 4px;
	}

	/* Slightly larger slider thumb */
	.mrwin-radio-vol-slider::-webkit-slider-thumb {
		width: 18px;
		height: 18px;
	}

	.mrwin-radio-vol-slider::-moz-range-thumb {
		width: 18px;
		height: 18px;
	}
}
