/**
 * Enhanced Comment Section Styles for e107 CMS
 * Rapi, elegan, dan modern dengan animasi smooth
 * Compatible with Bootstrap 3/4/5
 */

/* ========================================
   Comments Section Container
   ======================================== */

.comments-section-wrapper {
	margin: 40px 0;
	padding: 0;
}

.comments-container {
	max-width: 100%;
}

/* ========================================
   Comment Form - Enhanced & Elegant
   ======================================== */

.comment-form-container {
	margin-bottom: 40px;
}

.comment-form-wrapper {
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	transition: box-shadow 0.3s ease;
}

.comment-form-wrapper:hover {
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.comment-form-header {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	padding: 20px 25px;
	border-bottom: none;
}

.comment-form-title {
	margin: 0;
	color: #ffffff;
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0.5px;
}

.comment-form-body {
	padding: 30px 25px;
}

.comment-form-content {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

/* Comment Form Avatar */
.comment-form-avatar {
	flex-shrink: 0;
}

.comment-form-avatar .comment-avatar-wrapper {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid #f0f0f0;
	transition: border-color 0.3s ease;
}

.comment-form-wrapper:hover .comment-form-avatar .comment-avatar-wrapper {
	border-color: #667eea;
}

.comment-form-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Comment Form Fields */
.comment-form-fields {
	flex: 1;
	min-width: 0;
}

.comment-author-input {
	margin-bottom: 15px;
}

.comment-author-input input[type="text"],
.comment-author-input input[type="email"] {
	width: 100%;
	padding: 12px 16px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	font-size: 15px;
	transition: all 0.3s ease;
	background: #f8f9fa;
}

.comment-author-input input:focus {
	outline: none;
	border-color: #667eea;
	background: #ffffff;
	box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.comment-text-input {
	margin-bottom: 15px;
}

.comment-text-input textarea {
	width: 100%;
	min-height: 120px;
	padding: 15px 16px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	font-size: 15px;
	line-height: 1.6;
	resize: vertical;
	transition: all 0.3s ease;
	background: #f8f9fa;
	font-family: inherit;
}

.comment-text-input textarea:focus {
	outline: none;
	border-color: #667eea;
	background: #ffffff;
	box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Comment Form Actions */
.comment-form-actions {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
}

.comment-form-actions button,
.comment-form-actions input[type="submit"],
.comment-form-actions .btn {
	padding: 12px 28px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.comment-form-actions button:hover,
.comment-form-actions input[type="submit"]:hover {
	background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
	transform: translateY(-2px);
	box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.comment-form-actions button:active,
.comment-form-actions input[type="submit"]:active {
	transform: translateY(0);
}

/* ========================================
   Comments List Section
   ======================================== */

.comments-list-wrapper {
	margin-top: 30px;
}

.comments-list-header {
	padding: 20px 0 15px;
	border-bottom: 2px solid #667eea;
	margin-bottom: 25px;
}

.comments-count-title {
	margin: 0;
	font-size: 22px;
	font-weight: 600;
	color: #333;
	display: flex;
	align-items: center;
	gap: 10px;
}

.comments-count-title::before {
	content: '💬';
	font-size: 24px;
}

.comments-list {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ========================================
   Comment Item - Enhanced & Clean
   ======================================== */

.comment-item-wrapper {
	animation: commentSlideIn 0.4s ease;
}

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

.comment-item {
	background: #ffffff;
	border: 1px solid #e8e8e8;
	border-radius: 12px;
	padding: 20px;
	transition: all 0.3s ease;
	position: relative;
}

.comment-item:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
	border-color: #667eea;
}

/* Comment Item Header */
.comment-item-header {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
	align-items: center;
}

.comment-avatar-container {
	flex-shrink: 0;
}

.comment-avatar-wrapper {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	overflow: hidden;
	border: 2px solid #f0f0f0;
	transition: border-color 0.3s ease;
}

.comment-item:hover .comment-avatar-wrapper {
	border-color: #667eea;
}

.comment-avatar-wrapper img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Comment Meta Information */
.comment-meta {
	flex: 1;
	min-width: 0;
}

.comment-author-info {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.comment-username {
	font-weight: 600;
	font-size: 16px;
	color: #333;
}

.comment-status {
	display: inline-flex;
	padding: 2px 10px;
	background: #667eea;
	color: #ffffff;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.comment-metadata {
	display: flex;
	align-items: center;
	gap: 8px;
}

.comment-timestamp {
	font-size: 13px;
	color: #999;
	display: inline-flex;
	align-items: center;
}

.comment-timestamp::before {
	content: '🕐';
	margin-right: 4px;
	font-size: 14px;
}

/* Comment Body */
.comment-item-body {
	margin: 15px 0;
	padding-left: 65px; /* Align with avatar */
}

.comment-content {
	color: #555;
	font-size: 15px;
	line-height: 1.7;
	word-wrap: break-word;
}

.comment-content p {
	margin: 0 0 10px;
}

.comment-content p:last-child {
	margin-bottom: 0;
}

/* Comment Footer & Actions */
.comment-item-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 15px;
	padding-left: 65px; /* Align with avatar */
	border-top: 1px solid #f0f0f0;
	margin-top: 15px;
	flex-wrap: wrap;
	gap: 10px;
}

.comment-actions-left,
.comment-actions-right {
	display: flex;
	gap: 15px;
	align-items: center;
	flex-wrap: wrap;
}

.comment-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	background: #f8f9fa;
	border: 1px solid #e0e0e0;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
	color: #666;
	cursor: pointer;
	transition: all 0.3s ease;
	text-decoration: none;
}

.comment-action:hover {
	background: #667eea;
	color: #ffffff;
	border-color: #667eea;
	transform: translateY(-2px);
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.comment-action:active {
	transform: translateY(0);
}

/* Specific action colors */
.comment-edit:hover {
	background: #28a745;
	border-color: #28a745;
}

.comment-moderate:hover {
	background: #dc3545;
	border-color: #dc3545;
}

.comment-rate:hover {
	background: #ffc107;
	border-color: #ffc107;
	color: #333;
}

/* Icons for actions (if using icon fonts) */
.comment-reply::before {
	content: '↩';
	font-weight: bold;
}

.comment-edit::before {
	content: '✎';
}

.comment-moderate::before {
	content: '⚑';
}

.comment-rate::before {
	content: '👍';
}

/* ========================================
   Comment Moderation Section
   ======================================== */

.comments-moderation {
	margin-top: 30px;
	padding: 20px;
	background: #f8f9fa;
	border-radius: 8px;
	border: 1px solid #e0e0e0;
}

/* ========================================
   Nested Comments (Replies)
   ======================================== */

.comment-item-wrapper .comment-item-wrapper {
	margin-left: 40px;
	margin-top: 15px;
	padding-left: 20px;
	border-left: 3px solid #667eea;
}

/* ========================================
   Empty State
   ======================================== */

.comments-list:empty::after {
	content: 'No comments yet. Be the first to comment!';
	display: block;
	text-align: center;
	padding: 60px 20px;
	color: #999;
	font-size: 16px;
	font-style: italic;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
	.comment-form-content {
		flex-direction: column;
	}
	
	.comment-form-avatar {
		width: 100%;
		display: flex;
		justify-content: center;
		margin-bottom: 15px;
	}
	
	.comment-item-body,
	.comment-item-footer {
		padding-left: 0;
	}
	
	.comment-item-header {
		flex-direction: row;
		align-items: flex-start;
	}
	
	.comment-item-wrapper .comment-item-wrapper {
		margin-left: 20px;
		padding-left: 15px;
	}
	
	.comment-item-footer {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.comments-count-title {
		font-size: 20px;
	}
}

@media (max-width: 576px) {
	.comment-form-body {
		padding: 20px 15px;
	}
	
	.comment-form-header {
		padding: 15px 20px;
	}
	
	.comment-item {
		padding: 15px;
	}
	
	.comment-actions-left,
	.comment-actions-right {
		width: 100%;
		justify-content: flex-start;
	}
	
	.comment-action {
		font-size: 12px;
		padding: 5px 12px;
	}
	
	.comment-item-wrapper .comment-item-wrapper {
		margin-left: 10px;
		padding-left: 10px;
	}
}

/* ========================================
   Dark Mode Support
   ======================================== */

@media (prefers-color-scheme: dark) {
	.comments-section-wrapper {
		color: #e2e8f0;
	}
	
	.comment-form-wrapper,
	.comment-item {
		background: #2d3748;
		border-color: #4a5568;
	}
	
	.comment-form-body,
	.comment-item-body {
		background: transparent;
	}
	
	.comment-author-input input,
	.comment-text-input textarea {
		background: #1a202c;
		border-color: #4a5568;
		color: #e2e8f0;
	}
	
	.comment-author-input input:focus,
	.comment-text-input textarea:focus {
		background: #2d3748;
		border-color: #667eea;
	}
	
	.comment-username,
	.comments-count-title {
		color: #e2e8f0;
	}
	
	.comment-content {
		color: #cbd5e0;
	}
	
	.comment-action {
		background: #1a202c;
		border-color: #4a5568;
		color: #cbd5e0;
	}
	
	.comment-item-footer {
		border-top-color: #4a5568;
	}
	
	.comments-moderation {
		background: #1a202c;
		border-color: #4a5568;
	}
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
	.comment-form-container,
	.comment-item-footer,
	.comments-moderation {
		display: none;
	}
	
	.comment-item {
		border: 1px solid #ddd;
		page-break-inside: avoid;
		margin-bottom: 20px;
	}
	
	.comment-form-wrapper,
	.comment-item {
		box-shadow: none;
	}
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

.comment-action:focus,
.comment-form-actions button:focus {
	outline: 3px solid #667eea;
	outline-offset: 2px;
}

/* Skip to comments link for screen readers */
.skip-to-comments {
	position: absolute;
	left: -9999px;
}

.skip-to-comments:focus {
	position: static;
	left: auto;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
	.comment-item,
	.comment-form-wrapper {
		border: 2px solid currentColor;
	}
	
	.comment-action {
		border: 2px solid currentColor;
	}
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.comment-item-wrapper,
	.comment-action,
	.comment-form-actions button,
	* {
		animation: none !important;
		transition: none !important;
	}
}

/* ========================================
   Loading States
   ======================================== */

.comment-loading {
	opacity: 0.6;
	pointer-events: none;
	position: relative;
}

.comment-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border: 3px solid #f3f3f3;
	border-top: 3px solid #667eea;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* ========================================
   Verified Badge (if applicable)
   ======================================== */

.comment-verified::after {
	content: '✓';
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	background: #28a745;
	color: white;
	border-radius: 50%;
	font-size: 11px;
	font-weight: bold;
	margin-left: 5px;
}
