/* Enhanced Comment System with File Upload, and Anti-brush Like */

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.comment-form-section,
.comments-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Initial Loading Styles */
.initial-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.loading-spinner {
  margin-bottom: 15px;
}

.initial-loading p {
  color: #65676b;
  font-size: 14px;
}

/* Comment Form Styles */
.comment-form-title {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
}

.comment-form {
  margin-top: 8px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

/* Member form - simplified layout */
.comment-form.member-form .form-row {
  display: none; /* Hide name/email fields for members */
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.required {
  color: #e74c3c;
}

.form-group input,
.form-group textarea {
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
}

/* Fixed Checkbox Group Alignment */
.checkbox-group {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 4px;
}

.checkbox-group input[type="checkbox"] {
  align-self: center;
}

.checkbox-group label {
  margin-bottom: 0;
  line-height: 1.4;
  cursor: pointer;
  flex: 1;
  font-weight: 600;
}

/* File Upload Styles */
.file-input {
  padding: 8px;
  border: 2px dashed #e1e5e9;
  border-radius: 4px;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;
  display: inline-flex;
}

.file-input .icon {
  margin-right: 0.5rem;
}

.file-input:hover {
  border-color: #3498db;
  background: #e3f2fd;
}

.file-upload-info small {
  color: #65676b;
  font-size: 12px;
}

.file-preview {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-item {
  position: relative;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 10px;
  background: #f8f9fa;
  max-width: 200px;
}

.file-preview-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-thumbnail {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.file-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #e1e5e9;
  border-radius: 4px;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  display: block;
  font-size: 11px;
  color: #65676b;
}

.remove-file-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #e74c3c;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-file-btn:hover {
  background: #c0392b;
}

/* Attachments Display */
.attachments-container {
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-item {
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  background: #f8f9fa;
  width: 6rem;
  height: 6rem;
}

.image-attachment .attachment-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.image-attachment .attachment-image:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.file-attachment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.attachment-info {
  min-width: 0;
}

.attachment-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-name:hover {
  color: #3498db;
}

.attachment-size {
  display: block;
  font-size: 11px;
  color: #65676b;
}

/* File Attachment Styles với Download Hover */
.file-attachment {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.file-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  /* width: 100%;
  height: 100%; */
  transition: all 0.3s ease;
}

.file-attachment:hover .file-content {
  opacity: 0.7;
  transform: scale(0.95);
}

.file-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #e1e5e9;
  border-radius: 4px;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.file-size {
  font-size: 10px;
  color: #65676b;
  line-height: 1;
}

/* Download Overlay */
.file-download-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(52, 152, 219, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

.file-attachment:hover .file-download-overlay {
  opacity: 1;
  visibility: visible;
}

.file-download-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #3498db;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.file-download-btn:hover {
  background: white;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.file-download-btn:active {
  transform: scale(0.95);
}

/* Popup Styles */
/* ==================== ENHANCED IMAGE POPUP STYLES ==================== */
.image-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.popup-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

.popup-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  color: white;
}

.popup-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
}

.popup-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.image-counter {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.popup-close-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.popup-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 80px 20px;
}

.popup-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 5;
}

.popup-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.popup-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.popup-prev-btn {
  left: 30px;
}

.popup-next-btn {
  right: 30px;
}

.popup-image-container {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  cursor: zoom-in;
}

.popup-image.zoomed {
  cursor: zoom-out;
  transform: scale(1.5);
  max-width: none;
  max-height: none;
}

.popup-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 12px;
  padding: 30px;
  backdrop-filter: blur(10px);
}

.popup-loading .loading-spinner {
  width: 40px;
  height: 40px;
  margin-bottom: 15px;
}

.popup-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
  flex-wrap: wrap;
  gap: 20px;
}

.popup-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.info-label {
  font-weight: 600;
  opacity: 0.8;
  min-width: 70px;
}

.info-value {
  font-weight: 400;
  word-break: break-all;
}

