/**
 * User Comments - Twitter-style CSS
 * Clean, minimal threaded comments
 */

/* ========================================
   Comments Section Container
   ======================================== */
.user-comments-section {
	font-family: var(--fontFamily1, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	font-size: 0.9rem;
	font-weight : var(--fontWeightBold);
	letter-spacing: 0.05em;
	--contentTextMargin:  var(--smallPfpSize);
}

.comments-header {
	padding: 12px 0;
	border-bottom: 1px solid #eff3f4;
}

.comments-header h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}

.comment-count {
	font-weight: 400;
	color: #536471;
}

/* ========================================
   Login Prompt
   ======================================== */
.comments-login-prompt {
	padding: 16px;
	text-align: center;
	color: #536471;
	border-bottom: 1px solid #eff3f4;
}

.comments-login-prompt a {
	color: #1d9bf0;
	text-decoration: none;
	font-weight: 500;
}

.comments-login-prompt a:hover {
	text-decoration: underline;
}

/* ========================================
   Comment Form (Main)
   ======================================== */
.comments-form-container {
	padding: 12px 0;
	border-bottom: 1px solid #eff3f4;
}

.comment-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.comment-textarea {
	width: 100%;
	padding: 12px;
	font-size: 17px;
	font-family: inherit;
	line-height: 1.4;
	border: none;
	border-bottom: 1px solid #eff3f4;
	resize: none;
	outline: none;
	box-sizing: border-box;
}

.comment-textarea:focus {
	border-bottom-color: #1d9bf0;
}

.comment-textarea::placeholder {
	color: #536471;
}

.comment-form-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.btn-add-image {
	padding: 8px 12px;
	font-size: 14px;
	color: var(--textColor);
	background: none;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	transition: background 0.2s;
}

.btn-add-image:hover {
	background: rgba(29, 155, 240, 0.1);
}

.btn-submit-comment,
.btn-submit-reply {
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 700;
	color: var(--textMatting);
	background: var(--mattingColor);
	border: none;
	border-radius: 3px;
	cursor: pointer;
	transition: background 0.2s;
}

.btn-submit-comment:hover,
.btn-submit-reply:hover {
	background: var(--mattingColorOver);
	box-shadow: var(--frameShadowOver);
}

.btn-submit-comment:disabled,
.btn-submit-reply:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Image Preview */
.comment-images-preview,
.reply-images-preview {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.image-preview-item {
	position: relative;
	display: inline-block;
}

.image-preview-item img {
	max-width: 80px;
	max-height: 80px;
	border-radius: 8px;
	object-fit: cover;
}

.btn-remove-image {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 20px;
	height: 20px;
	padding: 0;
	font-size: 14px;
	line-height: 18px;
	color: #fff;
	background: #0f1419;
	border: none;
	border-radius: 50%;
	cursor: pointer;
}

/* ========================================
   Comments List
   ======================================== */
.comments-list-container,
.user-comments-list {
	margin: 0;
	padding: 0;
}

/* ========================================
   Individual Comment (Twitter-style)
   ======================================== */
.userComment {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 12px 0;
	border-bottom: 1px solid #eff3f4;
}

.userComment:last-child {
	border-bottom: none;
}

/* Thread line for nested comments */
.userComment.comment-depth-1,
.userComment.comment-depth-2,
.userComment.comment-depth-3 {
	margin-left: 44px;
	padding-left: 16px;
	border-left: 2px solid #cfd9de;
	border-bottom: none;
}

.userComment.comment-depth-1 {
	margin-left: calc( var(--contentTextMargin) + 0.3em );
}

.userComment.comment-depth-2 {
	margin-left: 60px;
}

.userComment.comment-depth-3 {
	margin-left: 76px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
	.userComment.comment-depth-1 { margin-left: 24px; }
	.userComment.comment-depth-2 { margin-left: 32px; }
	.userComment.comment-depth-3 { margin-left: 40px; }
}

/* ========================================
   Comment Header (Avatar + Meta)
   ======================================== */
.comment-header {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 4px;
}

.comment-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
}

