@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Monda:wght@400..700&display=swap');

:root {
	--bg: #0a0a0f;
	--surface: #13131c;
	--surface2: #1c1c2a;
	--border: #2a2a3d;
	--accent: #7c6aff;
	--accent2: #ff6a9b;
	--text: #e8e8f0;
	--muted: #6b6b85;
	--green: #4ade80;
	--red: #ff4d6a;
	--radius: 12px;
}

/* Glassmorphism effect */
.glassmorphism {
	background: rgba(19, 19, 28, 0.6);
	border: 1px solid var(--border);
	backdrop-filter: blur(12px) saturate(130%);
	-webkit-backdrop-filter: blur(12px) saturate(130%);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.material-symbols-rounded {
	font-family: 'Material Symbols Rounded';
	font-weight: 400;
	font-style: normal;
	font-size: 24px;
	display: inline-flex;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	word-wrap: normal;
	white-space: nowrap;
	direction: ltr;
	vertical-align: middle;
	align-items: center;
	justify-content: center;
	font-variation-settings: 'FILL' 1;
}

html {
	scroll-behavior: smooth;
	height: 100%;
	overflow: hidden;
}

body {
	font-family: 'Monda', sans-serif !important;
	background: var(--bg);
	color: var(--text);
	height: 100vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: 0;
}

body::before {
	content: '';
	position: fixed;
	inset: 0;
	background-image:
		linear-gradient(rgba(124, 106, 255, 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(124, 106, 255, 0.05) 1px, transparent 1px);
	background-size: 40px 40px;
	pointer-events: none;
	z-index: 1;
}

#bgIframe {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
	z-index: -1;
	pointer-events: none;
	opacity: 0.8;
	mask-image: radial-gradient(
		ellipse at center, 
		rgba(0, 0, 0, 1) 50%,
		rgba(0, 0, 0, 0) 100%
	);
}

.btn-primary, .btn-danger {
    font-family: 'Monda', sans-serif !important;
}

.wrapper {
	position: relative;
	z-index: 2;
	width: 100%;
	height: 100vh;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 30px 80px;
	overflow: visible;
}

.layout-container {
	display: flex;
	gap: 0;
	flex: 1;
	min-height: 0;
	overflow: visible;
}

.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

.sidebar-queue {
	width: 440px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex-shrink: 0;
	min-height: 0;
	overflow: hidden;
}

header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.logo {
	font-family: 'Syne', sans-serif;
	font-size: 42px;
	font-weight: 800;
	letter-spacing: -0.5px;
	background: linear-gradient(135deg, var(--accent), var(--accent2));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}

.sync-badge {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: var(--muted);
	padding: 4px 10px;
	border-radius: 99px;
	transition: all 0.3s;
}

.sync-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--muted);
	transition: all 0.3s;
}

.sync-badge.synced .sync-dot {
	background: var(--green);
	box-shadow: 0 0 8px var(--green);
}

.sync-badge.synced {
	color: var(--green);
	border-color: rgba(74, 222, 128, 0.2);
}

.url-section {
	display: flex;
	flex-direction: column;
}

.url-input {
	width: 100%;
	border-radius: var(--radius);
	color: var(--text);
	font-size: 13px;
	padding: 12px 16px;
	outline: none;
	font-family: inherit;
}

.url-input:focus {
	border-color: var(--accent);
}

.input-actions {
	display: flex;
	gap: 8px;
	overflow: hidden;
	max-height: 0;
	opacity: 0;
	pointer-events: none;
	margin-top: 0;
	transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-top 0.3s ease;
}

.input-actions.visible {
	max-height: 60px;
	opacity: 1;
	pointer-events: auto;
	margin-top: 8px;
}

.input-actions button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: inherit;
}

.btn-primary {
	background: var(--accent);
	color: white;
	border: none;
	border-radius: var(--radius);
	padding: 12px 20px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: opacity 0.2s;
}

.btn-primary:hover {
	opacity: 0.85;
}

