/*
	在线工具子页面 - 暗色主题
	与主页 style.css 风格统一
*/

/* ============ Variables ============ */
:root {
	--bg-dark: #1a1a1a;
	--bg-card: rgba(255, 255, 255, 0.04);
	--bg-card-hover: rgba(255, 255, 255, 0.08);
	--bg-input: rgba(255, 255, 255, 0.06);
	--bg-input-focus: rgba(255, 255, 255, 0.1);
	--text-primary: #ffffff;
	--text-secondary: rgba(255, 255, 255, 0.55);
	--text-muted: rgba(255, 255, 255, 0.3);
	--border-soft: rgba(255, 255, 255, 0.1);
	--border-focus: rgba(78, 154, 241, 0.5);
	--accent: #4e9af1;
	--accent-hover: #6babf5;
	--transition: 0.25s ease;
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { -webkit-text-size-adjust: none; }
ul { list-style: none; padding: 0; }
a { text-decoration: none; color: inherit; }

/* ============ Base ============ */
body {
	background: var(--bg-dark);
	color: var(--text-primary);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
	font-weight: 300;
	font-size: 0.95rem;
	line-height: 1.65;
	margin: 0;
	min-height: 100vh;
}

/* ============ Background ============ */
#bg {
	position: fixed;
	top: 0; left: 0;
	width: 100%; height: 100vh;
	z-index: 0;
	background: linear-gradient(135deg, #1a1a1a 0%, #222 50%, #1a1a1a 100%);
}

/* ============ Container ============ */
.container {
	position: relative;
	z-index: 1;
	max-width: 52rem;
	margin: 0 auto;
	padding: 2rem 2rem 3rem;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* ============ Top Nav ============ */
.top-nav {
	margin-bottom: 1.5rem;
}
	.top-nav a, .top-nav .back-link {
		display: inline-block;
		font-size: 0.75rem;
		color: var(--text-muted);
		letter-spacing: 0.1rem;
		transition: color var(--transition);
	}
		.top-nav a:hover, .top-nav .back-link:hover {
			color: var(--text-secondary);
		}

/* ============ Page Header ============ */
.tool-header {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--border-soft);
}
	.tool-header h1 {
		font-size: 1.4rem;
		font-weight: 500;
		letter-spacing: 0.08rem;
		margin-bottom: 0.3rem;
	}
	.tool-header .tool-desc {
		font-size: 0.82rem;
		color: var(--text-secondary);
		line-height: 1.6;
	}
		.tool-header .tool-desc a {
			color: var(--accent);
			transition: color var(--transition);
		}
			.tool-header .tool-desc a:hover {
				color: var(--accent-hover);
			}

/* ============ Tool Body ============ */
.tool-body {
	flex: 1;
}

.tool-body p {
	margin-bottom: 0.6rem;
	color: var(--text-secondary);
	font-size: 0.88rem;
	line-height: 1.6;
}

.tool-body h1, .tool-body h2, .tool-body h3 {
	font-weight: 500;
	color: var(--text-primary);
	margin-bottom: 0.6rem;
}
	.tool-body h1 { font-size: 1.3rem; }
	.tool-body h2 { font-size: 1.1rem; }
	.tool-body h3 { font-size: 1rem; }

.tool-body a {
	color: var(--accent);
	transition: color var(--transition);
}
	.tool-body a:hover {
		color: var(--accent-hover);
		text-decoration: underline;
	}

/* ============ Form Elements ============ */
.tool-body input[type="text"],
.tool-body input[type="password"],
.tool-body textarea {
	background: var(--bg-input);
	border: 1px solid var(--border-soft);
	border-radius: 6px;
	color: var(--text-primary);
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
	font-size: 0.85rem;
	padding: 0.55rem 0.75rem;
	transition: border-color var(--transition), background var(--transition);
	outline: none;
	width: 100%;
	max-width: 40rem;
}
	.tool-body input[type="text"]:focus,
	.tool-body input[type="password"]:focus,
	.tool-body textarea:focus {
		border-color: var(--border-focus);
		background: var(--bg-input-focus);
	}
	.tool-body input[type="text"][readonly="readonly"],
	.tool-body input[type="password"][readonly="readonly"] {
		opacity: 0.6;
		cursor: default;
	}

.tool-body textarea {
	resize: vertical;
	line-height: 1.5;
}

/* Remove old inline width styles */
.tool-body input[style*="width: 550px"],
.tool-body input[style*="width: 700px"],
.tool-body input[style*="width: 450px"],
.tool-body input[style*="width: 470px"],
.tool-body textarea[style*="width: 550px"],
.tool-body textarea[style*="width: 700px"] {
	max-width: 40rem !important;
	width: 100% !important;
}

/* ============ Buttons ============ */
.tool-body button {
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: 500;
	padding: 0.55rem 1.4rem;
	cursor: pointer;
	transition: background var(--transition), transform 0.15s ease;
	letter-spacing: 0.02rem;
}
	.tool-body button:hover {
		background: var(--accent-hover);
	}
	.tool-body button:active {
		transform: scale(0.97);
	}

/* Remove old inline button width */
.tool-body button[style*="width:"] {
	width: auto !important;
}

/* ============ Checkbox & Radio ============ */
.tool-body input[type="checkbox"],
.tool-body input[type="radio"] {
	accent-color: var(--accent);
	width: 15px;
	height: 15px;
	vertical-align: middle;
	margin-right: 0.3rem;
	cursor: pointer;
}

/* ============ Select ============ */
.tool-body select {
	background: var(--bg-input);
	border: 1px solid var(--border-soft);
	border-radius: 6px;
	color: var(--text-primary);
	font-size: 0.85rem;
	padding: 0.4rem 0.6rem;
	outline: none;
	cursor: pointer;
	transition: border-color var(--transition);
}
	.tool-body select:focus {
		border-color: var(--border-focus);
	}

/* ============ File Input ============ */
.tool-body input[type="file"] {
	font-size: 0.82rem;
	color: var(--text-secondary);
}

/* ============ Drop Zone ============ */
.tool-body #drop_zone {
	border: 2px dashed var(--border-soft) !important;
	border-radius: 8px;
	padding: 1.5rem;
	text-align: center;
	color: var(--text-muted);
	transition: border-color var(--transition), background var(--transition);
	display: inline-block;
	min-width: 12rem;
}
	.tool-body #drop_zone:hover {
		border-color: var(--accent) !important;
		background: rgba(78, 154, 241, 0.05);
	}