.popup-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.popup-download-btn,
.popup-zoom-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.popup-download-btn:hover,
.popup-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .popup-header,
  .popup-footer {
    padding: 15px 20px;
  }

  .popup-content {
    padding: 60px 15px;
  }

  .popup-nav-btn {
    width: 40px;
    height: 40px;
  }

  .popup-prev-btn {
    left: 15px;
  }

  .popup-next-btn {
    right: 15px;
  }

  .popup-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .popup-info {
    min-width: auto;
  }

  .popup-actions {
    justify-content: center;
  }

  .popup-download-btn,
  .popup-zoom-btn {
    flex: 1;
    justify-content: center;
  }

  .image-counter {
    font-size: 12px;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .popup-image.zoomed {
    transform: scale(1.2);
  }

  .popup-header {
    padding: 10px 15px;
  }

  .popup-footer {
    padding: 15px;
  }

  .popup-close-btn {
    width: 36px;
    height: 36px;
  }
}

/* Zoom Controls Styles */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.zoom-out-btn,
.zoom-in-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.zoom-out-btn:hover:not(:disabled),
.zoom-in-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.zoom-out-btn:disabled,
.zoom-in-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.zoom-level {
  min-width: 45px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
}

/* Image zoom transition */
.popup-image {
  transition: transform 0.3s ease;
  transform-origin: center center;
}

.popup-image[style*="scale"] {
  cursor: grab;
}

.popup-image[style*="scale"]:active {
  cursor: grabbing;
}

/* Mobile responsive cho zoom controls */
@media (max-width: 768px) {
  .zoom-controls {
    gap: 6px;
    padding: 6px 10px;
  }

  .zoom-out-btn,
  .zoom-in-btn {
    width: 28px;
    height: 28px;
  }

  .zoom-level {
    min-width: 40px;
    font-size: 12px;
  }
}


/* popup end */

.submit-btn {
  width: 100%;
  padding: 15px;
  background: #f1c40f;
  color: #333;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color:  #fff;
  margin-top: 12px;
}

.submit-btn:hover {
  background: #f39c12;
}

.submit-btn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

/* Pending Message */
.pending-message {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  text-align: center;
}

.pending-content h3 {
  color: #155724;
  margin-bottom: 10px;
}

.pending-content p {
  color: #155724;
  margin: 0;
}

/* Form Hide Animation */
.comment-form-section.hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

/* Comments Section */
.comments-header {
  margin-bottom: 16px;
}

.comments-count {
  border-bottom: 2px solid #e1e5e9;
  padding-bottom: 10px;
}

/* Comment Item Styles */
.comment-item,
.reply-item {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 8px;
  transition: box-shadow 0.2s ease;
  position: relative;
}

/* NEW: Nesting level visual indicators */
.comment-item[data-nesting-level="0"] {
  border-left: 4px solid #3498db;
}

.reply-item[data-nesting-level="1"] {
  border-left: 3px solid #e67e22;
  margin-left: 20px;
}

.reply-item[data-nesting-level="2"] {
  border-left: 2px solid #9b59b6;
  margin-left: 20px;
}

.reply-item[data-nesting-level="3"] {
  border-left: 1px solid #95a5a6;
  margin-left: 20px;
}

.comment-item:hover,
.reply-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.user-info {
  display: flex;
  align-items: center;
}

.username {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 16px;
}

.timestamp {
  font-size: 12px;
  color: #65676b;
}

.comment-content p {
  color: #1a1a1a;
  line-height: 1.6;
  margin-bottom: 15px;
  white-space: pre-line;
}

/* Comment Actions */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Reply buttons disabled state */
.comment-actions.disabled .reply-btn {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Like Button Styles */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 20px;
  background-color: #f0f2f5;
  color: #65676b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 6px 12px;
}

.like-btn:hover {
  background-color: #e4e6ea;
  transform: scale(1.05);
}

.like-btn.small {
  padding: 4px 8px;
  font-size: 11px;
  gap: 4px;
}

