/*
 * 会员组购买 - 前端发布页 + 会员中心
 * 布局参照参考图：左侧编辑器卡片 + 右侧参数栏
 */

.mgb-publish,
.mgb-user-center {
	--mgb-pink: #e8467c;
	--mgb-line: rgba(39, 39, 39, .08);
}

/* ===========================================================================
 * 左侧编辑器
 * ========================================================================= */

.mgb-editor-card {
	background: var(--bs-body-bg, #fff);
	border: 1px solid var(--mgb-line);
	border-radius: 14px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
	overflow: hidden;
}

/* ---------- 封面 ---------- */
.mgb-cover {
	position: relative;
	margin: 16px;
	height: 190px;
	border: 1px dashed rgba(39, 39, 39, .18);
	border-radius: 10px;
	background-color: rgba(39, 39, 39, .025);
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color .2s ease;
}

.mgb-cover:hover {
	border-color: var(--bs-primary, #4e9cff);
}

.mgb-cover-actions {
	display: flex;
	gap: 18px;
	position: relative;
	z-index: 2;
}

.mgb-cover-btn {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 0;
	background: rgba(39, 39, 39, .08);
	color: #8a9099;
	font-size: 20px;
	cursor: pointer;
	transition: all .2s ease;
}

.mgb-cover-btn:hover {
	background: var(--bs-primary, #4e9cff);
	color: #fff;
	transform: translateY(-2px);
}

.mgb-cover.has-img {
	border-style: solid;
	border-color: transparent;
}

.mgb-cover.has-img::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .3);
	border-radius: 10px;
	opacity: 0;
	transition: opacity .2s ease;
	pointer-events: none;
}

.mgb-cover.has-img .mgb-cover-actions {
	opacity: 0;
	transition: opacity .2s ease;
}

.mgb-cover.has-img:hover::after,
.mgb-cover.has-img:hover .mgb-cover-actions {
	opacity: 1;
}

.mgb-cover-del {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 3;
	width: 26px;
	height: 26px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .45);
	color: #fff;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	display: none;
}

.mgb-cover.has-img .mgb-cover-del {
	display: block;
}

.mgb-cover.uploading::before {
	content: "上传中…";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, .82);
	border-radius: 10px;
	font-size: 13px;
	color: #666;
	z-index: 4;
}

/* ---------- 标题 ---------- */
.mgb-title-input {
	display: block;
	width: calc(100% - 32px);
	margin: 4px 16px 0;
	padding: 10px 0;
	border: 0;
	border-bottom: 1px solid transparent;
	background: transparent;
	font-size: 1.6rem;
	font-weight: 600;
	color: var(--bs-body-color, #2c3038);
	outline: none;
	transition: border-color .2s ease;
}

.mgb-title-input::placeholder {
	color: #c4c8cf;
	font-weight: 600;
}

.mgb-title-input:focus {
	border-bottom-color: var(--mgb-pink);
}

/* ---------- 工具栏 ---------- */
.mgb-toolbar {
	border-top: 1px solid var(--mgb-line);
	border-bottom: 1px solid var(--mgb-line);
	margin-top: 10px;
	padding: 4px 10px;
}

.mgb-toolbar-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px;
	padding: 4px 0;
}

.mgb-toolbar-row2 {
	border-top: 1px solid var(--mgb-line);
	gap: 6px;
}

.mgb-toolbar-row2.collapsed {
	display: none;
}

.mgb-tb {
	min-width: 32px;
	height: 32px;
	padding: 0 7px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	color: #5c636d;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	transition: all .15s ease;
}