.btn-outline {
	background: transparent;
	color: var(--accent);
	border: 1px solid rgba(124, 106, 255, 0.4);
	border-radius: var(--radius);
	padding: 12px 20px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s;
	font-family: inherit;
}

.btn-outline:hover {
	background: rgba(124, 106, 255, 0.1);
	border-color: var(--accent);
}

.btn-danger {
	display: flex;
	align-items: center;
	gap: 8px;
	background: transparent;
	color: var(--red);
	border: 1px solid rgba(255, 77, 106, 0.3);
	border-radius: var(--radius);
	padding: 8px 14px;
	font-weight: 700;
	cursor: pointer;
	font-size: 13px;
	transition: all 0.2s;
}

.btn-danger:hover {
	background: rgba(255, 77, 106, 0.1);
	border-color: var(--red);
}

.player-shell {
	border-radius: 16px;
	overflow: hidden;
	position: relative;
	flex: 1;
	min-height: 0;
}

#player {
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.2s ease;
}

#player.player-visible {
	opacity: 1;
}

.player-placeholder {
	position: absolute;
	background-color: transparent;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: var(--muted);
	font-size: 14px;
	z-index: 2;
	transition: opacity 0.2s ease;
}

.player-placeholder.hidden {
	opacity: 0;
	pointer-events: none;
}

.controls-card {
	border-radius: 16px;
	padding: 20px 24px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.np-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow: hidden;
}

.np-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.np-channel {
	font-size: 12px;
	color: var(--muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.progress-area {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.time-row {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: var(--muted);
}

.slider-track {
	position: relative;
	height: 6px;
	background: var(--surface2);
	border-radius: 99px;
	cursor: pointer;
}

.slider-fill {
	position: absolute;
	height: 100%;
	background: linear-gradient(90deg, var(--accent), var(--accent2));
	border-radius: 99px;
	width: 0%;
}

.slider-native {
	position: absolute;
	inset: -10px 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
}

.playback-controls-wrapper {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
}

.playback-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	grid-column: 2;
	grid-row: 1;
}

.btn-icon {
	border-radius: 50%;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--text);
	transition: background 0.2s;
}

.btn-icon:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.25);
}

.btn-icon.large {
	width: 56px;
	height: 56px;
	background: var(--accent);
	color: white;
	border: none;
}

.btn-icon.large .material-symbols-rounded {
	font-size: 42px;
}

.btn-icon.large:hover {
	background: #9080ff;
}

.btn-icon-square {
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--muted);
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: transparent;
	border-radius: var(--radius);
	padding: 8px;
	transition: all 0.2s;
}

.btn-icon-square:hover {
	background: rgba(124, 106, 255, 0.15);
	border-color: var(--accent);
	color: var(--accent);
}

.volume-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	grid-column: 1;
	grid-row: 1;
	justify-self: start;
}

/* ── LOOP BUTTON ── */
.btn-loop {
	grid-column: 3;
	grid-row: 1;
	justify-self: end;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: var(--muted);
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	transition: color 0.2s, background 0.2s;
	position: relative;
}

.btn-loop:hover {
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
}

.btn-loop.loop-once {
	color: var(--accent);
}

.btn-loop.loop-continuous {
	color: var(--accent);
}

.btn-loop.loop-once::after,
.btn-loop.loop-continuous::after {
	content: '';
	position: absolute;
	bottom: 1px;
	left: 50%;
	transform: translateX(-50%);
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--accent);
}

.vol-track {
	width: 80px;
	position: relative;
	height: 4px;
	background: var(--surface2);
	border-radius: 99px;
}

.vol-fill {
	position: absolute;
	height: 100%;
	background: var(--muted);
	border-radius: 99px;
	width: 80%;
}

.vol-native {
	position: absolute;
	inset: -10px 0;
	opacity: 0;
	width: 100%;
	cursor: pointer;
}

