/*
 * Babdori Community Dark Mode
 * 리스트 · 상세 · 댓글 · 신고/차단 · 글쓰기 모달
 */

@media (prefers-color-scheme: dark) {
	body:has(#kboard-default-list),
	body:has(#kboard-default-document),
	body:has(#kboard-default-editor),
	html.babdori-write-overlay-page,
	body.babdori-write-overlay-page {
		--bd-community-bg: #101013;
		--bd-community-surface: #17171c;
		--bd-community-surface-soft: #1d1d22;
		--bd-community-surface-muted: #27272a;
		--bd-community-border: rgba(255, 255, 255, 0.10);
		--bd-community-border-soft: rgba(255, 255, 255, 0.07);
		--bd-community-text: #f4f4f5;
		--bd-community-text-soft: #d4d4d8;
		--bd-community-text-muted: #a1a1aa;
		--bd-community-blue: #93c5fd;
		--bd-community-red: #fb7185;

		background: var(--bd-community-bg) !important;
		color: var(--bd-community-text) !important;
		color-scheme: dark;
	}

	body:has(#kboard-default-list) .content-area,
	body:has(#kboard-default-list) .page-content,
	body:has(#kboard-default-document) .content-area,
	body:has(#kboard-default-document) .page-content,
	body:has(#kboard-default-editor) .content-area,
	body:has(#kboard-default-editor) .page-content,
	body.babdori-write-overlay-page {
		background: var(--bd-community-bg) !important;
		color: var(--bd-community-text) !important;
	}

	/* 리스트 */
	.babdori-community-title,
	.babdori-community-notice summary,
	.babdori-feed-author strong,
	.babdori-feed-title,
	.babdori-feed-excerpt {
		color: var(--bd-community-text) !important;
	}

	.babdori-community-notice,
	.babdori-community-compose,
	.babdori-board-list,
	.babdori-feed-card {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-surface) !important;
		box-shadow: none !important;
	}

	.babdori-feed-card {
		border-bottom-color: var(--bd-community-border-soft) !important;
	}

	.babdori-community-notice-content p,
	.babdori-compose-placeholder,
	.babdori-feed-author span,
	.babdori-feed-action,
	.babdori-feed-comment-toggle,
	.babdori-feed-more-button {
		color: var(--bd-community-text-muted) !important;
	}

	.babdori-notice-icon,
	.babdori-feed-avatar,
	.babdori-feed-comment-avatar {
		background: rgba(96, 165, 250, 0.15) !important;
		color: var(--bd-community-blue) !important;
	}

	.babdori-feed-thumb,
	.babdori-document-image {
		background: var(--bd-community-surface-soft) !important;
	}

	.babdori-feed-more-menu,
	.babdori-document-action-menu,
	.babdori-comment-menu-panel {
		border-color: var(--bd-community-border) !important;
		background: #f8fafc !important;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42) !important;
	}

	/* 상세 */
	.babdori-community-document,
	.babdori-document-action,
	.babdori-comments-wrap,
	.babdori-comments-form {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-surface) !important;
		color: var(--bd-community-text) !important;
		box-shadow: none !important;
	}

	.babdori-document-page-head a,
	.babdori-document-title,
	.babdori-document-author-name,
	.babdori-document-content .content-view,
	.babdori-comment-name,
	.babdori-comment-content {
		color: var(--bd-community-text) !important;
	}

	.babdori-document-sub-meta,
	.babdori-document-sub-meta span,
	.babdori-document-sub-meta a,
	.babdori-comment-date,
	.babdori-comment-actions .comments-button-action {
		color: var(--bd-community-text-muted) !important;
	}

	.babdori-document-divider,
	.babdori-comment-item,
	.babdori-feed-comment-panel,
	.babdori-comment-reply-list {
		border-color: var(--bd-community-border-soft) !important;
	}

	.babdori-document-avatar,
	.babdori-comment-avatar {
		background: #e2e8f0 !important;
		color: #334155 !important;
	}

	/* 댓글 입력 */
	.babdori-feed-comment-field,
	.babdori-comment-textarea,
	.babdori-comments-area textarea,
	.babdori-comments-area textarea.comment-textarea {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-surface-soft) !important;
		color: var(--bd-community-text) !important;
		box-shadow: none !important;
	}

	.babdori-feed-comment-field textarea::placeholder,
	.babdori-comment-textarea::placeholder,
	.babdori-comments-area textarea::placeholder,
	.babdori-feed-comment-input {
		color: var(--bd-community-text-muted) !important;
	}

	/* 신고/차단 */
	.babdori-community-action-backdrop,
	.babdori-report-backdrop,
	.babdori-block-backdrop,
	.babdori-write-modal-backdrop {
		background: transparent !important;
		backdrop-filter: none !important;
		-webkit-backdrop-filter: none !important;
	}

	.babdori-community-action-panel,
	.babdori-report-panel,
	.babdori-block-panel {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-surface) !important;
		color: var(--bd-community-text) !important;
	}

	.babdori-community-action-title,
	.babdori-report-title,
	.babdori-block-title {
		color: var(--bd-community-text) !important;
	}

	.babdori-community-action-desc,
	.babdori-block-panel p {
		color: var(--bd-community-text-muted) !important;
	}

	.babdori-report-reasons label,
	.babdori-community-action-button,
	.babdori-community-action-close,
	.babdori-report-cancel,
	.babdori-block-cancel {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-surface-soft) !important;
		color: var(--bd-community-text-soft) !important;
	}

	.babdori-community-action-button.is-report {
		background: rgba(225, 29, 72, 0.14) !important;
		color: #fb7185 !important;
	}

	.babdori-community-action-button.is-block {
		background: rgba(249, 115, 22, 0.14) !important;
		color: #fdba74 !important;
	}

	/* 글쓰기 모달 */
	.babdori-write-modal-panel,
	.babdori-write-modal-frame {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-bg) !important;
	}

	.babdori-write-modal-close {
		background: var(--bd-community-surface-muted) !important;
		color: var(--bd-community-text-soft) !important;
	}

	html.babdori-write-overlay-page,
	body.babdori-write-overlay-page,
	.babdori-community-editor.is-write-overlay,
	.babdori-community-editor .kboard-form,
	.babdori-community-editor .kboard-attr-row {
		background: var(--bd-community-bg) !important;
		color: var(--bd-community-text) !important;
	}

	.babdori-community-editor .attr-name {
		color: var(--bd-community-text) !important;
	}

	.babdori-community-editor input[type="text"],
	.babdori-community-editor input[type="password"],
	.babdori-community-editor select,
	.babdori-community-editor textarea {
		border-color: var(--bd-community-border) !important;
		background: var(--bd-community-surface) !important;
		color: var(--bd-community-text) !important;
		box-shadow: none !important;
	}

	.babdori-community-editor input::placeholder,
	.babdori-community-editor textarea::placeholder {
		color: var(--bd-community-text-muted) !important;
	}

	.babdori-community-editor .babdori-direct-image-button {
		color: var(--bd-community-text-soft) !important;
	}

	.babdori-community-editor .babdori-direct-image-button.is-selected {
		background: rgba(37, 99, 235, 0.18) !important;
		color: var(--bd-community-blue) !important;
	}

	.babdori-community-editor .babdori-direct-image-preview {
		background: var(--bd-community-surface-soft) !important;
	}

	.babdori-community-editor .babdori-editor-submit-button {
		background: var(--bd-community-surface-muted) !important;
		color: #fff !important;
	}

	/* 하단 네비 */
	body:has(#kboard-default-list) .babdori-bottom-nav,
	body:has(#kboard-default-document) .babdori-bottom-nav,
	body:has(#kboard-default-editor) .babdori-bottom-nav {
		border-color: var(--bd-community-border) !important;
		background: rgba(18, 18, 21, 0.95) !important;
	}

	body:has(#kboard-default-list) .babdori-bottom-nav-item,
	body:has(#kboard-default-document) .babdori-bottom-nav-item,
	body:has(#kboard-default-editor) .babdori-bottom-nav-item {
		color: var(--bd-community-text-muted) !important;
	}

	body:has(#kboard-default-list) .babdori-bottom-nav-item:hover,
	body:has(#kboard-default-document) .babdori-bottom-nav-item:hover,
	body:has(#kboard-default-editor) .babdori-bottom-nav-item:hover {
		background-color: #252527 !important;
		color: #fff !important;
}
}

/* =========================
   Community Dark Final Fix
========================= */

@media (prefers-color-scheme: dark) {

	/* =========================
	   상세 상단 목록 버튼
	   ========================= */

	.babdori-document-list-link {
		border-color: rgba(255, 255, 255, 0.12) !important;
		background: #232329 !important;
		color: #d4d4d8 !important;
		box-shadow: none !important;
	}

	.babdori-document-list-link:hover,
	.babdori-document-list-link:active {
		border-color: rgba(255, 255, 255, 0.2) !important;
		background: #2f2f36 !important;
		color: #ffffff !important;
	}

	/* =========================
	   상세 상단 수정·삭제 메뉴
	   ========================= */

	.babdori-document-menu-button {
		background: #232329 !important;
		color: #d4d4d8 !important;
	}

	.babdori-document-menu-button:hover,
	.babdori-document-menu-button:active {
		background: #2f2f36 !important;
		color: #ffffff !important;
	}

	.babdori-document-menu-panel {
		border-color: rgba(255, 255, 255, 0.1) !important;
		background: #232329 !important;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
	}

	.babdori-document-menu-panel a {
		background: transparent !important;
		color: #e4e4e7 !important;
	}

	.babdori-document-menu-panel a:hover,
	.babdori-document-menu-panel a:active {
		background: rgba(255, 255, 255, 0.08) !important;
		color: #ffffff !important;
	}

	/* =========================
	   상세 하단 더보기 메뉴
	   ========================= */

	.babdori-document-action-menu {
		border-color: rgba(255, 255, 255, 0.1) !important;
		background: #232329 !important;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
	}

	.babdori-document-action-menu button {
		background: transparent !important;
		color: #e4e4e7 !important;
	}

	.babdori-document-action-menu button:hover,
	.babdori-document-action-menu button:active {
		background: rgba(255, 255, 255, 0.08) !important;
		color: #ffffff !important;
	}

	.babdori-document-action-menu
	.babdori-document-report-button,
	.babdori-document-action-menu
	.babdori-document-block-button {
		color: #fb7185 !important;
	}

	/* =========================
	   리스트 카드 더보기 메뉴
	   ========================= */

	.babdori-feed-more-button {
		background: transparent !important;
		color: #a1a1aa !important;
	}

	.babdori-feed-more-button:hover,
	.babdori-feed-more-button:active,
	.babdori-feed-more-button.is-open {
		background: #27272a !important;
		color: #ffffff !important;
	}

	.babdori-feed-more-menu {
		border-color: rgba(255, 255, 255, 0.1) !important;
		background: #232329 !important;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
	}

	.babdori-feed-more-menu button,
	.babdori-feed-more-menu .babdori-feed-more-item {
		background: transparent !important;
		color: #e4e4e7 !important;
	}

	.babdori-feed-more-menu button:hover,
	.babdori-feed-more-menu button:active,
	.babdori-feed-more-menu
	.babdori-feed-more-item:hover {
		background: rgba(255, 255, 255, 0.08) !important;
		color: #ffffff !important;
	}

	.babdori-feed-more-menu
	.babdori-feed-direct-report,
	.babdori-feed-more-menu
	.babdori-feed-direct-block {
		color: #fb7185 !important;
	}

	/* =========================
	   댓글·답글 본문
	   ========================= */

	.babdori-feed-comment-item-head strong,
	.babdori-feed-comment-item-body p,
	.babdori-comment-name,
	.babdori-comment-content {
		color: var(--bd-community-text) !important;
	}

	.babdori-feed-comment-item-head span,
	.babdori-comment-date,
	.babdori-feed-comment-item-actions,
	.babdori-comment-actions {
		color: var(--bd-community-text-muted) !important;
	}

	.babdori-feed-comment-item-avatar,
	.babdori-comment-avatar,
	.babdori-document-comment-avatar {
		background: #e2e8f0 !important;
		color: #334155 !important;
	}

	.babdori-card-comment-like,
	.babdori-card-comment-reply-toggle,
	.babdori-comment-reply {
		color: var(--bd-community-text-muted) !important;
	}

	.babdori-card-comment-like.is-liked {
		color: var(--bd-community-red) !important;
	}


	/* =========================
	   댓글·답글 더보기 버튼
	   ========================= */

	.babdori-comment-more-button {
		border: 0 !important;
		background: transparent !important;
		color: var(--bd-community-text-muted) !important;
		box-shadow: none !important;
	}

	.babdori-comment-more-button:hover,
	.babdori-comment-more-button:active,
	.babdori-comment-more-button.is-open {
		background: var(--bd-community-surface-muted) !important;
		color: #ffffff !important;
	}


	/* =========================
	   댓글·답글 더보기 메뉴
	   ========================= */

	.babdori-comment-more-menu {
		border-color: var(--bd-community-border) !important;
		background: #232329 !important;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
	}

	.babdori-comment-more-item {
		border: 0 !important;
		background: transparent !important;
		color: #e4e4e7 !important;
		box-shadow: none !important;
	}

	.babdori-comment-more-item:hover,
	.babdori-comment-more-item:active {
		background: rgba(255, 255, 255, 0.08) !important;
		color: #ffffff !important;
	}

	.babdori-comment-more-item.babdori-card-comment-delete,
	.babdori-comment-more-item.babdori-comment-delete,
	.babdori-comment-more-item.babdori-comment-report,
	.babdori-comment-more-item.babdori-comment-block {
		color: #fb7185 !important;
	}

	.babdori-comment-more-item.babdori-card-comment-delete:hover,
	.babdori-comment-more-item.babdori-comment-delete:hover,
	.babdori-comment-more-item.babdori-comment-report:hover,
	.babdori-comment-more-item.babdori-comment-block:hover {
		background: rgba(244, 63, 94, 0.12) !important;
		color: #fda4af !important;
	}

	.babdori-comment-more-item svg {
		fill: none !important;
		stroke: currentColor !important;
	}

	/* =========================
	   댓글 입력창 한 줄 정렬
	   ========================= */

	.babdori-comment-input-wrap {
		display: flex !important;
		flex-direction: row !important;
		align-items: center !important;
		gap: 8px !important;
		width: 100% !important;
	}

	.babdori-comment-input-wrap
	.babdori-comment-textarea {
		flex: 1 1 auto !important;
		width: auto !important;
		min-width: 0 !important;
		height: 42px !important;
		min-height: 42px !important;
	}

	.babdori-comment-submit {
		display: block !important;
		flex: 0 0 auto !important;
		width: auto !important;
		margin: 0 !important;
	}

	.babdori-comment-submit input[type="submit"],
	.babdori-comments-area
	input[type="submit"],
	.babdori-comments-area
	button[type="submit"] {
		width: auto !important;
		min-width: 58px !important;
		height: 38px !important;
		margin: 0 !important;
		padding: 0 13px !important;
		border-radius: 10px !important;
		background: #2563eb !important;
		color: #ffffff !important;
	}

	/* 댓글 작성 영역 외곽 */
	.babdori-comments-form {
		background: transparent !important;
	}

	.babdori-comment-input-wrap {
		padding: 0 !important;
		border: 0 !important;
		background: transparent !important;
	}

	/* =========================
	   글쓰기 사진 선택 버튼
	   ========================= */

	.babdori-community-editor
	.babdori-direct-image-button {
		border: 1px solid rgba(255, 255, 255, 0.1) !important;
		background: #232329 !important;
		color: #d4d4d8 !important;
		box-shadow: none !important;
	}

	.babdori-community-editor
	.babdori-direct-image-button:hover,
	.babdori-community-editor,
	.babdori-direct-image-button:active,
	.babdori-document-more-button:hover {
		border-color: rgba(255, 255, 255, 0.2) !important;
		background: #2f2f36 !important;
		color: #ffffff !important;
	}

	.babdori-community-editor
	.babdori-direct-image-button.is-selected {
		border-color: rgba(96, 165, 250, 0.32) !important;
		background: rgba(37, 99, 235, 0.18) !important;
		color: #93c5fd !important;
	}

	.babdori-community-editor
	.babdori-direct-image-button svg {
		fill: none !important;
		stroke: currentColor !important;
	}

	/* =========================
	   글쓰기 제출 버튼
	   ========================= */

	.babdori-community-editor
	.babdori-editor-submit-button {
		border: 1px solid rgba(255, 255, 255, 0.12) !important;
		background: #27272a !important;
		color: #ffffff !important;
		box-shadow: none !important;
	}

	.babdori-community-editor
	.babdori-editor-submit-button:hover,
	.babdori-community-editor
	.babdori-editor-submit-button:active {
		background: #3f3f46 !important;
	}

/* 상세 구분선 */
.babdori-document-divider {
	background: rgba(255, 255, 255, 0.08) !important;
}

/* 나머지 border 구분선 */
.babdori-document-action,
.babdori-comment-item,
.babdori-comment-reply-list {
	border-color: #3D3D47 !important;
}
}

@media (prefers-color-scheme: dark) {
	body:has(#kboard-default-list)
	#kboard-default-list
	.babdori-community-compose {
		background: var(--bd-community-surface) !important;
		box-shadow:
			0 4px 14px rgba(0, 0, 0, 0.2),
			0 0 0 8px var(--bd-community-bg) !important;
	}
}