/**
 * Sanal Müdür Player — Frontend stil (koyu tema, modern, mobile-first).
 *
 * @package SanalMudurPlayer
 */

.smp-player {
	--smp-accent: #e8b339;
	--smp-accent-2: #f5cf63;
	--smp-bg: #0c0c10;
	--smp-bg-2: #14141a;
	--smp-panel: #101015;
	--smp-row: rgba( 255, 255, 255, 0.035 );
	--smp-row-hover: rgba( 255, 255, 255, 0.07 );
	--smp-text: #f6f6f8;
	--smp-muted: #9b9ba6;
	--smp-line: rgba( 255, 255, 255, 0.07 );
	--smp-radius: 22px;

	box-sizing: border-box;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 980px;
	margin: 1.75rem auto;
	color: var(--smp-text);
	background:
		radial-gradient( 130% 90% at 18% 0%, rgba( 232, 179, 57, 0.16 ), transparent 55% ),
		radial-gradient( 120% 120% at 100% 100%, rgba( 232, 179, 57, 0.06 ), transparent 60% ),
		linear-gradient( 165deg, var(--smp-bg-2), var(--smp-bg) );
	border: 1px solid var(--smp-line);
	border-radius: var(--smp-radius);
	box-shadow: 0 30px 70px rgba( 0, 0, 0, 0.5 );
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.smp-player * { box-sizing: border-box; }

/* Bazı blok temaları (Twenty Twenty-*, Elementor vb.) içeriği dar bir sütuna
   ("is-layout-constrained" ~640px) hapseder; o zaman masaüstü "yan yana" düzen
   sığmaz, her şey alt alta sıkışır. Oynatıcı kendi genişliğini kullansın. */
.smp-player:not(.smp-fullwidth) {
	max-width: 980px !important;
	width: 100% !important;
}

.smp-player.smp-empty {
	display: block;
	padding: 1.5rem;
	text-align: center;
	color: var(--smp-muted);
}

/* Tam genişlik (kenardan kenara, tek renk bölünmüş yerleşim).
   Genişlik/kenar boşluğu JS tarafından hassas hesaplanır; burada yalnızca görünüm. */
.smp-player.smp-fullwidth {
	max-width: none;
	border-radius: 0;
	border-left: 0;
	border-right: 0;
	box-shadow: 0 18px 50px rgba( 0, 0, 0, 0.45 );
}

/* ============================================================
 * Sahne (sol/üst)
 * ============================================================ */
.smp-stage {
	padding: 2.25rem 1.75rem 2rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.15rem;
}

.smp-artwork {
	position: relative;
	width: 238px;
	max-width: 64vw;
	aspect-ratio: 1 / 1;
}

.smp-artwork-glow {
	position: absolute;
	inset: -14%;
	border-radius: 50%;
	background: radial-gradient( circle, rgba( 232, 179, 57, 0.35 ), transparent 62% );
	filter: blur( 14px );
	opacity: 0;
	transition: opacity 0.4s ease;
	z-index: 0;
}
.smp-player.smp-playing .smp-artwork-glow { opacity: 0.8; }

.smp-artwork-ring {
	position: relative;
	z-index: 1;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	padding: 9px;
	background: conic-gradient( from 220deg, var(--smp-accent), #6a5118, var(--smp-accent-2), #6a5118, var(--smp-accent) );
	box-shadow: 0 0 0 1px rgba( 255, 255, 255, 0.06 ), 0 22px 48px rgba( 0, 0, 0, 0.6 );
}
.smp-player.smp-playing .smp-artwork-ring { animation: smp-spin 16s linear infinite; }
@keyframes smp-spin { to { transform: rotate( 360deg ); } }

.smp-cover {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
	background: #000;
}

/* Sadece-YouTube şarkı: video, dönen kapak halkasının yerine geçer.
   (Mobil tarayıcılar gizli/1px iframe'de video oynatmaz; görünür olmak zorunda.) */
.smp-stage-yt { display: none; }
.smp-player.smp-yt-stage .smp-cover { display: none; }
.smp-player.smp-yt-stage .smp-artwork-ring { animation: none !important; }
.smp-player.smp-yt-stage .smp-stage-yt {
	display: block;
	position: absolute;
	inset: 9px;            /* halkanın padding'i kadar içeride — altın çerçeve görünür kalsın */
	border-radius: 50%;
	overflow: hidden;
	z-index: 2;
	background: #000;
}
.smp-player.smp-yt-stage .smp-stage-yt iframe,
.smp-player.smp-yt-stage .smp-stage-yt .smp-ghost-iframe {
	width: 100% !important;
	height: 100% !important;
	border: 0;
	display: block;
	pointer-events: none;  /* video üstüne dokununca YouTube UI'si açılmasın; oynat butonu kullanılsın */
}

.smp-meta {
	text-align: center;
	width: 100%;
	max-width: 100%;
	padding: 0 0.25rem;
}

.smp-title {
	margin: 0;
	font-size: clamp( 1.02rem, 2.4vw, 1.32rem );
	font-weight: 800;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	line-height: 1.25;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.smp-artist {
	margin: 0.3rem 0 0;
	font-size: 0.86rem;
	letter-spacing: 1.1px;
	text-transform: uppercase;
	color: var(--smp-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------- Sosyal: favori / youtube / abone ---------- */
.smp-social {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	min-height: 28px;
}

.smp-social .smp-btn svg { width: 19px; height: 19px; }

.smp-fav { color: var(--smp-muted); }
.smp-fav:hover { color: #ff6b86; transform: scale( 1.08 ); }
.smp-fav.smp-on { color: #ff3b62; animation: smp-pop 0.32s ease; }
@keyframes smp-pop { 0% { transform: scale( 1 ); } 45% { transform: scale( 1.35 ); } 100% { transform: scale( 1 ); } }

.smp-yt-link { color: var(--smp-muted); }
.smp-yt-link:hover { color: #ff5252; }

.smp-subscribe {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.34rem 0.85rem;
	border-radius: 999px;
	background: #cc0000;
	color: #fff;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.6px;
	text-transform: uppercase;
}
.smp-subscribe:hover { color: #fff; background: #e60000; }
.smp-subscribe svg { width: 16px; height: 16px; }
.smp-subscribe.smp-done { background: rgba( 255, 255, 255, 0.12 ); color: var(--smp-muted); }
.smp-subscribe.smp-done::after { content: " ✓"; }

/* ---------- İlerleme ---------- */
.smp-progress {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	max-width: 440px;
}

.smp-time {
	font-size: 0.74rem;
	color: var(--smp-muted);
	min-width: 34px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.smp-progress-bar {
	position: relative;
	flex: 1;
	height: 6px;
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.12 );
	cursor: pointer;
	outline: none;
}
.smp-progress-bar:focus-visible { box-shadow: 0 0 0 2px var(--smp-accent); }

.smp-progress-fill {
	position: absolute;
	left: 0; top: 0;
	height: 100%; width: 0%;
	border-radius: 999px;
	background: linear-gradient( 90deg, var(--smp-accent), var(--smp-accent-2) );
}

.smp-progress-handle {
	position: absolute;
	top: 50%; left: 0%;
	width: 14px; height: 14px;
	border-radius: 50%;
	background: #fff;
	transform: translate( -50%, -50% );
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.55 );
	opacity: 0;
	transition: opacity 0.15s ease;
}
.smp-progress-bar:hover .smp-progress-handle,
.smp-player.smp-playing .smp-progress-handle { opacity: 1; }

/* ---------- Kontroller ---------- */
.smp-controls {
	display: flex;
	align-items: center;
	gap: 1.7rem;
}

.smp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0; padding: 0; margin: 0;
	cursor: pointer;
	color: var(--smp-text);
	transition: transform 0.12s ease, color 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}
.smp-btn:hover { color: var(--smp-accent-2); }
.smp-btn:active { transform: scale( 0.92 ); }
.smp-btn svg { width: 28px; height: 28px; fill: currentColor; }
.smp-prev svg, .smp-next svg { width: 26px; height: 26px; }

.smp-play-pause {
	width: 70px; height: 70px;
	border-radius: 50%;
	background: linear-gradient( 145deg, var(--smp-accent-2), var(--smp-accent) );
	color: #1a1405;
	box-shadow: 0 12px 30px rgba( 232, 179, 57, 0.45 );
}
.smp-play-pause:hover { color: #1a1405; transform: scale( 1.045 ); }
.smp-play-pause svg { width: 30px; height: 30px; }
.smp-play-pause .smp-icon-pause { display: none; }
.smp-play-pause.smp-is-playing .smp-icon-play { display: none; }
.smp-play-pause.smp-is-playing .smp-icon-pause { display: block; }

/* ---------- Ses ---------- */
.smp-volume {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	max-width: 250px;
}
.smp-volume .smp-btn svg { width: 22px; height: 22px; }
.smp-mute .smp-icon-vol-off { display: none; }
.smp-player.smp-muted .smp-mute .smp-icon-vol-on { display: none; }
.smp-player.smp-muted .smp-mute .smp-icon-vol-off { display: block; }

.smp-volume-range {
	-webkit-appearance: none; appearance: none;
	flex: 1; height: 5px;
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.14 );
	outline: none;
}
.smp-volume-range::-webkit-slider-thumb {
	-webkit-appearance: none; appearance: none;
	width: 13px; height: 13px;
	border-radius: 50%;
	background: var(--smp-accent);
	cursor: pointer;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.5 );
}
.smp-volume-range::-moz-range-thumb {
	width: 13px; height: 13px; border: 0;
	border-radius: 50%; background: var(--smp-accent); cursor: pointer;
}

/* ============================================================
 * Çalma listesi paneli (sağ / alt)
 * ============================================================ */
.smp-playlist-panel {
	background: var(--smp-panel);
	border-top: 1px solid var(--smp-line);
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.smp-playlist-tabs {
	display: flex;
	gap: 6px;
	padding: 0.85rem 0.85rem 0.65rem;
	overflow-x: auto;
	scrollbar-width: none;
	border-bottom: 1px solid var(--smp-line);
}
.smp-playlist-tabs::-webkit-scrollbar { display: none; }

.smp-tab {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 12px;
	border: 1px solid var(--smp-line);
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.03 );
	color: var(--smp-muted);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.smp-tab:hover { color: var(--smp-text); background: rgba( 255, 255, 255, 0.07 ); }
.smp-tab.is-active {
	color: #1a1405;
	background: linear-gradient( 145deg, var(--smp-accent-2), var(--smp-accent) );
	border-color: transparent;
	box-shadow: 0 4px 14px rgba( 232, 179, 57, 0.3 );
}

.smp-tab-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px; height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.25 );
	color: inherit;
	font-size: 0.66rem;
}
.smp-tab.is-active .smp-tab-count { background: rgba( 0, 0, 0, 0.18 ); }

.smp-tab-del {
	display: inline-flex; align-items: center; justify-content: center;
	width: 16px; height: 16px;
	border-radius: 50%;
	font-size: 13px; line-height: 1;
	background: rgba( 255, 255, 255, 0.12 );
	margin-left: 2px;
}
.smp-tab-del:hover { background: #ff3b62; color: #fff; }

.smp-tab-new {
	color: var(--smp-accent-2);
	border-style: dashed;
}
.smp-tab-new:hover { color: #1a1405; background: var(--smp-accent); border-style: solid; }
.smp-tab-ico { font-size: 1rem; line-height: 0; }

.smp-playlist {
	list-style: none;
	margin: 0;
	padding: 0.5rem;
	max-height: 340px;
	overflow-y: auto;
	flex: 1;
}
.smp-playlist::-webkit-scrollbar { width: 8px; }
.smp-playlist::-webkit-scrollbar-track { background: transparent; }
.smp-playlist::-webkit-scrollbar-thumb { background: rgba( 255, 255, 255, 0.13 ); border-radius: 999px; }

.smp-playlist-empty {
	margin: 0;
	padding: 1.4rem 1.2rem;
	text-align: center;
	color: var(--smp-muted);
	font-size: 0.85rem;
	line-height: 1.5;
}

/* ---------- Satır ---------- */
.smp-track {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.55rem 0.6rem;
	border-radius: 13px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.smp-track:hover { background: var(--smp-row-hover); }
.smp-track.smp-active {
	background: linear-gradient( 90deg, rgba( 232, 179, 57, 0.2 ), rgba( 232, 179, 57, 0.04 ) );
}
.smp-track.smp-active .smp-track-title { color: var(--smp-accent-2); }

.smp-row-eq {
	flex: 0 0 auto;
	width: 14px; height: 14px;
	display: none;
	align-items: flex-end;
	gap: 2px;
}
.smp-track.smp-active .smp-row-eq { display: flex; }
.smp-row-eq i {
	width: 3px;
	background: var(--smp-accent);
	border-radius: 2px;
	height: 35%;
}
.smp-player.smp-playing .smp-track.smp-active .smp-row-eq i { animation: smp-eq 0.9s ease-in-out infinite; }
.smp-row-eq i:nth-child(2) { animation-delay: 0.25s; }
.smp-row-eq i:nth-child(3) { animation-delay: 0.5s; }
@keyframes smp-eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.smp-track-cover {
	flex: 0 0 auto;
	width: 44px; height: 44px;
	border-radius: 9px;
	background-size: cover;
	background-position: center;
	background-color: #000;
	box-shadow: inset 0 0 0 1px rgba( 255, 255, 255, 0.07 );
}

.smp-track-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}
.smp-track-title {
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--smp-text);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	unicode-bidi: plaintext;
}
.smp-track-artist {
	font-size: 0.75rem;
	color: var(--smp-muted);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	unicode-bidi: plaintext;
}

.smp-row-btn {
	flex: 0 0 auto;
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px;
	border: 0; border-radius: 50%;
	background: transparent;
	color: var(--smp-muted);
	cursor: pointer;
	font-size: 16px; font-weight: 700;
	transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
	-webkit-tap-highlight-color: transparent;
}
.smp-row-btn:hover { background: rgba( 255, 255, 255, 0.1 ); color: var(--smp-text); }
.smp-row-btn:active { transform: scale( 0.9 ); }
.smp-row-btn svg { width: 16px; height: 16px; fill: currentColor; }

.smp-row-fav.is-on { color: #ff3b62; }
.smp-row-fav.is-on:hover { color: #ff5a7a; }

.smp-row-menu svg { width: 16px; height: 16px; }
.smp-row-menu:hover { color: var(--smp-accent-2); }

/* Satır açılır menüsü (body'ye eklenir — bu yüzden renkler birebir, CSS değişkeni yok) */
.smp-rowmenu {
	position: fixed;
	z-index: 2147483000;
	min-width: 220px;
	max-width: 290px;
	max-height: 70vh;
	overflow-y: auto;
	padding: 6px;
	border-radius: 14px;
	background: #20202a;
	border: 1px solid rgba( 255, 255, 255, 0.14 );
	box-shadow: 0 24px 60px rgba( 0, 0, 0, 0.6 );
	color: #f6f6f8;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
}
.smp-rowmenu * { box-sizing: border-box; }
.smp-rm-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 0;
	padding: 10px 11px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: #f6f6f8 !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}
.smp-rm-item:hover { background: rgba( 255, 255, 255, 0.10 ); color: #ffffff !important; }
.smp-rm-ico {
	display: inline-flex; align-items: center; justify-content: center;
	width: 18px; flex: 0 0 18px;
	color: #f5cf63;
	font-size: 16px;
}
.smp-rm-chk {
	display: inline-flex; align-items: center; justify-content: center;
	width: 18px; flex: 0 0 18px;
	color: #f5cf63;
	font-weight: 700;
}
.smp-rm-list.is-on { color: #f5cf63 !important; }
.smp-rm-new { color: #f5cf63 !important; }
.smp-rm-sep { height: 1px; margin: 6px; background: rgba( 255, 255, 255, 0.12 ); }
.smp-rm-label {
	padding: 6px 11px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.7px;
	text-transform: uppercase;
	color: #9b9ba6;
}
.smp-rm-empty {
	padding: 4px 11px 8px;
	font-size: 12.5px;
	color: #9b9ba6;
}

/* ---------- Ghost YouTube (görünür ama gizli) ---------- */
.smp-ghost-yt {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	opacity: 0.01;
	pointer-events: none;
	left: -9999px; top: -9999px;
}
.smp-ghost-iframe { width: 1px; height: 1px; border: 0; }

/* ============================================================
 * Masaüstü: yan yana bölünmüş düzen
 * ============================================================ */
@media ( min-width: 820px ) {
	.smp-player { flex-direction: row; align-items: stretch; }
	.smp-stage {
		flex: 1.15;
		padding: 2.5rem 2.25rem;
		justify-content: center;
		gap: 1rem;
		border-right: 1px solid var(--smp-line);
	}
	.smp-playlist-panel { flex: 0.95; border-top: 0; }
	/* Liste yüksekliği sınırlı -> oynatıcı aşırı uzamaz, sahne ortada güzel durur. */
	.smp-playlist { max-height: min( 62vh, 520px ); }
	.smp-artwork { width: 210px; }

	/* Tam genişlikte: içerik ortada, kenarlarda tek renk zemin (bölünmüş görünüm). */
	.smp-player.smp-fullwidth { justify-content: center; }
	.smp-player.smp-fullwidth .smp-stage { flex: 0 1 560px; }
	.smp-player.smp-fullwidth .smp-playlist-panel { flex: 0 1 480px; background: transparent; }
	.smp-player.smp-fullwidth .smp-playlist { max-height: min( 66vh, 560px ); }
}

@media ( max-width: 640px ) {
	/* Telefonda sekmeler yatay kaydırma yerine alt alta sığsın
	   (sağ taraf kesik görünmesin). */
	.smp-playlist-tabs {
		flex-wrap: wrap;
		overflow-x: visible;
	}
	.smp-tab { flex: 0 1 auto; }
	/* Satırda başlığa daha çok yer aç: kapak ve boşlukları biraz küçült. */
	.smp-track { gap: 0.55rem; padding: 0.5rem 0.45rem; }
	.smp-track-cover { width: 40px; height: 40px; }
	.smp-row-btn { width: 28px; height: 28px; }
}

@media ( max-width: 520px ) {
	.smp-player { margin: 1rem 0; border-radius: 16px; }
	.smp-stage { padding: 1.85rem 1.15rem 1.6rem; }
	.smp-controls { gap: 1.3rem; }
	.smp-play-pause { width: 60px; height: 60px; }
	.smp-title { font-size: 1.18rem; }
}

@media ( prefers-reduced-motion: reduce ) {
	.smp-player.smp-playing .smp-artwork-ring { animation: none; }
	.smp-player.smp-playing .smp-track.smp-active .smp-row-eq i { animation: none; }
	.smp-fav.smp-on { animation: none; }
}
