/**
 * Friend Links — 前台样式
 * 所有颜色来自后台配置，通过 CSS 变量注入（.fl-wrap 作用域），不影响主题其它部分。
 */

.fl-page-container {
	max-width: 1180px;
	margin: 0 auto;
	padding: 24px 16px 48px;
}

.fl-wrap {
	--fl-primary: #ff5c8d;
	--fl-card-bg: #ffffff;
	--fl-text: #333333;
	--fl-desc: #888888;
	--fl-border: #eeeeee;
	--fl-radius: 12px;
	--fl-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
	--fl-cols: 3;

	box-sizing: border-box;
	color: var(--fl-text);
	width: 100%;
}

.fl-wrap *,
.fl-wrap *::before,
.fl-wrap *::after {
	box-sizing: border-box;
}

/* ---------- 头部 ---------- */

.fl-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 22px;
}

.fl-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 22px;
	font-weight: 600;
	color: var(--fl-text);
	line-height: 1.3;
}

.fl-bar {
	display: inline-block;
	width: 4px;
	height: 18px;
	border-radius: 2px;
	background: var(--fl-primary);
}

.fl-apply-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 22px;
	border: 1px solid var(--fl-primary);
	border-radius: 999px;
	background: transparent;
	color: var(--fl-primary);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.fl-apply-btn:hover {
	background: var(--fl-primary);
	color: #fff;
}

.fl-empty {
	padding: 40px 0;
	text-align: center;
	color: var(--fl-desc);
}

/* ---------- 主体：PC 左侧导航 + 右侧网格 ---------- */

.fl-body {
	display: flex;
	gap: 24px;
	align-items: flex-start;
}

.fl-nav {
	flex: 0 0 180px;
	width: 180px;
	position: sticky;
	top: 80px;
}

.fl-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fl-nav li + li {
	margin-top: 4px;
}

.fl-nav-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 8px;
	color: var(--fl-text);
	text-decoration: none;
	font-size: 14px;
	transition: all 0.18s ease;
}

.fl-nav-item:hover {
	background: rgba(0, 0, 0, 0.04);
	color: var(--fl-primary);
	text-decoration: none;
}

.fl-nav-item.is-active {
	background: var(--fl-primary);
	color: #fff;
}

.fl-count {
	font-size: 12px;
	opacity: 0.65;
}

.fl-content {
	flex: 1 1 auto;
	min-width: 0;
}

.fl-group {
	display: none;
}

.fl-group.is-active {
	display: block;
}

.fl-group-title {
	display: none;
}

.fl-grid {
	display: grid;
	grid-template-columns: repeat(var(--fl-cols), minmax(0, 1fr));
	gap: 16px;
}

/* ---------- 卡片 ---------- */

.fl-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border: 1px solid var(--fl-border);
	border-radius: var(--fl-radius);
	background: var(--fl-card-bg);
	box-shadow: var(--fl-shadow);
	text-decoration: none;
	color: var(--fl-text);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	min-width: 0;
}

.fl-card:hover {
	transform: translateY(-3px);
	border-color: var(--fl-primary);
	text-decoration: none;
	color: var(--fl-text);
}

.fl-card-logo {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--fl-primary);
	color: #fff;
	font-size: 18px;
	font-weight: 600;
	flex-shrink: 0;
}

.fl-card-logo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.fl-logo-text {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	line-height: 1;
}

.fl-logo-fallback .fl-logo-text {
	display: flex !important;
}

.fl-card-main {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.fl-card-name {
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.fl-card-desc {
	font-size: 13px;
	color: var(--fl-desc);
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---------- 弹窗 ---------- */

.fl-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 24px 12px;
	overflow-y: auto;
}

.fl-modal[hidden] {
	display: none;
}

.fl-modal-mask {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.fl-modal-box {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 640px;
	margin: auto;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
	padding: 24px;
	animation: fl-in 0.2s ease;
}

@keyframes fl-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.fl-modal-close {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 30px;
	height: 30px;
	line-height: 1;
	border: none;
	background: transparent;
	font-size: 24px;
	color: #999;
	cursor: pointer;
	border-radius: 50%;
}

.fl-modal-close:hover {
	background: #f3f3f3;
	color: #333;
}

.fl-modal-head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
}

.fl-modal-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--fl-primary, #ff5c8d);
	color: #fff;
	font-size: 14px;
}

.fl-modal-title {
	margin: 0;
	font-size: 19px;
	font-weight: 600;
	color: #222;
}

.fl-notice {
	background: #f6f7f9;
	border-radius: 10px;
	padding: 14px 16px;
	margin-bottom: 18px;
}

.fl-notice-title {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 600;
	color: #444;
}

.fl-notice-body ul,
.fl-notice-body ol {
	margin: 0;
	padding-left: 20px;
	font-size: 13px;
	line-height: 1.9;
	color: #6b6b6b;
}

.fl-notice-body li {
	margin: 0;
}

/* ---------- 表单 ---------- */

.fl-form-row {
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
}

.fl-field {
	flex: 1 1 240px;
	min-width: 0;
	margin-bottom: 14px;
}

.fl-field > label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	color: #555;
}

.fl-req {
	color: #e74c3c;
}

