/**
 * Password Protection System
 * - Base password form
 * - Expired card (visitor view)
 * - Author notice & banner
 * - Password reset modal
 * - Protected layout
 */

/* -- CSS Variables (全局，所有密码相关组件共享) -- */
:root {
	--pw-purple: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
	--pw-purple-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
	--pw-purple-shadow-hover: 0 4px 12px rgba(79, 70, 229, 0.35);
	--pw-amber-bg: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
	--pw-amber-border: #fcd34d;
	--pw-red: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
	--pw-green: linear-gradient(135deg, #10b981 0%, #059669 100%);
	--pw-card-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	--pw-radius: 16px;
	--pw-radius-sm: 8px;
}

/* -- 1. Base Password Form -- */
body.single .password-protected-post {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	padding: 0 !important;
	border-radius: 0 !important;
	position: static !important;
}

.bk-password-form {
	display: flex;
	justify-content: center;
	padding: 2rem 0;
}

.bk-password-card {
	background: #fff;
	border-radius: var(--pw-radius);
	box-shadow: var(--pw-card-shadow);
	padding: 3rem 2.5rem 2rem;
	width: 100%;
	max-width: 560px;
	border: 1px solid #e8f0ff;
	text-align: center;
}

.bk-password-card > p {
	display: none;
	margin: 0;
	padding: 0;
}

.bk-password-icon {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 80px;
	height: 80px;
	margin: 0 auto 1.5rem;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 50%;
	color: #fff;
}

.bk-password-icon svg { color: #fff; }

.bk-password-title {
	font-size: 1.75rem;
	font-weight: 700;
	color: #333;
	margin: 0 0 1rem;
	line-height: 1.4;
}

.bk-password-message {
	font-size: 0.95rem;
	color: #666;
	line-height: 1.7;
	margin: 0 0 2rem;
}

.bk-password-input-group {
	display: flex;
	gap: 12px;
	margin-bottom: 1.5rem;
	align-items: center;
}

.bk-password-input-group > p {
	margin: 0 !important;
	padding: 0 !important;
	flex-shrink: 0;
	display: flex;
}

.bk-password-field {
	flex: 1;
	margin-bottom: 0;
}

.bk-password-field > p {
	margin: 0 !important;
	padding: 0 !important;
}

.bk-password-field input[type="password"] {
	width: 100%;
	padding: 0.875rem 1.25rem;
	font-size: 0.95rem;
	color: #333;
	background: #f8faff;
	border: 1.5px solid #e8f0ff;
	border-radius: 12px;
	outline: none;
	transition: all 0.25s ease;
	box-sizing: border-box;
}

.bk-password-field input[type="password"]::placeholder { color: #a0aec0; }

.bk-password-field input[type="password"]:focus {
	border-color: #4a6cf7;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

.bk-password-submit {
	padding: 0.875rem 2rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.25s ease;
	flex-shrink: 0;
	width: auto;
}

.bk-password-submit:hover {
	background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.bk-password-submit:active { transform: translateY(0); }

.bk-password-author {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid #f0f0f0;
}

.bk-password-avatar img { border-radius: 50%; width: 32px; height: 32px; }
.bk-author-name { font-size: 0.9rem; font-weight: 500; color: #333; }
.bk-post-time { font-size: 0.85rem; color: #999; }
.bk-password-form input[type="hidden"] { display: none; }

/* -- 2. Password Expired Card (visitor view) -- */
.bk-password-expired-form { max-width: 480px; margin: 60px auto; }

.bk-password-expired-card {
	background: #fff;
	border-radius: var(--pw-radius);
	padding: 48px 40px;
	text-align: center;
	box-shadow: var(--pw-card-shadow);
	border: 1px solid #fee2e2;
}

/* 覆盖 .bk-password-card > p 的隐藏规则 */
.bk-password-expired-card > p { display: block !important; }

.bk-password-expired-icon {
	background: var(--pw-red) !important;
	margin-bottom: 24px !important;
}

.bk-password-expired-card .bk-password-title {
	color: #dc2626;
	font-size: 20px !important;
	font-weight: 600;
	margin-bottom: 16px !important;
}

.bk-password-expired-card .bk-password-message {
	color: #64748b;
	font-size: 15px;
	line-height: 1.7;
	display: block !important;
	margin-bottom: 12px !important;
}

.bk-password-expired-hint {
	color: #94a3b8;
	font-size: 13px;
	line-height: 1.6;
	display: block !important;
	margin: 0 0 16px !important;
}

.bk-password-expired-time {
	color: #cbd5e1;
	font-size: 12px;
	display: block !important;
	margin: 0 !important;
	padding-top: 16px;
	border-top: 1px solid #f1f5f9;
}

/* -- 3. Author Notice (in password form) -- */
.bk-password-author-notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	background: var(--pw-amber-bg);
	border: 1px solid #fde68a;
	border-radius: 10px;
	padding: 12px 16px;
	margin-bottom: 20px;
}

.bk-password-author-notice svg { flex-shrink: 0; color: #d97706; margin-top: 2px; }
.bk-password-author-notice span { color: #92400e; font-size: 13px; line-height: 1.6; }

/* -- 4. Author Actions & Banner Button (shared) -- */
.bk-password-author-actions {
	display: flex;
	justify-content: center;
	margin: 16px 0 8px;
}

.bk-password-edit-btn,
.bk-password-banner-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	background: var(--pw-purple);
	color: #fff !important;
	border: none;
	border-radius: var(--pw-radius-sm);
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	flex-shrink: 0;
	transition: all 0.2s ease;
	box-shadow: var(--pw-purple-shadow);
	cursor: pointer;
}

.bk-password-edit-btn:hover,
.bk-password-banner-btn:hover {
	transform: translateY(-1px);
	box-shadow: var(--pw-purple-shadow-hover);
	text-decoration: none;
	color: #fff !important;
}

.bk-password-edit-btn svg,
.bk-password-banner-btn svg { color: #fff; }

/* -- 5. Author Expired Badge (archive card) -- */
.post-status-badge.author-expired {
	background: var(--pw-amber-bg);
	color: #d97706;
	border: 1px solid var(--pw-amber-border);
}

.post-status-badge.author-expired svg { color: #d97706; }

/* -- 6. Author Expired Banner (single post) -- */
.bk-password-author-banner {
	display: flex;
	align-items: center;
	gap: 14px;
	background: var(--pw-amber-bg);
	border: 1px solid var(--pw-amber-border);
	border-left: 4px solid #f59e0b;
	border-radius: 10px;
	padding: 16px 20px;
	margin-bottom: 24px;
}

.bk-password-banner-icon {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}

.bk-password-banner-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bk-password-banner-content strong { color: #92400e; font-size: 15px; }
.bk-password-banner-content span { color: #b45309; font-size: 13px; line-height: 1.5; }
.bk-password-banner-time { color: #a16207 !important; font-size: 12px !important; margin-top: 2px; }

/* -- 7. Password Reset Modal -- */
.bk-password-reset-modal {
	position: fixed !important;
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	left: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	z-index: 9999 !important;
	display: flex;
	align-items: center !important;
	justify-content: center !important;
}

.bk-password-reset-modal.modal-hidden {
	display: none !important;
}

.bk-modal-overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
	pointer-events: auto;
}

.bk-modal-content {
	position: relative;
	z-index: 10;
	pointer-events: auto;
	background: #fff;
	border-radius: var(--pw-radius);
	width: 90%;
	max-width: 480px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	animation: bkModalFadeIn 0.25s ease;
}

@keyframes bkModalFadeIn {
	from { opacity: 0; transform: translateY(20px) scale(0.95); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.bk-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid #f1f5f9;
}

.bk-modal-header h3 { margin: 0; font-size: 18px; font-weight: 600; color: #1e293b; }

.bk-modal-close {
	background: none;
	border: none;
	font-size: 24px;
	color: #94a3b8;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: all 0.2s;
}

.bk-modal-close:hover { background: #f1f5f9; color: #475569; }

.bk-modal-body { padding: 24px; }
.bk-reset-field { margin-bottom: 20px; }
.bk-reset-field label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 8px; }

.bk-reset-field input[type="text"],
.bk-reset-field input[type="datetime-local"] {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #e2e8f0;
	border-radius: var(--pw-radius-sm);
	font-size: 14px;
	color: #1e293b;
	background: #f8fafc;
	transition: all 0.2s;
	box-sizing: border-box;
}

.bk-reset-field input[type="text"]:focus,
.bk-reset-field input[type="datetime-local"]:focus {
	outline: none;
	border-color: #4f46e5;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.bk-reset-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }

.bk-reset-radio-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid #e2e8f0;
	border-radius: var(--pw-radius-sm);
	cursor: pointer;
	font-size: 13px;
	color: #64748b;
	transition: all 0.2s;
}

.bk-reset-radio-item:hover { border-color: #c7d2fe; color: #4f46e5; }
.bk-reset-radio-item input[type="radio"] { margin: 0; accent-color: #4f46e5; }
.bk-reset-radio-item input[type="radio"]:checked ~ span { color: #4f46e5; font-weight: 500; }
.bk-reset-radio-item:has(input[type="radio"]:checked) {
	border-color: #4f46e5;
	background: #eef2ff;
	color: #4f46e5;
}

.bk-reset-tip {
	font-size: 12px;
	color: #94a3b8;
	line-height: 1.6;
	margin: 0;
	padding: 12px 16px;
	background: #f8fafc;
	border-radius: var(--pw-radius-sm);
	border-left: 3px solid #cbd5e1;
}

.bk-modal-footer {
	display: flex;
	gap: 10px;
	padding: 16px 24px;
	border-top: 1px solid #f1f5f9;
}

.bk-modal-btn-cancel {
	flex: 1;
	padding: 10px 20px;
	border: 1px solid #e2e8f0;
	background: #fff;
	border-radius: var(--pw-radius-sm);
	font-size: 14px;
	color: #64748b;
	cursor: pointer;
	transition: all 0.2s;
}

.bk-modal-btn-cancel:hover { background: #f8fafc; color: #475569; }

.bk-modal-btn-confirm {
	flex: 1;
	padding: 10px 20px;
	border: none;
	background: var(--pw-purple);
	border-radius: var(--pw-radius-sm);
	font-size: 14px;
	color: #fff;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow: var(--pw-purple-shadow);
}

.bk-modal-btn-confirm:hover {
	transform: translateY(-1px);
	box-shadow: var(--pw-purple-shadow-hover);
}

.bk-modal-btn-confirm:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.bk-modal-toast {
	position: absolute;
	bottom: 80px;
	left: 50%;
	transform: translateX(-50%);
	padding: 10px 20px;
	border-radius: var(--pw-radius-sm);
	font-size: 13px;
	color: #fff;
	z-index: 10000;
	white-space: nowrap;
	animation: bkToastFadeIn 0.2s ease;
}

.bk-modal-toast-success { background: var(--pw-green); }
.bk-modal-toast-error { background: var(--pw-red); }

@keyframes bkToastFadeIn {
	from { opacity: 0; transform: translateX(-50%) translateY(10px); }
	to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* -- 8. Password Protected Layout -- */
.password-protected-layout {
	grid-template-columns: 1fr !important;
	max-width: 800px;
	margin: 0 auto;
}

.password-protected-layout .single-main {
	width: 100%;
}

/* -- 9. Single Post: Author Expired Inline Indicator -- */
.bk-pw-expired-inline {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	margin-bottom: 20px;
	background: linear-gradient(135deg, #fff9db 0%, #fff3bf 100%);
	border: 1px solid #ffe066;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

.bk-pw-expired-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #92400e;
}

.bk-pw-expired-badge svg {
	color: #d97706;
}

.bk-pw-expired-reset {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 14px;
	background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	line-height: 1;
	box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.bk-pw-expired-reset:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
}

.bk-pw-expired-reset svg {
	flex-shrink: 0;
}

/* -- 10. Front-end entry points: list card button & single post inline -- */
.bk-post-pw-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-left: auto;
	padding: 5px 12px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #fff;
	font-size: 12px;
	font-weight: 500;
	color: #64748b;
	cursor: pointer;
	line-height: 1;
	transition: all 0.2s ease;
}

.bk-post-pw-btn:hover {
	border-color: #c7d2fe;
	color: #4f46e5;
	background: #f5f7ff;
}

.bk-post-pw-btn svg { flex-shrink: 0; }

.bk-pw-manage-inline {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 18px;
	margin-bottom: 20px;
	background: #f8fafc;
	border: 1px solid #e8edf4;
	border-radius: 12px;
}

.bk-pw-manage-inline.has-password {
	background: #f5f7ff;
	border-color: #dfe6ff;
}

.bk-pw-manage-status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #64748b;
}

.bk-pw-manage-status svg { color: #94a3b8; }

.bk-pw-manage-inline.has-password .bk-pw-manage-status { color: #4f46e5; }
.bk-pw-manage-inline.has-password .bk-pw-manage-status svg { color: #6366f1; }

.bk-pw-manage-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 14px;
	border: none;
	border-radius: 8px;
	background: var(--pw-purple);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	line-height: 1;
	box-shadow: var(--pw-purple-shadow);
	transition: all 0.2s ease;
}

.bk-pw-manage-btn:hover {
	transform: translateY(-1px);
	box-shadow: var(--pw-purple-shadow-hover);
}

.bk-reset-clear-btn {
	display: block;
	width: 100%;
	margin-top: 12px;
	padding: 10px;
	border: 1px dashed #e2e8f0;
	border-radius: var(--pw-radius-sm);
	background: #fff;
	font-size: 13px;
	color: #94a3b8;
	cursor: pointer;
	transition: all 0.2s ease;
}

.bk-reset-clear-btn:hover {
	border-color: #fecaca;
	color: #dc2626;
	background: #fef2f2;
}

