/* Comment System Styles */
* {
  box-sizing: border-box;
  font-family: "DM Sans";
}

.comment_container {
  width: 100%;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  padding: 60px 5%;
  position: relative;
}

.rating-section,
.comment-section {
  /* margin: 20px auto; */
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.comment-section {
  width: 100%;
  max-width: 875px;
}

.rating-section {
  width: 100%;
  max-width: 400px;
  position: sticky;
  top: 0;
}

.rating-section h3,
.comment-section h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.5em;
}

/* Rating Section Styles */
.rating-stats {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.average-rating {
  text-align: center;
  min-width: 120px;
}

.avg-score {
  font-size: 2.5em;
  font-weight: bold;
  color: #ff6b35;
  display: block;
}

.stars-display {
  margin: 10px 0;
  color: #ffc107;
  font-size: 1.2em;
}

.total-ratings {
  color: #666;
  font-size: 0.9em;
}

.rating-breakdown {
  flex: 1;
}

.rating-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.rating-bar-item span:first-child {
  width: 15px;
  font-weight: bold;
}

.rating-bar-item i {
  color: #ffc107;
  width: 15px;
}

.rating-bar {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.rating-fill {
  height: 100%;
  background: #ffc107;
  transition: width 0.3s ease;
}

.rating-count {
  min-width: 35px;
  text-align: right;
  font-size: 0.9em;
  color: #666;
}

.rate-button {
  background: #ff6b35;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.3s ease;
}

.rate-button:hover {
  background: #e55a2b;
}

.rating-form {
  margin-top: 15px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 5px;
}

.rating-stars {
  margin: 15px 0;
  font-size: 1.2em;
}

.rating-stars i {
  cursor: pointer;
  color: #ddd;
  transition: color 0.2s ease;
  margin-right: 5px;
}

.rating-stars i:hover,
.rating-stars i.active {
  color: #ffc107;
}

.rating-btn {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.submit-rating,
.cancel-rating {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.submit-rating {
  background: #28a745;
  color: white;
}

.cancel-rating {
  background: #6c757d;
  color: white;
}

/* Comment Section Styles */
.comment-count {
  color: #666;
  font-size: 0.9em;
}

.comment-form {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.user-avatar {
  flex-shrink: 0;
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-input-container {
  flex: 1;
}

.comment-input-container textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 12px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  font-size: 14px;
}

.comment-input-container textarea:focus {
  outline: none;
  border-color: #ff6b35;
}

.comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.char-count {
  font-size: 0.85em;
  color: #666;
}

.comment-btn {
  background: #ff6b35;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.3s ease;
}

.comment-btn:hover:not(:disabled) {
  background: #e55a2b;
}

.comment-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.no-comments {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.no-comments i {
  font-size: 3em;
  margin-bottom: 15px;
  color: #ddd;
}

/* Comment Item Styles */
.comment-item {
  margin-bottom: 20px;
  padding: 15px 0;
  border-bottom: 1px solid #f0f0f0;
}

.comment-header {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.comment-avatar img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-meta {
  flex: 1;
}

.comment-author {
  font-weight: bold;
  color: #333;
  margin-bottom: 2px;
}

.comment-time {
  font-size: 0.8em;
  color: #666;
}

.comment-content {
  margin: 10px 0;
  line-height: 1.5;
  color: #2f5496;
}

.comment-actions-bar {
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 0.9em;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #f5f5f5;
  color: #333;
}

.action-btn.active {
  color: #ff6b35;
}

.action-btn.like.active {
  color: #28a745;
}

.action-btn.dislike.active {
  color: #dc3545;
}

.replies-container {
  margin-left: 47px;
  margin-top: 15px;
  /* border-left: 2px solid #f0f0f0; */
  padding-left: 15px;
}

.reply-item {
  margin-bottom: 30px;
  padding: 10px 15px 10px;
  border-left: 2px solid #006bb7;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
}

.toggle-replies {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.toggle-replies:hover {
  color: #333;
}

.toggle-replies i {
  transition: transform 0.2s ease;
}

.toggle-replies.expanded i {
  transform: rotate(90deg);
}

.reply-form {
  margin-top: 15px;
  display: none;
}

.reply-form.active {
  display: block;
}

.reply-input {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.reply-input textarea {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 12px;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  font-size: 14px;
}

.reply-input textarea:focus {
  outline: none;
  border-color: #ff6b35;
}

.reply-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.reply-submit,
.reply-cancel {
  padding: 6px 12px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.85em;
}

.reply-submit {
  background: #ff6b35;
  color: white;
}

.reply-cancel {
  background: #6c757d;
  color: white;
}

.mention {
  color: #2f5496;
  font-weight: bold;
}

/* Loading States */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ff6b35;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.comment-loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* Rate Limit Message */
.rate-limit-message {
  background: #fff3cd;
  color: #856404;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
  border: 1px solid #ffeaa7;
}

/* Error Message */
.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
  border: 1px solid #f5c6cb;
}

/* Success Message */
.success-message {
  background: #d4edda;
  color: #155724;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
  border: 1px solid #c3e6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
  .comment_container {
    flex-direction: column;
  }
  .rating-section {
    position: relative;
  }

  .rating-section,
  .comment-section {
    /* margin: 10px; */
    padding: 15px;
  }

  .rating-stats {
    /* flex-direction: column; */
    gap: 20px;
  }

  .comment-form {
    gap: 10px;
  }

  .replies-container {
    margin-left: 20px;
    padding-left: 10px;
  }

  .comment-actions-bar {
    flex-wrap: wrap;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .rating-breakdown {
    font-size: 0.9em;
  }

  .rating-bar-item {
    margin-bottom: 6px;
  }

  .comment-actions-bar {
    font-size: 0.8em;
  }

  .action-btn {
    padding: 3px 6px;
  }
}

@media (max-width: 350px) {
  .rating-stats {
    flex-direction: column;
  }
  .average-rating {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .rating-breakdown {
    width: 100%;
  }
  .rating-stars {
    font-size: 1.1em;
  }
  .comment-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
