/* ==================== */
/* ESTRUCTURA PRINCIPAL */
/* ==================== */
.comment-card,
.reply-card {
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.5rem 0;
  position: relative;
}

/* ============= */
/* 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: 1rem;
  line-height: 1.5;
  color: #444!important;
}

/* Enlace de respuesta */
.reply-link {
  cursor: pointer;
  font-size: 0.85rem;
  color: #0d6efd;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.reply-link:hover {
  background-color: rgba(13, 109, 253, 0.007);
}

/* 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;
}

.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.85rem;
  cursor: pointer;
}

/* ==================== */
/* SUGERENCIAS DE MENCIONES */
/* ==================== */
#mention-suggestions {
  max-height: 200px;
  overflow-y: auto;
  width: 250px;
  background-color: white;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  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: flex;
  align-items: center;
  gap: 0.5rem;
  color: #0d6efd;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.show-replies-btn:hover {
  background-color: rgba(13, 110, 253, 0.05);
}

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

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

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

.replies-container.show {
  max-height: 5000px; /* Valor suficientemente grande */
}

/* Estilos para los botones de votación */
.vote-buttons {
    margin-top: 8px;
    margin-bottom: 12px;
}
.vote-btn {
    border-radius: 15px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    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;
}

/* ========== COMENTARIOS RESPONSIVOS ========== */



/* Tablet (entre 576px y 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.3rem 0.6rem !important;
  }
}


/* ===== SOLO MÓVIL (0-576px) - EVITAR DESBORDE ===== */
@media (max-width: 575.98px) {
  .comment-card {
    margin-left: -1rem !important;  /* Reduce margen izquierdo */
    padding: 0.5rem !important;       /* Padding más compacto */
  }

  .comment-avatar {
    width: 36px !important;           /* Avatar más pequeño */
    height: 36px !important;
    margin-right: 0.5rem !important; /* Espacio ajustado */
  }

  .card-body {
    padding: 0.6rem 0.3rem !important; /* Menos padding interno */
  }

  .reply-thread {
    padding-left: 0.8rem !important;  /* Sangría reducida */
  }

  .vote-buttons .btn {
    min-width: 24px !important;       /* Botones ultra compactos */
    padding: 0.2rem 0.3rem !important;
  }
}

/* ===== SOLO MÓVIL (0-576px) - EVITA DESBORDE DE TEXTO ===== */
@media (max-width: 575.98px) {
  /* Nombre de usuario */
  .comment-card h5.text-primary {
    font-size: 0.95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    display: inline-block;
  }

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

  /* Contenido del mensaje */
  .comment-card p {
    font-size: 0.85rem !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    line-height: 1.4 !important;
    margin-bottom: 0.5rem !important;
  }

  /* Contenedor principal */
  .card-body {
    padding: 0.8rem 0.5rem !important;
  }

    /* Nombre de usuario */
  .comment-card h5.text-primary {
    font-size: 1.1rem !important;  /* Aumentado de 0.95rem */
    max-width: 150px !important;   /* Más espacio para nombre más grande */
  }

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

  /* Contenido del mensaje */
  .comment-card p {
    font-size: 1rem !important;     /* Aumentado de 0.85rem */
    line-height: 1.5 !important;    /* Más espacio entre líneas */
  }

  /* Botones de votación */
  .vote-buttons .btn {
    font-size: 0.9rem !important;   /* Texto más legible en botones */
  }

}

