.yt-comments {
	--yt-comment-bg: transparent;
	--yt-comment-text: #f1f1f1;
	--yt-comment-muted: #aaa;
	--yt-comment-border: #3f3f3f;
	--yt-comment-input-bg: #121212;
	--yt-comment-accent: var(--lm-accent, #0f0ef5);
	color: var(--yt-comment-text);
}

body.light-mode .yt-comments {
	--yt-comment-text: #0f0f0f;
	--yt-comment-muted: #606060;
	--yt-comment-border: #e5e5e5;
	--yt-comment-input-bg: #f1f1f1;
	--yt-comment-accent: var(--lm-accent, #0f0ef5);
}

.yt-comments__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.yt-comments__count {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--yt-comment-text);
}

.yt-comments__sort {
	position: relative;
}

.yt-comments__sort-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 18px;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	border-radius: 12px;
	background: #393d40 !important;
	color: #ffffff !important;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

body.light-mode .yt-comments__sort-toggle {
	background: #a1acb2 !important;
	color: #0f172a !important;
}

.yt-comments__sort-toggle:hover,
.yt-comments__sort-toggle:focus {
	transform: translateY(-1px);
}

.yt-comments__sort-menu {
	position: absolute;
	top: calc(100% + 6px);
	inset-inline-end: 0;
	min-width: 160px;
	padding: 8px 0;
	border-radius: 12px;
	background: #282828;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	z-index: 20;
}

body.light-mode .yt-comments__sort-menu {
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.yt-comments__sort-option {
	display: block;
	padding: 10px 16px;
	color: var(--yt-comment-text);
	text-decoration: none;
	font-size: 14px;
}

.yt-comment-insert,
.yt-comments__login-prompt {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 32px;
}

.yt-comment-insert__avatar,
.yt-comment__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 50%;
	overflow: hidden;
}

.yt-comment-insert__avatar img,
.yt-comment-insert__avatar .avatar,
.yt-comment__avatar img,
.yt-comment__avatar .avatar,
.yt-comments__login-prompt .yt-comment-insert__avatar img {
	display: block;
	width: 40px !important;
	height: 40px !important;
	border-radius: 50% !important;
	object-fit: cover;
}

.yt-comment-insert__avatar--guest {
	color: var(--yt-comment-muted);
	overflow: visible;
}

.yt-comment-guest-icon {
	display: block;
	width: 40px;
	height: 40px;
}

.yt-comment-insert__panel {
	flex: 1;
	min-width: 0;
}

.yt-comments__login-link {
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 0 16px;
	border-bottom: 1px solid var(--yt-comment-border);
	color: var(--yt-comment-muted) !important;
	text-decoration: none !important;
	font-size: 14px;
	flex: 1;
}

.yt-comments__login-link:hover,
.yt-comments__login-link:focus {
	color: var(--yt-comment-text) !important;
	text-decoration: none !important;
}

.yt-comment-form__form {
	margin: 0;
}

.yt-comment-form__form .comment-form-comment {
	margin: 0;
}

.yt-comment-form__form label,
.yt-comment-form__form .logged-in-as,
.yt-comment-form__form .comment-notes,
.yt-comment-form__form .comment-form-author,
.yt-comment-form__form .comment-form-email,
.yt-comment-form__form .comment-form-url,
.yt-comment-form__form .comment-form-cookies-consent {
	display: none !important;
}

.yt-comment-form__textarea {
	width: 100%;
	min-height: 40px;
	padding: 8px 0;
	border: none;
	border-bottom: 1px solid var(--yt-comment-border);
	border-radius: 0;
	background: transparent;
	color: var(--yt-comment-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	resize: none;
	outline: none;
	box-shadow: none;
}

.yt-comment-insert.is-expanded .yt-comment-form__textarea {
	min-height: 80px;
	padding-top: 4px;
}

.yt-comment-form__textarea::placeholder {
	color: var(--yt-comment-muted);
}

.yt-comment-form__textarea:focus {
	border-bottom-color: var(--yt-comment-accent);
}

.yt-comment-insert:not(.is-expanded) .yt-comment-form__actions {
	display: none;
}

.yt-comment-form__actions {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 8px;
	margin-top: 12px;
}

.yt-comment-form__error {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.4;
	color: #c62828;
}

.yt-comment-form__cancel,
.yt-comment-form__submit,
.yt-comments #submit,
.yt-comments .form-submit .submit {
	min-height: 44px;
	padding: 0 22px;
	border-radius: 12px;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.yt-comment-form__cancel {
	background: transparent !important;
	color: var(--yt-comment-muted) !important;
}

.yt-comment-form__submit,
.yt-comments #submit,
.yt-comments .form-submit .submit {
	background: var(--lm-accent, #0f0ef5) !important;
	color: #ffffff !important;
}

.yt-comment-form__submit:hover,
.yt-comment-form__submit:focus,
.yt-comments #submit:hover,
.yt-comments #submit:focus,
.yt-comments .form-submit .submit:hover,
.yt-comments .form-submit .submit:focus {
	transform: translateY(-1px);
}

.yt-comments .comment-form-comment > label {
	display: none !important;
}

.yt-comment-list,
.yt-comment-list .children {
	list-style: none;
	margin: 0;
	padding: 0;
}

.yt-comment-list > .yt-comment,
.yt-comment-list .children > .yt-comment {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 20px;
}

.yt-comment-list > .yt-comment > .children,
.yt-comment-list .children > .yt-comment > .children {
	flex: 1 1 100%;
	width: 100%;
}

.yt-comment__body {
	flex: 1;
	min-width: 0;
}

.yt-comment__header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 4px;
}

.yt-comment__author {
	font-size: 13px;
	font-weight: 600;
	color: var(--yt-comment-text);
}

.yt-comment__date {
	font-size: 12px;
	color: var(--yt-comment-muted);
}

.yt-comment__text {
	font-size: 14px;
	line-height: 1.6;
	color: var(--yt-comment-text);
	word-break: break-word;
}

.yt-comment__text p {
	margin: 0 0 8px;
}

.yt-comment__footer {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 8px;
	margin-top: 4px;
}

.yt-comments .comment-votes {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin: 0;
}

.yt-comments .vote-btn {
	min-height: 32px;
	padding: 6px 10px;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	border-radius: 12px;
	background: transparent !important;
	color: var(--yt-comment-muted) !important;
}

.yt-comments .vote-btn.active,
.yt-comments .vote-btn.like-btn.active {
	background: rgba(15, 14, 245, 0.16) !important;
	color: var(--lm-accent, #0f0ef5) !important;
}

.yt-comments .vote-btn.dislike-btn.active {
	background: rgba(15, 14, 245, 0.12) !important;
	color: var(--lm-accent, #0f0ef5) !important;
}

.yt-comments .vote-btn.active .vote-icon,
.yt-comments .like-btn.active .vote-icon {
	stroke: var(--lm-accent, #0f0ef5) !important;
	fill: var(--lm-accent, #0f0ef5) !important;
}

.yt-comments .dislike-btn.active .vote-icon {
	stroke: var(--lm-accent, #0f0ef5) !important;
	fill: transparent !important;
}

.yt-comments .vote-count {
	font-size: 12px;
	min-width: auto;
}

.yt-comment__reply,
.yt-comments .comment-reply-link {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 6px 12px;
	border-radius: 999px;
	color: var(--yt-comment-muted);
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

/* Keep WP cancel link in DOM for comment-reply.js; UI uses .yt-comment-form__cancel */
.yt-comments #cancel-comment-reply-link {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.yt-comments .comment-respond {
	margin-top: 16px;
}

/* Reply form moved under a comment (outside #yt-comment-insert) */
.yt-comments .yt-comment-list > .comment-respond {
	margin: 8px 0 16px;
	padding-inline-start: 56px;
}

.yt-comments .yt-comment-list > .comment-respond .yt-comment-form__actions {
	display: flex;
}

.yt-comments .yt-comment-list > .comment-respond .yt-comment-form__textarea {
	min-height: 80px;
}

.yt-comments .children {
	margin-top: 16px;
	margin-inline-start: 56px;
}

.yt-comments .comment-navigation,
.yt-comments .navigation {
	display: none;
}

.yt-comments__load-more {
	min-height: 1px;
}

.yt-comments__loader-sentinel {
	height: 1px;
	width: 100%;
}

.yt-comments__loading {
	margin: 12px 0 0;
	text-align: center;
	font-size: 13px;
	color: var(--yt-comment-muted, #858e99);
}

/* Override Elementor inline comment form styles */
.tv-analysis-below-fold .yt-comments .comment-form textarea,
.medium-below-fold .yt-comments .comment-form textarea,
.elementor-widget-post-comments .yt-comments textarea {
	background: transparent !important;
	border: none !important;
	border-bottom: 1px solid var(--yt-comment-border) !important;
	border-radius: 0 !important;
	color: var(--yt-comment-text) !important;
}

.tv-analysis-below-fold .yt-comments input[type="submit"],
.tv-analysis-below-fold .yt-comments .yt-comment-form__submit,
.medium-below-fold .yt-comments input[type="submit"],
.medium-below-fold .yt-comments .yt-comment-form__submit,
.elementor-widget-post-comments .yt-comments input[type="submit"],
.elementor-widget-post-comments .yt-comments .yt-comment-form__submit,
.yt-comment-form__form input[type="submit"],
.yt-comment-form__form button[type="submit"] {
	background: var(--lm-accent, #0f0ef5) !important;
	color: #ffffff !important;
	border: 0 !important;
	border-radius: 12px !important;
}

.tv-analysis-below-fold .yt-comments .yt-comment-form__cancel,
.medium-below-fold .yt-comments .yt-comment-form__cancel,
.elementor-widget-post-comments .yt-comments .yt-comment-form__cancel,
.yt-comment-form__form .yt-comment-form__cancel {
	background: transparent !important;
	color: var(--yt-comment-muted) !important;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	border-radius: 12px !important;
}

/* Override legacy Elementor global button rules (red borders / red backgrounds) */
.yt-comments button,
.yt-comments [type="button"],
.yt-comments [type="submit"],
.yt-comments .comment-reply-link {
	border-color: transparent !important;
}

.yt-comments button:focus,
.yt-comments button:hover,
.yt-comments [type="button"]:focus,
.yt-comments [type="button"]:hover,
.yt-comments [type="submit"]:focus,
.yt-comments [type="submit"]:hover {
	opacity: 1 !important;
}

.yt-comments .yt-comment__avatar img,
.yt-comments .yt-comment__avatar .avatar,
.yt-comments .yt-comment-insert__avatar img,
.yt-comments .yt-comment-insert__avatar .avatar {
	display: block !important;
	width: 40px !important;
	height: 40px !important;
	border-radius: 50% !important;
	object-fit: cover;
}

/* Duplicate comment modal */
.yt-comment-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.7);
	direction: rtl;
	font-family: inherit;
}

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

.yt-comment-modal__card {
	position: relative;
	width: 100%;
	max-width: 420px;
	padding: 28px 24px 24px;
	border-radius: 15px;
	background: #1f2124;
	text-align: center;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

body.light-mode .yt-comment-modal__card {
	background: #ffffff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.yt-comment-modal__close {
	position: absolute;
	top: 10px;
	inset-inline-end: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: #f1f1f1;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.2s ease;
}

.yt-comment-modal__close:hover,
.yt-comment-modal__close:focus {
	color: #f1f1f1;
	background-color: var(--lm-accent-hover);
	outline: none;
}

body.light-mode .yt-comment-modal__close:hover,
body.light-mode .yt-comment-modal__close:focus {
	color: #333;
}

.yt-comment-modal__title {
	margin: 0 0 12px;
	font-size: 20px;
	font-weight: 700;
	color: #f1f1f1 !important;
}

body.light-mode .yt-comment-modal__title {
	color: #f1f1f1 !important;
}

.yt-comment-modal__message {
	margin: 0 0 20px;
	font-size: 15px;
	line-height: 1.6;
	color: #a0a6ad;
	word-break: break-word;
}

body.light-mode .yt-comment-modal__message {
	color: #606060;
}

.yt-comment-modal__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 140px;
	min-height: 44px;
	padding: 0 24px;
	border: 0 !important;
	border-radius: 12px;
	background: var(--lm-accent) !important;
	color: #f1f1f1 !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.yt-comment-modal__action:hover,
.yt-comment-modal__action:focus {
	opacity: 0.9;
	outline: none;
	background: var(--lm-accent-hover);
}

@media (max-width: 480px) {
	.yt-comment-modal {
		padding: 12px;
	}

	.yt-comment-modal__card {
		padding: 24px 20px 20px;
	}

	.yt-comment-modal__title {
		font-size: 18px;
	}

	.yt-comment-modal__message {
		font-size: 14px;
	}

	.yt-comment-modal__action {
		width: 100%;
	}
}