/* ============ Tables ============ */
.tool-body table {
	width: 100%;
	border-collapse: collapse;
	margin: 0.8rem 0;
	font-size: 0.82rem;
}
	.tool-body table th,
	.tool-body table td {
		border: 1px solid var(--border-soft);
		padding: 0.45rem 0.65rem;
		text-align: left;
	}
	.tool-body table th {
		background: rgba(255, 255, 255, 0.06);
		font-weight: 500;
		color: var(--text-primary);
		font-size: 0.78rem;
		letter-spacing: 0.03rem;
	}
	.tool-body table td {
		color: var(--text-secondary);
	}
	.tool-body table tr:hover td {
		background: rgba(255, 255, 255, 0.03);
	}

/* ============ Code / Pre ============ */
.tool-body pre {
	background: var(--bg-input);
	border: 1px solid var(--border-soft);
	border-radius: 6px;
	padding: 0.8rem 1rem;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
	font-size: 0.82rem;
	color: var(--text-secondary);
	overflow-x: auto;
	line-height: 1.5;
}

.tool-body code,
.tool-body .code {
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
	font-size: 0.85rem;
}

/* ============ Definition Lists ============ */
.tool-body dl {
	margin: 0.5rem 0;
}
	.tool-body dt {
		color: var(--text-primary);
		font-size: 0.85rem;
		margin-top: 0.4rem;
	}
	.tool-body dd {
		color: var(--text-secondary);
		font-size: 0.82rem;
		margin-left: 1.2rem;
		margin-bottom: 0.2rem;
	}

/* ============ Output Areas ============ */
.tool-body div[id^="div"] {
	background: var(--bg-input);
	border: 1px solid var(--border-soft);
	border-radius: 6px;
	padding: 0.75rem 1rem;
	margin: 0.5rem 0;
	color: var(--text-secondary);
	font-size: 0.85rem;
	min-height: 2rem;
	line-height: 1.5;
}

/* ============ Result Label ============ */
.tool-body .label {
	font-size: 0.78rem;
	color: var(--text-muted);
	letter-spacing: 0.05rem;
	text-transform: uppercase;
	font-weight: 500;
	margin-bottom: 0.3rem;
	display: block;
}

/* ============ Divider ============ */
.tool-body hr {
	border: none;
	border-top: 1px solid var(--border-soft);
	margin: 1.2rem 0;
}

/* ============ Footer ============ */
.page-footer {
	margin-top: 3rem;
	text-align: center;
}
	.page-footer .copyright {
		font-size: 0.6rem;
		color: var(--text-muted);
		letter-spacing: 0.2rem;
		text-transform: uppercase;
	}

/* ============ Entry Animation ============ */
@keyframes fadeInUp {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}
.top-nav    { animation: fadeInUp 0.5s ease-out both; animation-delay: 0.05s; }
.tool-header { animation: fadeInUp 0.5s ease-out both; animation-delay: 0.1s; }
.tool-body   { animation: fadeInUp 0.5s ease-out both; animation-delay: 0.18s; }
.page-footer { animation: fadeInUp 0.5s ease-out both; animation-delay: 0.25s; }

/* ============ Responsive ============ */
@media (max-width: 600px) {
	.container { padding: 1.2rem 1rem 2rem; }
	.tool-header h1 { font-size: 1.2rem; }
	.tool-body input[type="text"],
	.tool-body textarea {
		max-width: 100%;
	}
	.tool-body button {
		padding: 0.5rem 1rem;
	}
}

/* ============ iOS 兼容 ============ */
.tool-body input,
.tool-body textarea,
.tool-body button {
	-webkit-appearance: none;
	appearance: none;
	border-radius: 6px;
}
.tool-body select {
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.6rem center;
	padding-right: 2rem;
}

/* ============ 代码块滚动条 ============ */
.tool-body pre::-webkit-scrollbar {
	height: 6px;
}
.tool-body pre::-webkit-scrollbar-track {
	background: transparent;
}
.tool-body pre::-webkit-scrollbar-thumb {
	background: var(--border-soft);
	border-radius: 3px;
}

/* ============ 焦点指示 (Accessibility) ============ */
.tool-body a:focus-visible,
.tool-body button:focus-visible,
.tool-body input:focus-visible,
.tool-body select:focus-visible,
.tool-body textarea:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ============ 打印样式 ============ */
@media print {
	#bg, .top-nav, .page-footer { display: none; }
	.container { max-width: 100%; padding: 0; min-height: auto; }
	.tool-body input,
	.tool-body textarea,
	.tool-body pre {
		border: 1px solid #ccc;
		background: #fff;
		color: #000;
	}
	.tool-body button { display: none; }
	body { background: #fff; color: #000; }
	.tool-body div[id^="div"] {
		border: 1px solid #ddd;
		background: #f9f9f9;
		color: #000;
	}
}
