/* Icecast Player - stili. Le variabili vengono impostate inline dallo shortcode. */

/* Contenitore: serve alle container query per passare al layout compatto
   in base alla larghezza reale del player (cellulari, sidebar strette). */
.icp-wrap {
	container-type: inline-size;
	container-name: icp;
	box-sizing: border-box;
	margin: 1em 0;
}

.icp-player {
	--icp-bg: #1d2327;
	--icp-text: #fff;
	--icp-btn: #2271b1;
	--icp-btn-text: #fff;
	--icp-accent: #2271b1;
	--icp-radius: 12px;
	--icp-scale: 1;
	box-sizing: border-box;
	display: block;
	margin: 0;
	padding: calc(16px * var(--icp-scale));
	background: var(--icp-bg);
	color: var(--icp-text);
	border-radius: var(--icp-radius);
	font-size: calc(16px * var(--icp-scale));
	line-height: 1.3;
}

.icp-player *,
.icp-player *::before,
.icp-player *::after {
	box-sizing: border-box;
}

/* ---- Intestazione: icona + titolo/stato ---- */
.icp-head {
	display: flex;
	align-items: center;
	gap: 0.7em;
	margin-bottom: 0.7em;
}

.icp-logo {
	display: block;
	flex: 0 0 auto;
	width: 2.4em;
	height: 2.4em;
	color: var(--icp-accent);
}

.icp-logo svg,
.icp-logo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.icp-meta {
	flex: 1 1 auto;
	min-width: 0;
}