.like-btn .icon {
  width: 14px;
  height: 14px;
  transition: all 0.3s ease;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.like-btn.heart.liked {
  background-color: #ffeaa7;
  color: #e17055;
}

.like-btn.heart.liked .icon {
  fill: #e17055;
  stroke: #e17055;
}

.like-btn.thumbs.liked {
  background-color: #e3f2fd;
  color: #1976d2;
}

.like-btn.thumbs.liked .icon {
  fill: #1976d2;
  stroke: #1976d2;
}

/* NEW: Reply Count Button Styles */
.reply-count-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 20px;
  background-color: #f0f2f5;
  color: #65676b;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  padding: 6px 12px;
}

.reply-count-btn:hover {
  background-color: #e4e6ea;
  color: #1a1a1a;
}

.reply-count-btn .icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Reply Button with Toggle State */
.reply-btn {
  background: none;
  border: none;
  color: #65676b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
}

.reply-btn:hover {
  background-color: #f0f2f5;
  color: #1a1a1a;
}

.reply-btn[data-state="hide"] {
  color: #e74c3c;
}

.reply-btn[data-state="hide"]:hover {
  background-color: #ffeaea;
}

/* Reply Form */
.reply-form-container {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid #1877f2;
  animation: slideDown 0.3s ease;
}

/* NEW: Nesting warning */
.nesting-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 15px;
  color: #856404;
}

.reply-form {
  background: transparent;
  box-shadow: none;
  margin-top: 16px;
}

.reply-form .form-group {
  margin-bottom: 12px;
}

.reply-form textarea {
  resize: vertical;
  min-height: 100px;
}

.reply-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

.cancel-reply-btn,
.submit-reply-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-reply-btn {
  background: #f0f2f5;
  color: #65676b;
}

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

.submit-reply-btn {
  background: #f1c40f;
  color:  #fff;
}

.submit-reply-btn:hover {
  background: #f39c12;
}

.submit-reply-btn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

/* NEW: Nested reply container styling based on level */
.replies-container[id*="repliesContainer"] {
  position: relative;
  margin-top: 16px;
}

.replies-container[id*="repliesContainer"]::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #e1e5e9, transparent);
}

/* Nested reply form positioning */
.reply-item .reply-form-container {
  margin-left: 0; /* Reset margin for nested forms */
}