/* ===== PREVENCIÓN DE DESBORDE EN DESKTOP ===== */
@media (min-width: 576px) {
  /* Nombre de usuario */
  .comment-card h5.text-primary {
    display: inline-block;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  /* Tiempo del comentario */
  .comment-card small.text-muted {
    display: inline-flex;
    vertical-align: middle;
  }

  /* Contenido del comentario */
  .comment-card p {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    max-width: 100%;
    /* Opcional: descomenta si necesitas límite de altura con scroll */
    /* max-height: 200px;
    overflow-y: auto; */
  }
}

/* ===== AJUSTE PARA HORA EN MÓVIL (0-576px) ===== */
@media (max-width: 575.98px) {
  /* Contenedor de usuario y hora */
  .comment-card .d-flex.align-items-center.gap-2.mb-2 {
    flex-wrap: wrap; /* Permite que los elementos se muevan a nueva línea */
    row-gap: 0.3rem; /* Espacio entre elementos cuando se apilan */
  }

  /* Hora del comentario */
  .comment-card small.text-muted {
    order: 1; /* Fuerza posición después del nombre */
    width: 100%; /* Ocupa todo el ancho */
    margin-left: 0 !important; /* Elimina margen izquierdo */
    padding: 0.2rem 0 !important; /* Ajuste de padding vertical */
  }
  
  /* Nombre de usuario */
  .comment-card h5.text-primary {
    margin-right: auto; /* Empuja la hora a nueva línea */
  }

    .comment-card small.text-muted {
    background: #f8f9fa !important;
    border-radius: 12px !important;
    padding: 0.2rem 0.6rem !important;
    display: inline-block !important;
    width: auto !important;
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
  }

  .comment-card .d-flex.align-items-center.gap-2.mb-2 {
    align-items: flex-start !important;
  }
}

/* ===== TIMESTAMP SIEMPRE ABAJO EN MÓVIL ===== */
@media (max-width: 575.98px) {
  /* Contenedor padre */
  .comment-card .d-flex.align-items-center.gap-2.mb-2 {
    display: block !important; /* Cambia a bloque para apilar */
  }

  /* Nombre de usuario */
  .comment-card h5.text-primary {
    display: inline-block;
    margin-bottom: 0.2rem !important;
  }

  /* Tiempo del comentario */
  .comment-card small.text-muted {
    display: block !important;
    width: fit-content !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    padding: 0.2rem 0.6rem !important;
    margin-top: 0.2rem !important;
    margin-left: 0 !important;
  }
}

/* Estilos para el cuadro de texto del formulario de respuesta */
.reply-form textarea.form-control {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.9rem;
    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;
}

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

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

/* Estilos para el botón de "Responder" */
.reply-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #3b82f6 !important;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(59, 130, 246, 0.1);
}

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

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

/* Estilos para el botón de mostrar respuestas */
.show-replies-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 0.85rem;
    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);
}


/* 🔥 TEXTAREA BIEN CHIDO 🔥 */

#commentForm textarea.form-control {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    font-size: 1rem;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #1e293b; /* Texto oscuro legible */
    background: rgba(248, 250, 252, 0.7); /* Fondo semi-transparente (azul muy tenue) */
    border: 2px solid rgba(99, 102, 241, 0.3); /* Borde azul translúcido */
    border-radius: 12px;
    backdrop-filter: blur(4px); /* Efecto vidrio esmerilado (opcional) */
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.03),
        inset 0 1px 2px rgba(255, 255, 255, 0.1); /* Sombras sutiles */
    resize: vertical;
    transition: all 0.3s ease;
}

/* 🌟 EFECTO AL ENFOCAR (CUANDO EL USUARIO CLICKEA) 🌟 */
#commentForm textarea.form-control:focus {
    outline: none;
    border-color: #6366f1; /* Morado/azul vibrante */
    box-shadow: 
        0 2px 6px rgba(99, 102, 241, 0.2), /* Sombra exterior con tono morado */
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(99, 102, 241, 0.1); /* "Glow" sutil */
    background: #f8fafc; /* Fondo ligeramente grisáceo */
}

/* ✨ PLACEHOLDER ESTILIZADO ✨ */
#commentForm textarea.form-control::placeholder {
    color: #94a3b8; /* Gris azulado */
    font-weight: 400;
    opacity: 0.9;
}

/* 💥 BOTÓN BIEN PERRÓN 💥 */
#commentForm .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6); /* Degradado morado/azul */
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1rem;
    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;
}

/* Efecto hover para el botón (aunque dijiste sin hover, esto es un extra) */
#commentForm .btn-primary:hover {
    transform: translateY(-2px); /* Levanta un poco el botón */
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #8b5cf6, #7c3aed); /* Degradado más intenso */
}

/* Icono del botón (opcional) */
#commentForm .btn-primary i {
    font-size: 1.1em;
}