/* Variables */
:root {
	--primary-color: #4a89dc;
	--primary-hover-color: #3b78cc;
	--background-color: #f8f9fa;
	--card-border-radius: 15px;
	--transition-speed: 0.3s;
}

/* Global Styles */
body {
	background-color: var(--background-color);
	background-image: url('./background.jpg');
	background-size: cover;
	background-position: center;
	background-attachment: fixed;
	min-height: 100vh;
}

.container {
	max-width: 1200px;
}

/* Typography */
.text-muted {
	font-size: 0.9em;
}

.glyph-description {
	text-align: justify;
	color: #6c757d;
	font-size: 0.9em;
}

.glyph-input-label,
.conversion-mode-text {
	font-weight: bold;
}

/* Card Styles */
.card {
	border: none;
	border-radius: var(--card-border-radius);
	transition: all var(--transition-speed) ease;
	background: rgba(255, 255, 255, 0.8) !important;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.18);
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.card:hover {
	transform: translateY(-5px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.card-header {
	background: rgba(74, 137, 220, 0.8) !important;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: var(--card-border-radius) var(--card-border-radius) 0 0 !important;
	padding: 1.25rem;
}

/* Button Styles */
.btn {
	border-radius: 8px;
	font-weight: 500;
	padding: 0.6rem 1.2rem;
	transition: all 0.3s ease;
}

.btn-primary {
	background: rgba(74, 137, 220, 0.9);
	border: none;
	box-shadow: 0 4px 12px rgba(74, 137, 220, 0.2);
}

.btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(74, 137, 220, 0.3);
}

.btn-outline-primary {
	color: var(--primary-color);
	border-color: var(--primary-color);
}

.btn-outline-primary:hover {
	background-color: var(--primary-color);
	color: white;
}

#conversionModeButton {
	transition: all var(--transition-speed) ease;
}

#darkModeToggle {
	font-size: 0.875rem;
	padding: 0.25rem 0.5rem;
}

#darkModeToggle i {
	margin-right: 0.25rem;
}

/* Dark Mode Styles */
.card-header.bg-primary.dark-mode {
	background: linear-gradient(135deg, #2a2a2a, #3a3a3a) !important;
}

.card.dark-mode {
	background: rgba(26, 26, 26, 0.8) !important;
	color: #ffffff;
}

.card-header.dark-mode {
	background: rgba(42, 42, 42, 0.8) !important;
}

/* File Upload Styles */
#glyphUpload {
	margin-top: 5px;
}

/* Glyph Output Styles */
#glyph-output {
	display: grid;
	grid-template-columns: repeat(16, minmax(40px, 1fr));
	gap: 2px;
	overflow-x: auto;
	padding-bottom: 10px;
	width: 100%;
}

#glyph-output div {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: rgba(255, 255, 255, 0.7);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	border-radius: 10px;
	transition: all 0.3s ease;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	position: relative;
	font-size: 16px;
	background-repeat: no-repeat;
	image-rendering: pixelated;
	overflow: visible;
}

#glyph-output div:hover {
	transform: scale(1.15);
	z-index: 1;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

#glyph-output div.transparent {
	background-color: rgba(200, 200, 200, 0.3);
}

/* Tooltip Styles */
.tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	background-color: #333;
	color: #fff;
	padding: 5px 8px;
	border-radius: 4px;
	font-size: 0.75em;
	opacity: 0;
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
	white-space: nowrap;
	z-index: 1000;
}

#glyph-output div:hover .tooltip {
	opacity: 1;
	transform: translateX(-50%) translateY(-5px);
}

/* Copy Notification Styles */
.copy-notification {
	position: absolute;
	background-color: rgba(0, 0, 0, 0.7);
	color: white;
	padding: 5px 10px;
	border-radius: 4px;
	font-size: 0.8em;
	opacity: 0;
	transition: opacity 0.3s;
}