/* Load More Buttons */
.load-more-container,
.load-more-replies-container {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

.load-more-btn,
.load-more-replies-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #fff;
  border: 2px solid #1877f2;
  color: #1877f2;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.load-more-btn:hover,
.load-more-replies-btn:hover {
  background: #1877f2;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.load-more-btn:disabled,
.load-more-replies-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.load-more-replies-btn {
  padding: 8px 16px;
  font-size: 12px;
  margin-left: 30px;
}

/* Spinner Animation */
.spinner {
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

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

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 500px;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
  .comment-form-section,
  .comments-section {
    padding: 15px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .comment-item,
  .reply-item {
    padding: 15px;
  }

  .replies-container {
    margin-left: 15px;
    padding-left: 15px;
  }

  /* Adjust nesting margins for mobile */
  .reply-item[data-nesting-level="1"] {
    margin-left: 10px;
  }

  .reply-item[data-nesting-level="2"] {
    margin-left: 20px;
  }

  .reply-item[data-nesting-level="3"] {
    margin-left: 30px;
  }

  .comment-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .load-more-replies-btn {
    margin-left: 15px;
  }

  .reply-form-actions {
    flex-direction: column;
    gap: 10px;
  }

  .cancel-reply-btn,
  .submit-reply-btn {
    width: 100%;
  }

  .file-preview {
    flex-direction: column;
  }

  .file-item {
    max-width: 100%;
  }

  .attachments-container {
    flex-direction: column;
  }

  .attachment-item {
    max-width: 100%;
  }

  /* .popup-content {
    width: 95%;
    padding: 15px;
  }

  .popup-image {
    max-height: 40vh;
  }

  .popup-info {
    font-size: 13px;
  } */
}

@media (max-width: 480px) {
  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .replies-container {
    margin-left: 10px;
    padding-left: 10px;
  }

  /* Further adjust nesting for very small screens */
  .reply-item[data-nesting-level="1"],
  .reply-item[data-nesting-level="2"],
  .reply-item[data-nesting-level="3"] {
    margin-left: 5px;
  }

  .reply-form-container {
    padding: 15px;
  }

  .comment-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* RTL Support for Arabic/Hebrew */
[dir="rtl"] .replies-container {
  margin-left: 0;
  margin-right: 30px;
  padding-left: 0;
  padding-right: 20px;
  border-left: none;
  border-right: 2px solid #e1e5e9;
}

[dir="rtl"] .reply-form-container {
  border-left: none;
  border-right: 3px solid #1877f2;
}

[dir="rtl"] .load-more-replies-btn {
  margin-left: 0;
  margin-right: 30px;
}

[dir="rtl"] .reply-item[data-nesting-level="1"] {
  margin-left: 0;
  margin-right: 20px;
}

[dir="rtl"] .reply-item[data-nesting-level="2"] {
  margin-left: 0;
  margin-right: 40px;
}

[dir="rtl"] .reply-item[data-nesting-level="3"] {
  margin-left: 0;
  margin-right: 60px;
}

@media (max-width: 768px) {
  [dir="rtl"] .replies-container {
    margin-right: 15px;
    padding-right: 15px;
  }

  [dir="rtl"] .load-more-replies-btn {
    margin-right: 15px;
  }

  [dir="rtl"] .reply-item[data-nesting-level="1"] {
    margin-right: 10px;
  }

  [dir="rtl"] .reply-item[data-nesting-level="2"] {
    margin-right: 20px;
  }

  [dir="rtl"] .reply-item[data-nesting-level="3"] {
    margin-right: 30px;
  }
}

@media (max-width: 480px) {
  [dir="rtl"] .replies-container {
    margin-right: 10px;
    padding-right: 10px;
  }

  [dir="rtl"] .reply-item[data-nesting-level="1"],
  [dir="rtl"] .reply-item[data-nesting-level="2"],
  [dir="rtl"] .reply-item[data-nesting-level="3"] {
    margin-right: 5px;
  }
}

/* CSS Variables for Theme Customization Settings Manager*/
:root {
  --comment-theme-color: #f1c40f;
  --comment-border-radius: 8px;
  --comment-font-family: system-ui, -apple-system, sans-serif;
}

/* Theme Color Applications */
.comment-system {
  font-family: var(--comment-font-family);
}

.submit-btn,
.submit-reply-btn,
.load-more-btn,
.load-more-replies-btn {
  /* background-color: var(--comment-theme-color); */
  
  border-radius: var(--comment-border-radius);
}

.submit-btn:hover,
.submit-reply-btn:hover,
.load-more-btn:hover,
.load-more-replies-btn:hover {
  background-color: color-mix(in srgb, var(--comment-theme-color) 85%, black);
}

.like-btn.liked {
  color: var(--comment-theme-color);
}

.reply-btn:hover {
  color: var(--comment-theme-color);
}

/* Button Styles */
.rounded-buttons .submit-btn,
.rounded-buttons .submit-reply-btn,
.rounded-buttons .load-more-btn,
.rounded-buttons .load-more-replies-btn,
.rounded-buttons .cancel-reply-btn,
.rounded-buttons .reply-btn {
  border-radius: var(--comment-border-radius);
}

.square-buttons .submit-btn,
.square-buttons .submit-reply-btn,
.square-buttons .load-more-btn,
.square-buttons .load-more-replies-btn,
.square-buttons .cancel-reply-btn,
.square-buttons .reply-btn {
  border-radius: 0;
}

/* Input and Textarea Styling */
.comment-system input,
.comment-system textarea {
  border-radius: var(--comment-border-radius);
  font-family: var(--comment-font-family);
}

.comment-system input:focus,
.comment-system textarea:focus {
  border-color: var(--comment-theme-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--comment-theme-color) 20%, transparent);
}

/* Comment Items */
.comment-item,
.reply-item {
  border-radius: var(--comment-border-radius);
}

.pinned-comment {
  border-left: 4px solid var(--comment-theme-color);
}

/* File Upload Styling */
.file-item {
  border-radius: var(--comment-border-radius);
}

/* Notification Styling */
.notification {
  border-radius: var(--comment-border-radius);
}

/* Validation Error Styling */
.validation-errors {
  border-radius: var(--comment-border-radius);
}

/* Responsive Font Scaling */
@media (max-width: 768px) {
  .comment-system {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .comment-system {
    font-size: 13px;
  }
}

/* Validation Error Styles */
.validation-errors {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease;
}

.error-list {
  margin: 0;
}

.error-item {
  color: #c53030;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.error-item:last-child {
  margin-bottom: 0;
}

.error-item:before {
  content: "⚠️";
  flex-shrink: 0;
  margin-top: 1px;
}

/* Field Error Styles */
.field-error {
  color: #c53030;
  font-size: 12px;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: pre-line;
}

.field-error:before {
  content: "⚠️";
  font-size: 10px;
}

/* Input Error State */
input.error,
textarea.error {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 1px #e53e3e !important;
  background-color: #fef5f5;
}

input.error:focus,
textarea.error:focus {
  border-color: #c53030 !important;
  box-shadow: 0 0 0 2px rgba(197, 48, 48, 0.2) !important;
}

/* Character Counter */
.character-counter {
  text-align: right;
  margin-top: 5px;
  font-size: 12px;
  color: #666;
}

.character-counter .over-limit {
  color: #c53030;
  font-weight: 600;
}

/* Checkbox Error State */
input[type="checkbox"].error + label {
  color: #c53030;
}

input[type="checkbox"].error {
  outline: 2px solid #e53e3e;
  outline-offset: 2px;
}

/* Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group:has(.field-error) {
  margin-bottom: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .validation-errors {
    padding: 12px;
    margin-bottom: 15px;
  }

  .error-item {
    font-size: 13px;
  }

  .field-error {
    font-size: 11px;
  }
}

/* Frequency Status Container */
/* Frequency Warning */
.frequency-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding: 8px 12px;
  color: #856404;
  text-align: center;
}

/* Frequency Error (when limit reached) */
.frequency-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 8px 12px;
  color: #721c24;
  text-align: center;
}

.frequency-warning small,
.frequency-error small {
  font-weight: 600;
}

/* Icon for frequency status */
.frequency-warning::before {
  content: "⚠️";
  margin-right: 5px;
}

.frequency-error::before {
  content: "🚫";
  margin-right: 5px;
}

/* Animation for frequency status */
.frequency-status-container {
  transition: all 0.3s ease;
}

.frequency-warning,
.frequency-error {
  animation: slideDown 0.3s ease;
}

/* Blocked Message */
.blocked-message {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 40px 20px;
  margin: 20px 0;
  text-align: center;
}

.blocked-content h3 {
  color: #721c24;
  margin-bottom: 15px;
  font-size: 24px;
}

.blocked-content p {
  color: #721c24;
  margin: 0;
  font-size: 16px;
}

/* Frequency Status Display */
#frequencyStatus {
  margin-bottom: 15px;
}

/* Enhanced form with frequency status */
.comment-form-section {
  position: relative;
}

.comment-form-section .frequency-status {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.1);
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .frequency-status-container {
    margin-bottom: 10px;
  }

  .frequency-warning,
  .frequency-error {
    padding: 6px 10px;
    font-size: 12px;
  }

  .blocked-message {
    padding: 30px 15px;
    margin: 15px 0;
  }

  .blocked-content h3 {
    font-size: 20px;
  }

  .blocked-content p {
    font-size: 14px;
  }

  .comment-form-section .frequency-status {
    position: static;
    margin-bottom: 15px;
    text-align: center;
  }
}

/* Animation for blocked message */
.blocked-message {
  animation: slideDown 0.5s ease;
}

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