.fl-form input[type="text"],
.fl-form input[type="url"],
.fl-form select,
.fl-form textarea {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	font-size: 14px;
	color: #333;
	background: #fff;
	transition: border-color 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.fl-form input:focus,
.fl-form select:focus,
.fl-form textarea:focus {
	outline: none;
	border-color: var(--fl-primary, #ff5c8d);
}

.fl-form textarea {
	resize: vertical;
}

.fl-input-group {
	display: flex;
	gap: 8px;
}

.fl-input-group input {
	flex: 1 1 auto;
	min-width: 0;
}

.fl-fetch-btn {
	flex: 0 0 auto;
	padding: 0 14px;
	border: 1px solid var(--fl-primary, #ff5c8d);
	border-radius: 8px;
	background: transparent;
	color: var(--fl-primary, #ff5c8d);
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.18s ease;
}

.fl-fetch-btn:hover {
	background: var(--fl-primary, #ff5c8d);
	color: #fff;
}

.fl-fetch-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* 蜜罐：对真实用户不可见 */
.fl-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.fl-form-msg {
	margin-bottom: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 13px;
}

.fl-form-msg.fl-ok {
	background: #eafaf1;
	color: #1a7f45;
}

.fl-form-msg.fl-err {
	background: #fdecea;
	color: #c0392b;
}

.fl-form-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.fl-btn-primary {
	padding: 9px 22px;
	border: none;
	border-radius: 8px;
	background: var(--fl-primary, #ff5c8d);
	color: #fff;
	font-size: 14px;
	cursor: pointer;
	transition: opacity 0.18s ease;
}

.fl-btn-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.fl-btn-ghost {
	padding: 9px 22px;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	color: #666;
	font-size: 14px;
	cursor: pointer;
}

body.fl-modal-open {
	overflow: hidden;
}

/* ---------- 移动端：顶部横向分类 + 分组展示 ---------- */

@media (max-width: 768px) {
	.fl-body {
		display: block;
	}

	.fl-nav {
		width: 100%;
		position: static;
		margin-bottom: 16px;
	}

	.fl-nav ul {
		display: flex;
		gap: 8px;
		overflow-x: auto;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
	}

	.fl-nav ul::-webkit-scrollbar {
		display: none;
	}

	.fl-nav li + li {
		margin-top: 0;
	}

	.fl-nav-item {
		white-space: nowrap;
	}

	.fl-group {
		display: block !important;
		margin-bottom: 20px;
	}

	.fl-group-title {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0 0 12px;
		font-size: 16px;
		font-weight: 600;
	}

	.fl-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.fl-card {
		padding: 12px;
		gap: 10px;
	}

	.fl-card-logo {
		flex: 0 0 38px;
		width: 38px;
		height: 38px;
		font-size: 16px;
	}

	.fl-card-name {
		font-size: 14px;
	}

	.fl-card-desc {
		font-size: 12px;
	}

	.fl-form-row {
		display: block;
	}

	.fl-modal-box {
		padding: 18px 16px;
	}
}

@media (max-width: 480px) {
	.fl-grid {
		grid-template-columns: 1fr;
	}

	.fl-header {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ---------- 表单提示 ---------- */

.fl-field-tip {
	margin: 5px 0 0;
	font-size: 12px;
	color: #999;
	line-height: 1.5;
}

/* ---------- 小工具场景（窄栏） ---------- */

.fl-widget-links .fl-wrap {
	--fl-cols: 1;
}

.fl-widget-links .fl-header {
	margin-bottom: 14px;
}

.fl-widget-links .fl-title {
	font-size: 18px;
}

.fl-widget-links .fl-grid {
	gap: 10px;
}

/* ---------- 区块占位 ---------- */

.fl-block-placeholder {
	padding: 20px;
	background: #f6f7f9;
	border: 1px dashed #ccd0d4;
	border-radius: 6px;
	text-align: center;
	color: #646970;
	font-size: 13px;
}

/* 标题隐藏时按钮靠左对齐 */
.fl-header.fl-header-notitle {
	justify-content: flex-start;
}

/* ---------- 站点截图 ---------- */

.fl-card-shot .fl-card-shot-wrap {
	display: block;
	width: 100%;
	height: 110px;
	overflow: hidden;
	border-radius: var(--fl-radius) var(--fl-radius) 0 0;
	background: #f2f4f7;
}

.fl-card-shot .fl-card-shot-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	display: block;
}

.fl-card-shot .fl-card-logo {
	margin-top: -14px;
	position: relative;
	z-index: 1;
}

/* ---------- 卡片内最新文章 ---------- */

.fl-card-posts {
	display: block;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px dashed var(--fl-border, #eee);
}

.fl-card-post {
	display: block;
	font-size: 12px;
	line-height: 1.5;
	color: var(--fl-desc-color, #888);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fl-card-post + .fl-card-post {
	margin-top: 3px;
}

.fl-card-post::before {
	content: '·';
	margin-right: 5px;
	opacity: 0.6;
}

/* ---------- 验证码 ---------- */

.fl-captcha-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.fl-captcha-q {
	font-size: 15px;
	font-weight: 600;
	color: var(--fl-primary, #ff5c8d);
	letter-spacing: 0.5px;
	white-space: nowrap;
}

.fl-captcha-row input {
	width: 90px;
	text-align: center;
}

.fl-field-captcha .cf-turnstile {
	min-height: 65px;
}