.success-msg {
	animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {

	0%,
	100% {
		opacity: 0;
	}

	10%,
	90% {
		opacity: 1;
	}
}

/* Footer Styles */
footer {
	border-top: 1px solid rgba(222, 226, 230, 0.3);
	padding-top: 2rem;
	margin-top: 4rem;
}

footer a {
	padding: 0.5rem 1rem;
	border-radius: 6px;
	transition: all 0.3s ease;
}

footer a:hover {
	background-color: rgba(0, 123, 255, 0.1);
	transform: translateY(-2px);
}

/* Zoom Window Styles */
.zoom-window {
	border-radius: 5px;
	background: white;
	padding: 10px;
	box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

.zoom-window canvas {
	display: block;
	image-rendering: pixelated;
}

.zoom-window .zoom-info {
	margin-top: 5px;
	font-size: 12px;
	text-align: center;
}

/* Mobile Alert Styles */
#mobileAlert {
	background-color: rgba(255, 243, 205, 0.9);
	border: none;
	border-radius: 10px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	margin-bottom: 20px;
	background: rgba(255, 243, 205, 0.9);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

#mobileAlert .btn-close {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
}

/* Media Queries */
@media (max-width: 767.98px) {
	#glyph-output {
		grid-template-columns: repeat(16, minmax(40px, 1fr));
		gap: 2px;
		padding: 0.5rem;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-snap-type: x mandatory;
		width: 100%;
	}

	#glyph-output div {
		font-size: 1rem;
		min-width: 40px;
		min-height: 40px;
		scroll-snap-align: start;
	}

	#glyph-output::-webkit-scrollbar {
		height: 4px;
	}

	#glyph-output::-webkit-scrollbar-track {
		background: rgba(0, 0, 0, 0.1);
		border-radius: 2px;
	}

	#glyph-output::-webkit-scrollbar-thumb {
		background: rgba(0, 0, 0, 0.2);
		border-radius: 2px;
	}

	#glyph-output div {
		font-size: 24px;
		width: 50px;
		height: 50px;
	}

	.input-group {
		flex-wrap: wrap;
	}

	#convertButton,
	#generate-glyph {
		width: 100%;
		margin-top: 10px;
		border-radius: 0.25rem !important;
	}

	#converterInput,
	#glyph-input {
		border-radius: 0.25rem !important;
	}

	#glyph-output::-webkit-scrollbar {
		height: 8px;
	}

	#glyph-output::-webkit-scrollbar-thumb {
		background-color: rgba(0, 0, 0, 0.2);
		border-radius: 4px;
	}

	#glyph-output::-webkit-scrollbar-track {
		background-color: rgba(0, 0, 0, 0.1);
	}

	#copyButton {
		border-top-left-radius: 0 !important;
		border-bottom-left-radius: 0 !important;
	}

	.input-group> :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
		margin-left: 0;
	}

	#converterInput {
		border-radius: 0.25rem !important;
	}

	#inputPrefix {
		border-radius: 0.25rem !important;
		margin-bottom: 10px;
	}
}

@media (min-width: 768px) {
	#glyph-output {
		overflow-x: visible;
	}

	.converter-input-group {
		display: flex;
	}

	.converter-input-group .form-control {
		flex: 1;
	}

	.converter-input-group .btn {
		width: 120px;
	}

	#inputPrefix {
		width: auto;
	}

	.glyph-description {
		padding-right: 1rem;
		padding-left: 1rem;
	}

	#converterInput {
		border-top-left-radius: 0.25rem !important;
		border-bottom-left-radius: 0.25rem !important;
	}

	#inputPrefix {
		border-top-right-radius: 0 !important;
		border-bottom-right-radius: 0 !important;
	}
}

/* 移动端适配 */
@media (max-width: 767.98px) {
	/* 调整容器内边距 */
	.container {
		padding: 1rem;
	}

	/* 调整标题大小 */
	.display-4 {
		font-size: 2rem;
	}

	.lead {
		font-size: 1rem;
	}

	/* 优化卡片样式 */
	.card {
		margin-bottom: 1rem;
	}

	.card-body {
		padding: 1rem;
	}

	/* 调整按钮组样式 */
	.input-group {
		flex-direction: column;
	}

	.input-group > * {
		margin: 0.25rem 0;
		width: 100% !important;
		border-radius: 8px !important;
	}

	/* 调整预览面板 */
	#glyph-output {
		grid-template-columns: repeat(8, 1fr);
		gap: 0.5rem;
		padding: 0.5rem;
	}

	#glyph-output div {
		font-size: 1.2rem;
		min-height: 40px;
	}

	/* 优化工具提示 */
	.tooltip {
		display: none;
	}

	/* 调整复制通知位置 */
	.copy-notification {
		position: fixed;
		bottom: 20px;
		left: 50%;
		transform: translateX(-50%);
		z-index: 1050;
		padding: 0.5rem 1rem;
		border-radius: 20px;
	}

	/* 优化暗色模式切换按钮 */
	#darkModeToggle {
		padding: 0.25rem 0.5rem;
		font-size: 0.875rem;
	}

	/* 调整页脚样式 */
	footer {
		margin-top: 2rem;
		padding-top: 1rem;
	}

	footer .gap-3 {
		gap: 0.5rem !important;
	}
}