.mgb-tb:hover {
	background: rgba(39, 39, 39, .06);
	color: var(--bs-body-color, #2c3038);
}

.mgb-tb.active,
.mgb-tb-toggle.active {
	border-color: var(--mgb-pink);
	color: var(--mgb-pink);
}

.mgb-tb-txt {
	font-size: 14px;
	font-weight: 600;
	font-family: ui-monospace, Menlo, Consolas, monospace;
}

.mgb-tb-sep {
	width: 1px;
	height: 18px;
	background: var(--mgb-line);
	margin: 0 5px;
}

.mgb-tb-select {
	height: 30px;
	border: 1px solid rgba(39, 39, 39, .14);
	border-radius: 6px;
	background: var(--bs-body-bg, #fff);
	color: #5c636d;
	font-size: 13px;
	padding: 0 6px;
}

.mgb-tb-color {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	border-radius: 6px;
	cursor: pointer;
	color: #5c636d;
}

.mgb-tb-color:hover {
	background: rgba(39, 39, 39, .06);
}

/* ---------- 正文 ---------- */
.mgb-editor-body {
	position: relative;
}

.mgb-content {
	display: block;
	width: 100%;
	min-height: 420px;
	border: 0;
	outline: none;
	resize: vertical;
	padding: 18px 16px;
	background: transparent;
	color: var(--bs-body-color, #2c3038);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .9rem;
	line-height: 1.85;
}

.mgb-content::placeholder {
	color: #c4c8cf;
	font-family: inherit;
}

.mgb-preview {
	min-height: 420px;
	padding: 18px 16px;
	line-height: 1.85;
}

.mgb-preview img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

.mgb-editor-foot {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 8px 16px;
	border-top: 1px solid var(--mgb-line);
	font-size: .75rem;
	color: #9aa0a6;
}

.mgb-path {
	font-family: ui-monospace, Menlo, Consolas, monospace;
}

.mgb-autosave {
	margin-left: auto;
	color: #19a974;
}

/* 全屏 */
.mgb-editor-card.mgb-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 10000;
	border-radius: 0;
	margin: 0;
	overflow-y: auto;
}

.mgb-editor-card.mgb-fullscreen .mgb-content,
.mgb-editor-card.mgb-fullscreen .mgb-preview {
	min-height: calc(100vh - 300px);
}

body.mgb-fullscreen-on {
	overflow: hidden;
}

/* 草稿提示 */
.mgb-draft-tip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	padding: 6px 14px;
	border-radius: 20px;
	background: rgba(39, 39, 39, .05);
	color: #6c757d;
	font-size: .8rem;
	text-decoration: none;
	transition: all .2s ease;
}

.mgb-draft-tip:hover {
	background: rgba(var(--bs-primary-rgb, 78, 156, 255), .1);
	color: var(--bs-primary, #4e9cff);
}

/* ===========================================================================
 * 右侧参数栏
 * ========================================================================= */

.mgb-side-card {
	background: var(--bs-body-bg, #fff);
	border: 1px solid var(--mgb-line);
	border-radius: 14px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
	padding: 18px;
	margin-bottom: 20px;
}

.mgb-side-title {
	position: relative;
	padding-left: 12px;
	font-size: .95rem;
	font-weight: 600;
	margin-bottom: 12px;
	color: var(--bs-body-color, #2c3038);
}

.mgb-side-title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 4px;
	height: 15px;
	border-radius: 2px;
	background: var(--mgb-pink);
}

.mgb-side-hint {
	font-size: .76rem;
	color: #9aa0a6;
	margin-bottom: 8px;
	line-height: 1.6;
}

/* 分类 */
.mgb-cat-row {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 11px 12px;
	border: 0;
	border-radius: 8px;
	background: rgba(39, 39, 39, .04);
	color: #5c636d;
	font-size: .88rem;
	cursor: pointer;
	transition: all .2s ease;
}

.mgb-cat-row:hover {
	background: rgba(39, 39, 39, .07);
}

.mgb-cat-row.chosen {
	color: var(--bs-body-color, #2c3038);
	font-weight: 500;
}

.mgb-cat-arrow {
	margin-left: auto;
	transition: transform .2s ease;
}

.mgb-cat-row.open .mgb-cat-arrow {
	transform: rotate(90deg);
}

.mgb-cat-list {
	margin-top: 6px;
	max-height: 220px;
	overflow-y: auto;
	border: 1px solid var(--mgb-line);
	border-radius: 8px;
	padding: 4px;
}

.mgb-cat-item {
	display: block;
	padding: 7px 10px;
	border-radius: 6px;
	font-size: .84rem;
	cursor: pointer;
	color: #5c636d;
}

.mgb-cat-item:hover {
	background: rgba(39, 39, 39, .05);
}

.mgb-cat-item input {
	margin-right: 6px;
	accent-color: var(--mgb-pink);
}

.mgb-cat-empty {
	padding: 10px;
	font-size: .8rem;
	color: #9aa0a6;
}

.mgb-side-textarea {
	width: 100%;
	min-height: 86px;
	padding: 10px 12px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: rgba(39, 39, 39, .04);
	color: var(--bs-body-color, #2c3038);
	font-size: .84rem;
	resize: vertical;
	outline: none;
}

.mgb-side-textarea:focus {
	border-color: var(--mgb-pink);
	background: var(--bs-body-bg, #fff);
}

/* 付费内容 */
.mgb-side-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 11px 0;
	border-bottom: 1px solid var(--mgb-line);
	font-size: .86rem;
	color: #5c636d;
}

.mgb-side-row:last-child {
	border-bottom: 0;
}

.mgb-yen {
	color: #4e9cff;
}

.mgb-switch {
	position: relative;
	display: inline-block;
	width: 46px;
	height: 25px;
	flex: 0 0 46px;
}

.mgb-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.mgb-switch-slider {
	position: absolute;
	inset: 0;
	background: #ced4da;
	border-radius: 25px;
	cursor: pointer;
	transition: background .2s ease;
}

.mgb-switch-slider::before {
	content: "";
	position: absolute;
	width: 19px;
	height: 19px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform .2s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.mgb-switch input:checked + .mgb-switch-slider {
	background: #22c55e;
}

.mgb-switch input:checked + .mgb-switch-slider::before {
	transform: translateX(21px);
}

.mgb-segment {
	display: inline-flex;
	background: rgba(39, 39, 39, .05);
	border-radius: 20px;
	padding: 2px;
}

.mgb-segment button {
	border: 0;
	background: transparent;
	border-radius: 20px;
	padding: 4px 12px;
	font-size: .78rem;
	color: #6c757d;
	cursor: pointer;
	transition: all .2s ease;
}

.mgb-segment button.active {
	background: rgba(232, 70, 124, .12);
	color: var(--mgb-pink);
	font-weight: 500;
}

.mgb-price-input {
	width: 110px;
	padding: 5px 10px;
	border: 1px solid rgba(39, 39, 39, .14);
	border-radius: 7px;
	background: transparent;
	font-size: .84rem;
	text-align: right;
	outline: none;
}

.mgb-price-input:focus {
	border-color: var(--mgb-pink);
}

.mgb-add-res {
	border: 1px solid rgba(78, 156, 255, .5);
	background: transparent;
	color: #4e9cff;
	border-radius: 6px;
	padding: 3px 10px;
	font-size: .78rem;
	cursor: pointer;
	transition: all .2s ease;
}

.mgb-add-res:hover {
	background: #4e9cff;
	color: #fff;
}

.mgb-res-list {
	margin-top: 10px;
}

.mgb-res-row {
	display: grid;
	grid-template-columns: 1fr 1fr 70px 24px;
	gap: 6px;
	margin-bottom: 8px;
}

.mgb-res-row input {
	min-width: 0;
	padding: 6px 8px;
	border: 1px solid rgba(39, 39, 39, .14);
	border-radius: 6px;
	background: transparent;
	font-size: .76rem;
	outline: none;
}

.mgb-res-row input:focus {
	border-color: var(--mgb-pink);
}

.mgb-res-del {
	border: 0;
	background: transparent;
	color: #d14343;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
}

/* 操作区 */
.mgb-actions {
	text-align: center;
}

.mgb-ready {
	position: relative;
	margin-bottom: 16px;
	color: #c4c8cf;
	font-size: .82rem;
}

.mgb-ready::before,
.mgb-ready::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 24%;
	height: 1px;
	background: var(--mgb-line);
}

.mgb-ready::before {
	left: 0;
}

.mgb-ready::after {
	right: 0;
}

.mgb-action-row {
	display: flex;
	gap: 10px;
	margin-bottom: 10px;
}

.mgb-act {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 11px 14px;
	border: 0;
	border-radius: 8px;
	color: #fff;
	font-size: .88rem;
	font-weight: 500;
	cursor: pointer;
	transition: all .2s ease;
}

.mgb-act:hover:not(:disabled) {
	filter: brightness(1.06);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, .13);
}

.mgb-act:disabled {
	opacity: .6;
	cursor: default;
}

.mgb-act-draft {
	background: linear-gradient(90deg, #3ecf7a, #1fb964);
}

.mgb-act-collect {
	background: linear-gradient(90deg, #ff8fa3, #f2567c);
}

.mgb-act-submit {
	background: linear-gradient(90deg, #4fc3f7, #2196f3);
}

.mgb-act-ghost {
	background: rgba(39, 39, 39, .06);
	color: #5c636d;
}

.mgb-action-tip {
	margin-top: 12px;
	font-size: .76rem;
	color: #9aa0a6;
	line-height: 1.7;
}

/* 消息条 */
.mgb-msg {
	padding: 9px 12px;
	border-radius: 8px;
	font-size: .8rem;
	margin-bottom: 12px;
	text-align: left;
	line-height: 1.6;
}

.mgb-msg-success {
	background: rgba(34, 197, 94, .12);
	color: #15803d;
}

.mgb-msg-error {
	background: rgba(209, 67, 67, .1);
	color: #b91c1c;
}

.mgb-msg-info {
	background: rgba(78, 156, 255, .1);
	color: #1d4ed8;
}

.mgb-msg a {
	color: inherit;
	text-decoration: underline;
}

/* ===========================================================================
 * 一键采集弹窗
 * ========================================================================= */

.mgb-dialog-mask {
	position: fixed;
	inset: 0;
	z-index: 10050;
	background: rgba(0, 0, 0, .45);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.mgb-dialog-mask[hidden] {
	display: none;
}

.mgb-dialog {
	width: 100%;
	max-width: 460px;
	background: var(--bs-body-bg, #fff);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.mgb-dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid var(--mgb-line);
	font-size: .95rem;
}

.mgb-dialog-close {
	border: 0;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	color: #9aa0a6;
	cursor: pointer;
}

.mgb-dialog-body {
	padding: 18px;
}

.mgb-dialog-label {
	display: block;
	font-size: .82rem;
	font-weight: 500;
	margin-bottom: 6px;
}

.mgb-dialog-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid rgba(39, 39, 39, .14);
	border-radius: 8px;
	background: transparent;
	font-size: .86rem;
	outline: none;
}

.mgb-dialog-input:focus {
	border-color: var(--mgb-pink);
}

.mgb-dialog-hint {
	font-size: .76rem;
	color: #9aa0a6;
	margin-top: 8px;
	line-height: 1.7;
}

.mgb-dialog-check {
	display: flex;
	align-items: flex-start;
	gap: 7px;
	margin-top: 12px;
	font-size: .78rem;
	color: #6c757d;
	cursor: pointer;
}

.mgb-dialog-check input {
	margin-top: 2px;
	accent-color: var(--mgb-pink);
}

.mgb-dialog-foot {
	display: flex;
	gap: 10px;
	padding: 14px 18px;
	border-top: 1px solid var(--mgb-line);
}

/* ===========================================================================
 * 会员中心
 * ========================================================================= */

.mgb-user-side {
	overflow: hidden;
}

.mgb-user-avatar img {
	width: 76px;
	height: 76px;
	border-radius: 50%;
	border: 3px solid rgba(var(--bs-primary-rgb, 78, 156, 255), .18);
}

.mgb-user-name {
	margin-top: 10px;
	font-weight: 600;
}

.mgb-user-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-top: 6px;
	padding: 2px 11px;
	border-radius: 20px;
	background: var(--mgb-color, #9aa7b8);
	color: #fff;
	font-size: .75rem;
}

.mgb-user-end {
	margin-top: 6px;
	font-size: .75rem;
	color: #9aa0a6;
}

.mgb-user-nav {
	border-top: 1px solid rgba(39, 39, 39, .08);
}

.mgb-user-nav a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 20px;
	color: #5c636d;
	font-size: .88rem;
	text-decoration: none;
	border-left: 3px solid transparent;
	transition: all .2s ease;
}

.mgb-user-nav a:hover {
	background: rgba(39, 39, 39, .03);
	color: var(--bs-primary, #4e9cff);
}

.mgb-user-nav a.active {
	background: rgba(var(--bs-primary-rgb, 78, 156, 255), .07);
	border-left-color: var(--bs-primary, #4e9cff);
	color: var(--bs-primary, #4e9cff);
	font-weight: 500;
}

.mgb-user-nav a i {
	width: 18px;
	text-align: center;
}

.mgb-user-nav .mgb-logout:hover {
	color: #d14343;
}

.mgb-stat-cell {
	text-align: center;
	padding: 14px 8px;
	border-radius: 12px;
	background: rgba(39, 39, 39, .03);
}

.mgb-stat-cell span {
	display: block;
	font-size: .75rem;
	color: #9aa0a6;
}

.mgb-stat-cell b {
	font-size: 1.4rem;
	color: var(--bs-primary, #4e9cff);
}

.mgb-pills .nav-link {
	padding: 3px 12px;
	font-size: .8rem;
	border-radius: 20px;
	color: #6c757d;
}

.mgb-pills .nav-link.active {
	background: var(--bs-primary, #4e9cff);
	color: #fff;
}

.mgb-post-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 0;
	border-bottom: 1px solid rgba(39, 39, 39, .07);
}

.mgb-post-row:last-child {
	border-bottom: 0;
}

.mgb-post-thumb {
	width: 76px;
	height: 54px;
	flex: 0 0 76px;
	border-radius: 8px;
	background-size: cover;
	background-position: center;
	background-color: rgba(39, 39, 39, .05);
}

.mgb-post-thumb-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #c4c8cf;
}

.mgb-post-main {
	flex: 1 1 auto;
	min-width: 0;
}

.mgb-post-title {
	display: block;
	color: var(--bs-body-color, #2c3038);
	font-size: .9rem;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mgb-post-title:hover {
	color: var(--bs-primary, #4e9cff);
}

.mgb-post-meta {
	margin-top: 4px;
	font-size: .74rem;
	color: #9aa0a6;
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.mgb-tag-collected {
	color: #e8467c;
}

.mgb-post-ops {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}

.mgb-post-edit {
	font-size: .78rem;
	color: #6c757d;
	text-decoration: none;
}

.mgb-post-edit:hover {
	color: var(--bs-primary, #4e9cff);
}

/* 插件页面模板 */
.mgb-tpl-title {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 4px 0 20px;
}

/* ===========================================================================
 * 暗色与响应式
 * ========================================================================= */

@media (prefers-color-scheme: dark) {
	.mgb-publish,
	.mgb-user-center {
		--mgb-line: rgba(255, 255, 255, .1);
	}

	.mgb-cover,
	.mgb-cat-row,
	.mgb-side-textarea,
	.mgb-segment,
	.mgb-stat-cell,
	.mgb-draft-tip {
		background-color: rgba(255, 255, 255, .05);
	}

	.mgb-cover-btn {
		background: rgba(255, 255, 255, .1);
	}
}

[data-bs-theme="dark"] .mgb-publish,
[data-bs-theme="dark"] .mgb-user-center {
	--mgb-line: rgba(255, 255, 255, .1);
}

@media (max-width: 991.98px) {
	.mgb-user-side {
		position: static;
	}
}

@media (max-width: 767.98px) {
	.mgb-cover {
		height: 150px;
		margin: 12px;
	}

	.mgb-title-input {
		font-size: 1.3rem;
		width: calc(100% - 24px);
		margin: 4px 12px 0;
	}

	.mgb-content,
	.mgb-preview {
		min-height: 300px;
		padding: 14px 12px;
	}

	.mgb-toolbar {
		padding: 2px 6px;
	}

	.mgb-tb {
		min-width: 30px;
		height: 30px;
		font-size: 14px;
	}

	.mgb-res-row {
		grid-template-columns: 1fr 1fr;
	}

	.mgb-res-row .mgb-res-del {
		grid-column: span 2;
		justify-self: end;
	}

	.mgb-post-row {
		flex-wrap: wrap;
	}
}