.icp-title {
	font-weight: 700;
	font-size: 1.1em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.icp-nowplaying {
	font-size: 0.9em;
	opacity: 0.85;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.icp-nowplaying:empty {
	display: none;
}

.icp-status {
	font-size: 0.8em;
	opacity: 0.75;
	min-height: 1.2em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---- Controlli ---- */
.icp-controls {
	display: flex;
	align-items: center;
	gap: 0.6em;
}

.icp-btn,
.icp-mute {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	border: 0;
	cursor: pointer;
	line-height: 1;
	transition: opacity 0.15s, transform 0.1s;
}

.icp-btn {
	width: 2.8em;
	height: 2.8em;
	border-radius: var(--icp-btn-radius, 50%);
	background: var(--icp-btn);
	color: var(--icp-btn-text);
}

.icp-btn svg {
	width: 55%;
	height: 55%;
	fill: currentColor;
}

.icp-btn:hover:not(:disabled) {
	transform: scale(1.06);
}

.icp-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.icp-btn:focus-visible,
.icp-mute:focus-visible,
.icp-volume:focus-visible {
	outline: 2px solid var(--icp-text);
	outline-offset: 2px;
}

.icp-mute {
	width: 2em;
	height: 2em;
	background: transparent;
	color: var(--icp-text);
	margin-left: 0.4em;
}

.icp-mute svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.icp-mute .icp-ico-mute {
	display: none;
}

.icp-player.is-muted .icp-mute .icp-ico-vol {
	display: none;
}

.icp-player.is-muted .icp-mute .icp-ico-mute {
	display: block;
}

.icp-volume {
	flex: 1 1 auto;
	min-width: 60px;
	height: 1.4em;
	margin: 0;
	background: transparent;
	accent-color: var(--icp-accent);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/* Su iPhone/iPad il volume del browser non è controllabile: il cursore viene nascosto dallo script. */
.icp-player.icp-no-volume .icp-volume {
	display: none;
}

.icp-volume::-webkit-slider-runnable-track {
	height: 0.3em;
	border-radius: 0.3em;
	background: linear-gradient(to right, var(--icp-accent) var(--icp-fill, 80%), rgba(128, 128, 128, 0.45) var(--icp-fill, 80%));
}

.icp-volume::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 1em;
	height: 1em;
	margin-top: -0.35em;
	border-radius: 50%;
	background: var(--icp-accent);
	border: 2px solid var(--icp-text);
}

.icp-volume::-moz-range-track {
	height: 0.3em;
	border-radius: 0.3em;
	background: rgba(128, 128, 128, 0.45);
}

.icp-volume::-moz-range-progress {
	height: 0.3em;
	border-radius: 0.3em;
	background: var(--icp-accent);
}

.icp-volume::-moz-range-thumb {
	width: 0.8em;
	height: 0.8em;
	border-radius: 50%;
	background: var(--icp-accent);
	border: 2px solid var(--icp-text);
}

.icp-player.is-playing .icp-status::before {
	content: "";
	display: inline-block;
	width: 0.6em;
	height: 0.6em;
	margin-right: 0.4em;
	border-radius: 50%;
	background: #e53935;
	animation: icp-pulse 1.2s infinite;
}

@keyframes icp-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
	.icp-player.is-playing .icp-status::before { animation: none; }
}

/* ---- Layout compatto (forzato) ---- */
.icp-player.icp-compact {
	padding: calc(10px * var(--icp-scale));
}

.icp-compact .icp-head {
	gap: 0.5em;
	margin-bottom: 0.45em;
}

.icp-compact .icp-logo {
	width: 1.8em;
	height: 1.8em;
}

.icp-compact .icp-title {
	font-size: 1em;
}

.icp-compact .icp-nowplaying {
	font-size: 0.8em;
}

.icp-compact .icp-status {
	font-size: 0.72em;
	min-height: 0;
}

.icp-compact .icp-controls {
	gap: 0.4em;
}

.icp-compact .icp-btn {
	width: 2.3em;
	height: 2.3em;
}

.icp-compact .icp-mute {
	width: 1.7em;
	height: 1.7em;
	margin-left: 0.2em;
}

/* ---- Layout compatto (automatico, sotto i 400 px di larghezza del player) ---- */
@container icp (max-width: 399px) {
	.icp-player.icp-auto {
		padding: calc(10px * var(--icp-scale));
	}

	.icp-auto .icp-head {
		gap: 0.5em;
		margin-bottom: 0.45em;
	}

	.icp-auto .icp-logo {
		width: 1.8em;
		height: 1.8em;
	}

	.icp-auto .icp-title {
		font-size: 1em;
	}

	.icp-auto .icp-nowplaying {
		font-size: 0.8em;
	}

	.icp-auto .icp-status {
		font-size: 0.72em;
		min-height: 0;
	}

	.icp-auto .icp-controls {
		gap: 0.4em;
	}

	.icp-auto .icp-btn {
		width: 2.3em;
		height: 2.3em;
	}

	.icp-auto .icp-mute {
		width: 1.7em;
		height: 1.7em;
		margin-left: 0.2em;
	}
}

/* ---- Pulsante "apri in una finestra" ---- */
.icp-popup-btn {
	--icp-btn: #2271b1;
	--icp-btn-text: #fff;
	--icp-radius: 12px;
	--icp-scale: 1;
	display: inline-flex;
	align-items: center;
	gap: 0.55em;
	padding: 0.65em 1.2em;
	border-radius: var(--icp-radius);
	background: var(--icp-btn);
	color: var(--icp-btn-text);
	font-size: calc(16px * var(--icp-scale));
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s, transform 0.1s;
}

.icp-popup-btn:hover,
.icp-popup-btn:focus-visible {
	color: var(--icp-btn-text);
	text-decoration: none;
	filter: brightness(1.1);
}

.icp-popup-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.icp-popup-ico {
	display: inline-block;
	width: 1.4em;
	height: 1.4em;
	flex: 0 0 auto;
}

.icp-popup-ico svg {
	display: block;
	width: 100%;
	height: 100%;
}

.icp-widget-popup {
	margin: 0.6em 0 0;
}

/* ---- Finestra esterna: il player occupa tutta la finestra ---- */
body.icp-popup .icp-wrap {
	width: 100% !important;
	max-width: none !important;
	min-height: 100vh;
	margin: 0;
}

.icp-player.icp-fullwin {
	min-height: 100vh;
	border-radius: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