.comment-avatar.default {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.comment-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 4px;
	min-width: 0;
}

.comment-author {
	font-weight: var(--fontWeightFat);
	font-size : 0.8rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.comment-author a {
	color: inherit;
	text-decoration: none;
}

.comment-author a:hover {
	text-decoration: underline;
}

.comment-date {
	font-size: 14px;
	color: #536471;
	line-height: var(--smallPfpSize);
	vertical-align: middle;
	font-weight: var(--fontWeightMedium);
}

.comment-date::before {
	content: "·";
	margin-right: 4px;
}

/* ========================================
   Comment Content
   ======================================== */
.comment-content {
	margin-left: var(--contentTextMargin);
	padding-left:0.4em;
	color: #0f1419;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* For nested comments, no extra margin */
.comment-depth-1 .comment-content,
.comment-depth-2 .comment-content,
.comment-depth-3 .comment-content {
	margin-left: var(--contentTextMargin);
}

/* ========================================
   Comment Images
   ======================================== */
.comment-images {
	display: flex;
	gap: 8px;
	margin-top: 12px;
	margin-left: var(--contentTextMargin);
}

.comment-img {
	max-width: 200px;
	max-height: 200px;
	border-radius: 16px;
	border: 1px solid #cfd9de;
	cursor: pointer;
	transition: opacity 0.2s;
}

.comment-img:hover {
	opacity: 0.9;
}

.comment-img.zoomable {
	cursor: zoom-in;
}

/* ========================================
   Comment Actions
   ======================================== */
.comment-actions {
	display: flex;
	gap: 24px;
	margin-top: 12px;
	margin-left: var(--contentTextMargin);
}

.comment-reply-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	font-size: 13px;
	color: #536471;
	text-decoration: none;
	border-radius: 9999px;
	transition: all 0.2s;
}

.comment-reply-btn:hover {
	color: #1d9bf0;
	background: rgba(29, 155, 240, 0.1);
}

/* ========================================
   Nested Replies
   ======================================== */
.comment-replies {
	margin-top: 0;
}

/* ========================================
   Reply Form (Inline)
   ======================================== */
.comment-reply-form {
	margin-top: 12px;
	margin-left: var(--contentTextMargin);
}

.reply-form-active {
	padding: 12px;
	background: #f7f9f9;
	border-radius: 16px;
}

.reply-textarea {
	width: 100%;
	padding: 8px 12px;
	font-size: 15px;
	font-family: inherit;
	background: #fff;
	border: 1px solid #cfd9de;
	border-radius: 12px;
	resize: none;
	outline: none;
	box-sizing: border-box;
}

.reply-textarea:focus {
	border-color: #1d9bf0;
}

.reply-form-active .comment-form-actions {
	margin-top: 8px;
}

.btn-cancel-reply {
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 700;
	color: #0f1419;
	background: none;
	border: 1px solid #cfd9de;
	border-radius: 9999px;
	cursor: pointer;
	margin-right: 8px;
}

.btn-cancel-reply:hover {
	background: #e7e7e8;
}

.btn-add-image-reply {
	padding: 6px 10px;
	font-size: 13px;
	color: #1d9bf0;
	background: none;
	border: none;
	cursor: pointer;
}

/* ========================================
   No Comments Message
   ======================================== */
.no-comments {
	padding: 32px 16px;
	text-align: center;
	color: #536471;
}

/* ========================================
   Loading State
   ======================================== */
.comment-loader {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid #eff3f4;
	border-top-color: #1d9bf0;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* ========================================
   New Comment Highlight
   ======================================== */
.comment-new {
	animation: highlight 2s ease-out;
}

@keyframes highlight {
	from { background: rgba(29, 155, 240, 0.1); }
	to { background: transparent; }
}