/* 针对超小屏幕设备的优化 */
@media (max-width: 375px) {
	.card-header h2 {
		font-size: 1rem;
	}

	.btn {
		padding: 0.5rem;
		font-size: 0.875rem;
	}
}

/* 添加触摸设备的交互优化 */
@media (hover: none) {
	#glyph-output div:hover {
		transform: none;
		box-shadow: none;
	}

	#glyph-output div:active {
		background-color: rgba(var(--primary-color-rgb), 0.1);
	}

	.btn:hover {
		transform: none !important;
	}

	.btn:active {
		transform: scale(0.98) !important;
	}
}

/* 优化横屏模式 */
@media (max-height: 600px) and (orientation: landscape) {
	.container {
		padding-top: 0.5rem;
		padding-bottom: 0.5rem;
	}

	.display-4 {
		font-size: 1.5rem;
		margin-bottom: 0.5rem;
	}

	.lead {
		margin-bottom: 0.5rem;
	}

	.row {
		gap: 1rem;
	}
}

/* 暗色模式下的预览面板 */
.dark-mode #glyph-output div {
	background: rgba(42, 42, 42, 0.7);
}

.dark-mode #glyph-output div.transparent {
	background: rgba(50, 50, 50, 0.3);
}

/* 修改暗色模式相关样式 */
.card.dark-mode {
    background: rgba(26, 26, 26, 0.8) !important;
    color: #ffffff;
}

.card-header.dark-mode {
    background: rgba(42, 42, 42, 0.8) !important;
}

/* 暗色模式下的输入框样式 */
.dark-mode .form-control {
    background: rgba(42, 42, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.dark-mode .form-control:focus {
    background: rgba(42, 42, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* 暗色模式下的按钮样式 */
.dark-mode .btn-primary {
    background: rgba(74, 137, 220, 0.8);
}

.dark-mode .btn-secondary {
    background: rgba(108, 117, 125, 0.8);
}

/* 暗色模式下的输入组样式 */
.dark-mode .input-group-text {
    background: rgba(42, 42, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* 暗色模式下的警告和成功消息 */
.dark-mode .alert-success {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.3);
    color: #75b798;
}

.dark-mode .alert-danger {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
    color: #ea868f;
}

/* 暗色模式下的占位符文本颜色 */
.dark-mode .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 暗色模式下的文本颜色 */
.dark-mode .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* 欢迎弹窗样式 */
.welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.welcome-modal.show {
  opacity: 1;
  visibility: visible;
}

.welcome-content {
  width: 90%;
  max-width: 500px;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.welcome-modal.show .welcome-content {
  transform: translateY(0);
}

/* 暗色模式适配 */
.dark-mode .welcome-content {
  background: rgba(26, 26, 26, 0.8) !important;
  color: #ffffff;
}

.dark-mode .welcome-content .card-header {
  background: rgba(42, 42, 42, 0.8) !important;
}

/* 移动端适配 */
@media (max-width: 767.98px) {
  .welcome-content {
    width: 95%;
    margin: 0 10px;
  }
}

/* 添加图标对齐样式 */
.fas,
.far,
.fab {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
  transform: translateY(-1px); /* 微调垂直位置 */
}

/* 按钮内的图标对齐 */
.btn i {
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* 输入组内的图标对齐 */
.input-group-text i {
  vertical-align: middle;
}

/* 页脚图标对齐 */
footer a i {
  vertical-align: middle;
  position: relative;
  top: -1px;
}