/* ==================== */
/* ESTRUCTURA PRINCIPAL */
/* ==================== */
.comment-card,
.reply-card {
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.5rem 0;
  position: relative;
  font-size: 0.85rem;
  /* base más pequeña */
}

/* ============= */
/* COMPONENTES */
/* ============= */

/* Asegura consistencia en todos los comentarios */
.comment-avatar {
  width: 80px !important;
  height: 80px !important;
  object-fit: cover;
  border-radius: 50%;
  margin-right: 6px;
  margin-left: 12px;
  margin-top: 12px;
}

.comment-content {
  font-size: 0.85rem;
  line-height: 1.4;
  color: #444 !important;
}

/* Usuario */
.comment-card h5.text-primary {
  font-size: 0.9rem !important;
  font-weight: 600;
}

/* Tiempo */
.comment-card small.text-muted {
  font-size: 0.7rem !important;
}

/* Texto del comentario */
.comment-card p {
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
  color: #495057;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Mención de usuario */
.mention {
  color: #4e95ff;
  font-weight: 500;
}

/* ==================== */
/* FORMULARIO DE RESPUESTA */
/* ==================== */
.reply-form {
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

.reply-form textarea {
  width: 100%;
  min-height: 80px;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
  resize: vertical;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.reply-form textarea:focus {
  outline: none;
  border-bottom-color: rgba(13, 110, 253, 0.3);
}

.reply-form button {
  background: transparent;
  color: #0d6efd;
  border: none;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Cuadro de texto (estilo enriquecido) */
.reply-form textarea.form-control {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s;
  background-color: #f9fafb;
}

.reply-form textarea.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: #fff;
  outline: none;
}

/* Botón enviar de la reply-form */
.reply-form .btn-primary {
  background-color: #3b82f6;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.reply-form .btn-primary:hover {
  background-color: #2563eb;
}

/* ====== ENLACE "RESPONDER" UNIFICADO ====== */
.reply-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #3b82f6 !important;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(59, 130, 246, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.reply-link:hover {
  background-color: rgba(59, 130, 246, 0.2);
  text-decoration: none !important;
}

.reply-link i {
  font-size: 0.85rem;
}

/* ==================== */
/* SUGERENCIAS DE MENCIONES */
/* ==================== */
#mention-suggestions {
  max-height: 200px;
  overflow-y: auto;
  width: 250px;
  background-color: white;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1050;
}

#mention-suggestions li {
  cursor: pointer;
  padding: 0.4rem 0.75rem;
}

#mention-suggestions li:hover,
#mention-suggestions li.active {
  background-color: #f0f0f0;
  font-weight: 500;
}

/* ==================== */
/* BOTÓN DESPLEGABLE */
/* ==================== */
.show-replies-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
  font-size: 0.8rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.show-replies-btn:hover {
  color: #3b82f6;
  background-color: #f3f4f6;
}

.show-replies-btn i {
  transition: transform 0.2s;
}

.show-replies-btn.collapsed i {
  transform: rotate(-90deg);
}

/* Contenedor de respuestas */
.replies-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.replies-container.show {
  max-height: 5000px;
}

/* Estilos para los botones de votación */
.vote-buttons {
  margin-top: 6px;
  margin-bottom: 10px;
}

.vote-btn {
  border-radius: 15px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.vote-btn.active {
  transform: scale(1.05);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.like-btn.active {
  background-color: rgba(0, 123, 255, 0.1);
  border-color: #007bff;
  color: #007bff;
}

.dislike-btn.active {
  background-color: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
  color: #dc3545;
}

.vote-btn:disabled {
  opacity: 0.6;
}

/* ===== SOLO MÓVIL (0-576px) ===== */
@media (max-width: 575.98px) {
  .comment-card {
    margin-left: -1rem !important;
    padding: 0.5rem !important;
  }

  .comment-avatar {
    width: 36px !important;
    height: 36px !important;
    margin-right: 0.5rem !important;
  }

  .card-body {
    padding: 0.8rem 0.5rem !important;
  }

  .reply-thread {
    padding-left: 0.8rem !important;
  }

  .vote-buttons .btn {
    min-width: 24px !important;
    padding: 0.2rem 0.3rem !important;
    font-size: 0.75rem !important;
  }

  .comment-card h5.text-primary {
    font-size: 0.85rem !important;
    max-width: 150px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem !important;
  }

  .comment-card small.text-muted {
    font-size: 0.65rem !important;
    display: block !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    padding: 0.2rem 0.6rem !important;
    margin-top: 0.2rem !important;
    margin-left: 0 !important;
  }

  .comment-card p {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    margin-bottom: 0.5rem !important;
  }
}

/* ===== Tablet (576px–768px) ===== */
@media (min-width: 576px) and (max-width: 767.98px) {
  .comment-avatar {
    width: 45px !important;
    height: 45px !important;
  }

  .card-body {
    padding: 1rem !important;
  }

  .vote-buttons .btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.8rem !important;
  }
}

/* ===== Desktop (≥576px) ===== */
@media (min-width: 576px) {
  .comment-card h5.text-primary {
    max-width: 200px;
    font-size: 0.9rem !important;
  }

  .comment-card small.text-muted {
    font-size: 0.7rem !important;
  }

  .comment-card p {
    font-size: 0.85rem !important;
  }
}

/* ====== TEXTAREA Y BOTÓN (form global específico) ====== */
#commentForm textarea.form-control {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  font-size: 0.9rem;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: #1e293b;
  background: rgba(248, 250, 252, 0.7);
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(255, 255, 255, 0.1);
  resize: vertical;
  transition: all 0.3s ease;
}

#commentForm textarea.form-control:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2), inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: #f8fafc;
}

#commentForm textarea.form-control::placeholder {
  color: #94a3b8;
  font-weight: 400;
  opacity: 0.9;
}

#commentForm .btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#commentForm .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

#commentForm .btn-primary i {
  font-size: 1em;
}