/**
 * Ruyi Software 板块样式
 * - 后台 meta box
 * - 前台下载区块
 * - 前台卡片归档
 */

/* ================================================================
 * 后台 Meta Box
 * ================================================================ */
.ruyi-sw-metabox .ruyi-sw-info th { width: 100px; text-align: left; }
.ruyi-sw-metabox .ruyi-sw-entries { margin-top: 8px; }
.ruyi-sw-metabox .ruyi-sw-entries th { padding: 8px; background: #f6f7f7; }
.ruyi-sw-metabox .ruyi-sw-entries td { padding: 6px 8px; vertical-align: middle; }
.ruyi-sw-metabox .ruyi-sw-entries select,
.ruyi-sw-metabox .ruyi-sw-entries input { max-width: 100%; }
.ruyi-sw-metabox .ruyi-sw-del { color: #b32d2e; font-size: 16px; cursor: pointer; text-decoration: none; }
.ruyi-sw-metabox .ruyi-sw-del:hover { color: #dc3232; }

/* ================================================================
 * 前台下载区块
 * ================================================================ */
.ruyi-sw-download {
	margin: 28px 0 12px;
	padding: 20px 22px;
	background: linear-gradient(135deg, #f0f7ff 0%, #f9f9ff 100%);
	border: 1px solid #dfe8f5;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 40, 100, 0.04);
}

.ruyi-sw-title {
	margin: 0 0 14px;
	font-size: 18px;
	color: #2c5aa0;
	letter-spacing: 0.5px;
}

.ruyi-sw-info-list {
	margin: 0 0 14px;
	padding: 12px 16px;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 8px;
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 6px 20px;
	font-size: 14px;
}
.ruyi-sw-info-list li { margin: 0; padding: 0; }
.ruyi-sw-info-list strong { color: #555; margin-right: 4px; }
.ruyi-sw-info-list a { color: #2c5aa0; }

.ruyi-sw-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 10px;
}

.ruyi-sw-btn-wrap {
	display: inline-flex;
	align-items: stretch;
	gap: 0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.ruyi-sw-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	background: #4a90e2;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: background 0.2s;
}
.ruyi-sw-btn:hover { background: #357abd; color: #fff; text-decoration: none; }
.ruyi-sw-btn .ruyi-sw-plat { font-weight: 600; }

/* 各平台色 */
.ruyi-sw-plat-lanzou   { background: #ff6b35; }
.ruyi-sw-plat-lanzou:hover   { background: #e5551f; }
.ruyi-sw-plat-baidu    { background: #06a7ff; }
.ruyi-sw-plat-baidu:hover    { background: #0491de; }
.ruyi-sw-plat-quark    { background: #7b68ee; }
.ruyi-sw-plat-quark:hover    { background: #6350cf; }
.ruyi-sw-plat-xunlei   { background: #0091ea; }
.ruyi-sw-plat-xunlei:hover   { background: #007ac1; }
.ruyi-sw-plat-aliyun   { background: #ff7900; }
.ruyi-sw-plat-aliyun:hover   { background: #e56b00; }
.ruyi-sw-plat-123pan   { background: #00c853; }
.ruyi-sw-plat-123pan:hover   { background: #00a844; }
.ruyi-sw-plat-onedrive { background: #0078d4; }
.ruyi-sw-plat-onedrive:hover { background: #005a9e; }
.ruyi-sw-plat-github   { background: #24292e; }
.ruyi-sw-plat-github:hover   { background: #1a1e22; }
.ruyi-sw-plat-official { background: #2c5aa0; }
.ruyi-sw-plat-official:hover { background: #1e3f75; }
.ruyi-sw-plat-other    { background: #6c757d; }
.ruyi-sw-plat-other:hover    { background: #565e64; }

.ruyi-sw-pwd {
	display: inline-flex;
	align-items: center;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.95);
	border: none;
	border-left: 1px solid rgba(0, 0, 0, 0.1);
	color: #333;
	font-size: 13px;
	font-family: 'SF Mono', Consolas, monospace;
	cursor: pointer;
	transition: background 0.15s;
}
.ruyi-sw-pwd:hover { background: #fffde7; }
.ruyi-sw-pwd.copied { background: #c8e6c9; color: #2e7d32; }

.ruyi-sw-tip {
	margin: 12px 0 0;
	font-size: 12px;
	color: #888;
}

/* ================================================================
 * 下载区块加锁（扫码验证）
 * ================================================================ */
.ruyi-sw-body { position: relative; }

.ruyi-sw-download.is-locked .ruyi-sw-buttons {
	filter: blur(6px);
	pointer-events: none;
	user-select: none;
	opacity: 0.55;
}
.ruyi-sw-download.is-locked .ruyi-sw-buttons a { text-decoration: none; }

.ruyi-sw-lock {
	position: absolute;
	inset: -8px -8px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.72);
	backdrop-filter: blur(2px);
	border-radius: 10px;
	z-index: 5;
}
body.dark-mode .ruyi-sw-lock,
[data-theme="dark"] .ruyi-sw-lock {
	background: rgba(20, 22, 28, 0.75);
}

.ruyi-sw-lock-inner {
	width: 100%;
	max-width: 520px;
	margin: 10px;
	background: #fff;
	border: 1px solid #dfe4ee;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(30, 50, 90, 0.15);
	padding: 20px 22px;
	text-align: center;
}
body.dark-mode .ruyi-sw-lock-inner,
[data-theme="dark"] .ruyi-sw-lock-inner {
	background: #1e2028;
	border-color: #2f3444;
}

.ruyi-sw-lock-icon { font-size: 30px; margin-bottom: 4px; }
.ruyi-sw-lock-title { font-size: 17px; font-weight: 600; color: #2c5aa0; margin-bottom: 14px; }
body.dark-mode .ruyi-sw-lock-title,
[data-theme="dark"] .ruyi-sw-lock-title { color: #7ab0ff; }

.ruyi-sw-lock-body {
	display: flex;
	gap: 20px;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
}
.ruyi-sw-lock-qr img {
	width: 140px;
	height: 140px;
	object-fit: contain;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 4px;
}
.ruyi-sw-lock-qr-cap {
	font-size: 12px;
	color: #888;
	margin-top: 6px;
}

.ruyi-sw-lock-form {
	flex: 1;
	min-width: 200px;
	text-align: left;
}
.ruyi-sw-lock-tip {
	margin: 0 0 10px;
	font-size: 13px;
	color: #555;
	line-height: 1.6;
}
body.dark-mode .ruyi-sw-lock-tip,
[data-theme="dark"] .ruyi-sw-lock-tip { color: #bbb; }

.ruyi-sw-lock-inputrow {
	display: flex;
	gap: 6px;
}
.ruyi-sw-lock-input {
	flex: 1;
	padding: 9px 12px;
	font-size: 14px;
	border: 1px solid #ccd;
	border-radius: 6px;
	outline: none;
	background: #fff;
	color: #333;
}
.ruyi-sw-lock-input:focus { border-color: #4a90e2; box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15); }
body.dark-mode .ruyi-sw-lock-input,
[data-theme="dark"] .ruyi-sw-lock-input {
	background: #23262f;
	color: #eee;
	border-color: #3a3f4c;
}

.ruyi-sw-lock-btn {
	padding: 9px 16px;
	background: #2c5aa0;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.15s;
}
.ruyi-sw-lock-btn:hover { background: #1e3f75; }
.ruyi-sw-lock-btn:disabled { background: #999; cursor: wait; }

.ruyi-sw-lock-msg {
	min-height: 18px;
	margin-top: 8px;
	font-size: 12px;
}
.ruyi-sw-lock-msg.err { color: #d43030; }
.ruyi-sw-lock-msg.ok { color: #2e7d32; }

@media (max-width: 520px) {
	.ruyi-sw-lock-body { flex-direction: column; gap: 12px; }
	.ruyi-sw-lock-qr img { width: 120px; height: 120px; }
}

/* 深色模式 */
body.dark-mode .ruyi-sw-download,
[data-theme="dark"] .ruyi-sw-download {
	background: linear-gradient(135deg, #1e2a3a 0%, #24262e 100%);
	border-color: #2f3d55;
}
body.dark-mode .ruyi-sw-title,
[data-theme="dark"] .ruyi-sw-title { color: #7ab0ff; }
body.dark-mode .ruyi-sw-info-list,
[data-theme="dark"] .ruyi-sw-info-list { background: rgba(0, 0, 0, 0.2); }
body.dark-mode .ruyi-sw-info-list strong,
[data-theme="dark"] .ruyi-sw-info-list strong { color: #aab; }
body.dark-mode .ruyi-sw-pwd,
[data-theme="dark"] .ruyi-sw-pwd { background: rgba(255, 255, 255, 0.1); color: #ddd; }

/* ================================================================
 * 前台卡片归档（category-software.php 用）
 * ================================================================ */
.ruyi-sw-archive-head {
	text-align: center;
	margin: 20px 0 30px;
	padding: 30px 20px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
	border-radius: 12px;
}
.ruyi-sw-archive-head h1 { margin: 0 0 8px; font-size: 28px; color: #fff; }
.ruyi-sw-archive-head p { margin: 0; opacity: 0.9; font-size: 14px; }

.ruyi-sw-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 20px;
	margin: 20px 0;
}

.ruyi-sw-card {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 12px;
	overflow: hidden;
	transition: transform 0.15s, box-shadow 0.15s;
	display: flex;
	flex-direction: column;
}
.ruyi-sw-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.ruyi-sw-card-thumb {
	height: 140px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
	overflow: hidden;
}
.ruyi-sw-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ruyi-sw-card-thumb .ruyi-sw-emoji { font-size: 64px; opacity: 0.7; }
.ruyi-sw-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.ruyi-sw-card-body h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.4; }
.ruyi-sw-card-body h3 a { color: #333; text-decoration: none; }
.ruyi-sw-card-body h3 a:hover { color: #2c5aa0; }
.ruyi-sw-card-excerpt { flex: 1; margin: 0 0 12px; font-size: 13px; color: #666; line-height: 1.6; }
.ruyi-sw-card-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 12px;
	color: #999;
	padding-top: 10px;
	border-top: 1px solid #f0f0f0;
}
.ruyi-sw-card-meta .ruyi-sw-hits { color: #ff6b35; font-weight: 600; }
.ruyi-sw-card-meta .ruyi-sw-ver { background: #eef; padding: 2px 8px; border-radius: 4px; color: #557; }

body.dark-mode .ruyi-sw-card,
[data-theme="dark"] .ruyi-sw-card {
	background: #1e1e24;
	border-color: #2f3037;
}
body.dark-mode .ruyi-sw-card-body h3 a,
[data-theme="dark"] .ruyi-sw-card-body h3 a { color: #e0e0e0; }
body.dark-mode .ruyi-sw-card-excerpt,
[data-theme="dark"] .ruyi-sw-card-excerpt { color: #aaa; }
body.dark-mode .ruyi-sw-card-meta,
[data-theme="dark"] .ruyi-sw-card-meta { border-top-color: #2f3037; }

/* 响应式 */
@media (max-width: 768px) {
	.ruyi-sw-download { padding: 16px; }
	.ruyi-sw-title { font-size: 16px; }
	.ruyi-sw-btn { padding: 9px 14px; font-size: 13px; }
	.ruyi-sw-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
	.ruyi-sw-card-thumb { height: 100px; }
	.ruyi-sw-card-thumb .ruyi-sw-emoji { font-size: 44px; }
}
@media (max-width: 480px) {
	.ruyi-sw-grid { grid-template-columns: 1fr; }
}
