/* Comments Modal Styles */
.comments-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1001;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.comments-modal-content {
  background: var(--bg-primary);
  border-radius: 16px;
  width: 95%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  max-height: 80vh;
  overflow-y: auto;
}

.comments-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.comments-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.comments-section {
  margin-top: 20px;
  border-radius: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.comments-list {
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.comments-form {
  padding: 20px;
  background: var(--bg-primary);
}

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

#comment-input {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin-bottom: 8px;
}

#comment-input:focus {
  outline: none;
  border-color: var(--forest-green);
  box-shadow: 0 0 0 3px rgba(107, 155, 122, 0.1);
}

.submit-comment-btn {
  background: var(--forest-green);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  font-size: 14px;
  font-weight: 500;
}

.submit-comment-btn:hover:not(:disabled) {
  background: var(--sage-green);
}

.submit-comment-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.comment-char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.comment-char-count.warning {
  color: var(--warning-orange);
}

.comment-char-count.error {
  color: var(--error-red);
}

/* Empty comments state */
.comments-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.comments-empty i {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.comments-empty p {
  margin: 0;
  font-size: 14px;
}

/* Loading state */
.comments-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.comments-loading i {
  font-size: 24px;
  animation: spin 1s linear infinite;
}

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

/* Nested Comment Styles */
.comment-root {
  margin-bottom: 16px;
}

.comment-reply {
  margin-left: 20px;
  margin-bottom: 12px;
  border-left: 2px solid var(--border-light);
  padding-left: 16px;
  position: relative;
}

.comment-reply::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-light);
}

.comment-depth-1 {
  border-left-color: var(--forest-green);
}

.comment-depth-1::before {
  background: var(--forest-green);
}

.comment-depth-2 {
  border-left-color: var(--sage-green);
}

.comment-depth-2::before {
  background: var(--sage-green);
}

.comment-depth-3 {
  border-left-color: var(--warning-orange);
}

.comment-depth-3::before {
  background: var(--warning-orange);
}

/* Comment Actions */
.comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comment-drop-container {
  display: flex;
  align-items: center;
}

.comment-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

/* Reply Form Styles */
.reply-form-container {
  margin-top: 12px;
  padding-left: 0; /* Reset for different contexts */
}

.reply-char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  transition: color 0.3s ease;
}

.reply-char-count.warning {
  color: var(--warning-orange);
}

.reply-char-count.error {
  color: var(--error-red);
}

.comment-thread .reply-form-container {
  padding-left: 52px; /* Align with comment text in threads */
}

.comment-parent .reply-form-container {
  padding-left: 0; /* No extra padding for parent comments */
}

.reply-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
}

.reply-input {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.reply-input:focus {
  outline: none;
  border-color: var(--forest-green);
  box-shadow: 0 0 0 2px rgba(107, 155, 122, 0.1);
}

.reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.submit-reply-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.submit-reply-btn {
  background: var(--forest-green);
  border: 1px solid var(--forest-green);
  color: white;
}

.submit-reply-btn:hover:not(:disabled) {
  background: var(--sage-green);
  border-color: var(--sage-green);
}

.submit-reply-btn:disabled {
  background: var(--bg-tertiary);
  border-color: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.submit-reply-btn i {
  font-size: 10px;
}

/* Comment Thread Container */
.comment-thread {
  margin-bottom: 16px;
}

.comment-thread .comment-replies {
  margin-bottom: 8px;
}

/* Parent Comment Styling */
.comment-parent {
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
  margin-top: 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
}

/* Comment Replies Container */
.comment-replies {
  margin-top: 8px;
}

.comment-replies .comment-reply {
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Success Message */
.success-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--success-green);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 1002;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Cleaned up comment layout styles */
.comment-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  margin: 0;
  background-color: transparent;
  position: relative;
}

.comment-item:hover {
  background-color: var(--bg-secondary);
  border-bottom-color: var(--border-medium);
  margin: 0;
}

.comment-item:focus-within {
  background-color: var(--bg-secondary);
  border-bottom-color: var(--border-medium);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-item:last-child:hover {
  border-bottom: none;
  margin: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 12px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

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

.comment-user-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-username {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  margin: 0;
}

.comment-date {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0;
}

.comment-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px 44px; /* 32px avatar + 12px gap */
  word-wrap: break-word;
  padding-left: 0;
}


/* Parent Page Button */
.parent-page-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  height: auto;
  min-height: 24px;
  transform: translateY(0);
}

.parent-page-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--forest-green);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.parent-page-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition-duration: 0.1s;
}

.parent-page-btn i.fa-external-link {
  font-size: 10px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.parent-page-btn:hover i.fa-external-link {
  opacity: 1;
}

.parent-page-btn span {
  white-space: nowrap;
}

/* Comment Drop Button */
.drop-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  height: auto;
  min-height: 24px;
  transform: translateY(0);
}

.drop-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--forest-green);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.drop-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition-duration: 0.1s;
}

.drop-btn.active {
  background: rgba(107, 155, 122, 0.1);
  border-color: var(--forest-green);
  color: var(--forest-green);
}

.drop-btn.active:hover {
  background: rgba(107, 155, 122, 0.15);
  color: var(--sage-green);
}

.drop-icon {
  font-size: 12px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.drop-btn:hover .drop-icon {
  opacity: 1;
}

.drop-count {
  font-weight: 600;
  transition: color 0.3s ease;
}

.drop-btn.active .drop-count {
  color: var(--forest-green);
}

.drop-btn.active:hover .drop-count {
  color: var(--sage-green);
}

/* Single Comment View */
.single-comment-view {
  padding: 20px;
  background: var(--bg-primary);
}

.single-comment-view h3 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.single-comment-container {
  min-height: 100px;
}


/* Threaded Comment Layout */
.comment-thread {
  margin-bottom: 16px;
}

.comment-thread .comment-reply {
  margin-left: 20px;
  margin-bottom: 12px;
  border-left: 2px solid var(--border-light);
  padding-left: 16px;
  position: relative;
}

.comment-thread .comment-reply::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-light);
}

.comment-thread .comment-depth-1 {
  border-left-color: var(--forest-green);
}

.comment-thread .comment-depth-1::before {
  background: var(--forest-green);
}

.comment-thread .comment-depth-2 {
  border-left-color: var(--sage-green);
}

.comment-thread .comment-depth-2::before {
  background: var(--sage-green);
}


/* Responsive adjustments */
@media (max-width: 480px) {
  .comments-section {
    margin-top: 15px;
    border-radius: 12px;
  }

  .comment-action-buttons {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .comment-drop-container {
    margin-bottom: 6px;
  }

  .parent-page-btn {
    padding: 4px 8px;
    font-size: 10px;
  }

  .drop-btn {
    padding: 3px 8px;
    font-size: 11px;
  }



}