/* ── PANEL DIVIDER ── */
.panel-divider {
	width: 10px;
	flex-shrink: 0;
	cursor: col-resize;
	position: relative;
	border-radius: 4px;
	margin: 0 3px;
	transition: background 0.15s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.panel-divider::before {
	content: '';
	position: absolute;
	inset: 0 -6px;
}

.panel-divider::after {
	content: '';
	width: 2px;
	height: 40px;
	background: var(--border);
	border-radius: 99px;
	transition: background 0.15s, height 0.15s;
}

.panel-divider:hover::after,
.panel-divider.dragging::after {
	height: 80px;
	background: var(--accent);
}

.panel-divider.dragging {
	cursor: col-resize;
}

/* ── SCROLL TO TOP ── */
.scroll-to-top {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--accent);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
	box-shadow: 0 4px 12px rgba(124, 106, 255, 0.3);
	z-index: 999;
}

.scroll-to-top:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(124, 106, 255, 0.5);
}

.scroll-to-top:active {
	transform: translateY(-1px);
}

.scroll-to-top.visible {
	opacity: 1;
	visibility: visible;
}

.toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(100px);
	color: var(--text);
	padding: 10px 20px;
	border-radius: 99px;
	transition: transform 0.3s;
	z-index: 100;
}

.toast.show {
	transform: translateX(-50%) translateY(0);
}

/* ── CODA ── */
.queue-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 4px;
}

.queue-label {
	font-size: 13px;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.queue-panel {
	border-radius: 16px;
	padding: 12px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
	min-height: 0;
}

.queue-panel::-webkit-scrollbar {
	width: 25px;
}

.queue-panel::-webkit-scrollbar-track {
	background: transparent;
}

.queue-panel::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 999px;
	border: 6px solid transparent;
	background-clip: content-box;
	min-height: 40px;
}

.queue-panel::-webkit-scrollbar-thumb:hover {
	background: var(--accent);
	background-clip: content-box;
}

.queue-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 32px 16px;
	color: var(--muted);
	font-size: 13px;
	text-align: center;
}

.queue-empty svg {
	opacity: 0.4;
}

.queue-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px;
	border-radius: var(--radius);
	cursor: pointer;
	transition: background 0.2s;
}

.queue-item:hover {
	background: rgba(124, 106, 255, 0.1);
}

.queue-unavailable {
	opacity: 0.5;
	background: rgba(255, 77, 106, 0.05) !important;
}

.queue-unavailable:hover {
	background: rgba(255, 77, 106, 0.15) !important;
}

.queue-unavailable .queue-thumb {
	filter: grayscale(100%) brightness(0.7);
}

/* Thumbnail più grande: 96x54 (formato 16:9) */
.queue-thumb {
	width: 96px;
	height: 54px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
}

.queue-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	overflow: hidden;
}

.queue-title {
	font-weight: 500;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.queue-duration {
	color: var(--muted);
	font-size: 11px;
}

.queue-active {
	background: rgba(124, 106, 255, 0.2) !important;
}

.queue-active .queue-title {
	color: var(--accent);
}

.queue-index {
	font-size: 11px;
	color: var(--muted);
	width: 18px;
	text-align: center;
	flex-shrink: 0;
}

.queue-index.playing {
	color: var(--accent);
}

.queue-actions {
	display: none;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
}

.queue-item:hover .queue-actions {
	display: flex;
}

.queue-action-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	border-radius: 6px;
	transition: all 0.2s;
	flex-shrink: 0;
}

.queue-action-btn:hover {
	background: rgba(124, 106, 255, 0.15);
	color: var(--accent);
}

.queue-action-btn:active {
	background: rgba(124, 106, 255, 0.25);
}

.queue-action-btn:disabled {
	opacity: 0.25;
	cursor: not-allowed;
	pointer-events: none;
}

.queue-remove-btn {
	color: var(--muted);
}

.queue-remove-btn:hover {
	background: rgba(255, 77, 106, 0.15) !important;
	color: var(--red) !important;
}