/**
 * SheetMusic.css - 乐谱显示器样式
 */

/* 包装容器 - 只覆盖音轨流动区域，不影响菜单和钢琴 */
.sheet-music-wrapper {
	position: fixed !important;
	top: 0; /* 由 JavaScript 动态计算 */
	left: 0;
	right: 0;
	bottom: 0; /* 由 JavaScript 动态计算 */
	background: rgba(0, 0, 0, 0.95);
	z-index: 50; /* 降低 z-index，确保不遮挡菜单 */
	display: flex;
	flex-direction: column;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
	pointer-events: all;
	overflow: hidden; /* 防止内容溢出导致页面滚动 */
}

.sheet-music-wrapper.hidden {
	display: none !important; /* 完全移除，不占用任何空间 */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.sheet-music-wrapper.visible {
	opacity: 1;
	visibility: visible;
	pointer-events: all;
}

/* 标题栏 */
.sheet-music-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 20px;
	background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
	border-bottom: 2px solid #0f3460;
	flex-shrink: 0;
}

.sheet-music-title {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #e94560;
	font-size: 1.4rem;
	font-weight: 600;
}

.sheet-music-title .sheet-icon {
	font-size: 1.6rem;
}

/* 控制按钮组 */
.sheet-music-controls {
	display: flex;
	gap: 8px;
	align-items: center;
}

.sheet-control-btn {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #fff;
	padding: 8px 12px;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 1rem;
}

.sheet-control-btn:hover {
	background: rgba(233, 69, 96, 0.3);
	border-color: #e94560;
	transform: translateY(-2px);
}

.sheet-control-btn.active {
	background: rgba(51, 224, 47, 0.3);
	border-color: #33e02f;
	box-shadow: 0 0 10px rgba(51, 224, 47, 0.3);
}

.sheet-control-btn.close-btn {
	margin-left: 20px;
	background: rgba(220, 53, 69, 0.3);
	border-color: #dc3545;
}

.sheet-control-btn.close-btn:hover {
	background: rgba(220, 53, 69, 0.6);
}

/* 乐谱容器 */
.sheet-music-container {
	flex: 1;
	overflow: auto;
	background: #ffffff;
	padding: 20px;
	position: relative;
	min-height: 400px;
}

/* OSMD 容器样式覆盖 */
.sheet-music-container svg {
	display: block !important;
	max-width: 100% !important;
	height: auto !important;
	min-height: 100px;
}

/* OSMD 渲染的页面容器 */
.sheet-music-container > div {
	min-height: 100px;
}

/* 确保 OSMD canvas 页面正确显示 */
.sheet-music-container div[id^="osmdCanvasPage"] {
	position: relative !important;
	margin-bottom: 20px;
	overflow: visible !important;
}

/* OSMD 内部元素样式 */
.sheet-music-container .osmdBackendCanvas,
.sheet-music-container .osmdSVG {
	display: block !important;
	visibility: visible !important;
}

/* 自定义滚动条 */
.sheet-music-container::-webkit-scrollbar {
	width: 12px;
	height: 12px;
}

.sheet-music-container::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 6px;
}

.sheet-music-container::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 6px;
}

.sheet-music-container::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* 加载提示 */
.sheet-music-loading {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 1;
	color: #fff;
	gap: 20px;
	font-size: 1.2rem;
}

.loading-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid rgba(255, 255, 255, 0.2);
	border-top-color: #e94560;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

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

/* 无文件提示 */
.sheet-music-no-file {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 1;
	color: #888;
	font-size: 1.2rem;
}

.sheet-music-no-file::before {
	content: "🎵";
	font-size: 4rem;
	margin-bottom: 20px;
	opacity: 0.5;
}

/* OSMD 光标样式增强 */
#sheetMusicContainer img[id^="cursorImg"] {
	pointer-events: none;
	z-index: 100 !important;
}

/* 乐谱下载界面中的乐谱按钮 */
.view-sheet-btn {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border: none;
	color: white;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85rem;
	margin-left: 8px;
	transition: all 0.2s ease;
}

.view-sheet-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.view-sheet-btn:disabled {
	background: #666;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* 工具栏中的乐谱按钮 */
#sheetMusicBtn {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#sheetMusicBtn:hover {
	background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* 响应式设计 */
@media (max-width: 768px) {
	.sheet-music-header {
		flex-direction: column;
		gap: 12px;
		padding: 10px 15px;
	}
	
	.sheet-music-title {
		font-size: 1.2rem;
	}
	
	.sheet-music-controls {
		flex-wrap: wrap;
		justify-content: center;
	}
	
	.sheet-control-btn {
		padding: 6px 10px;
		font-size: 0.9rem;
	}
	
	.sheet-control-btn.close-btn {
		margin-left: 0;
	}
	
	.sheet-music-container {
		padding: 10px;
	}
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
	.sheet-music-container {
		background: #2d2d2d;
	}
	
	/* OSMD 在深色模式下可能需要额外样式 */
	.sheet-music-container svg text {
		fill: #fff;
	}
}

/* 通知动画 */
@keyframes slideIn {
	from {
		transform: translateX(400px);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOut {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(400px);
		opacity: 0;
	}
}

.sheet-notification {
	animation: slideIn 0.3s ease-out;
}
