/* =========================================================
   COMMENTS - CSS OPTIMIZADO (Bootstrap 3 friendly)
   - Composer moderno
   - Tabs segmentados
   - Encuesta visual + MAYÚSCULAS
   - Resultados encuesta: separación + % compacto
   - Tiempo del comentario abajo derecha (flujo normal)
   - Respuestas chat (flecha izquierda) + degradado (normal/validada)
   - Botón borrar overlay (comentario y respuestas)
========================================================= */


/* =========================
   Layout general
========================= */
.comments{
  width: 100%;
  margin: 14px auto;
}

.comentarios{
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: baseline;
  word-break: break-word;
}

@media (max-width: 620px){
  .comentarios{ flex-direction: column; gap: 12px; }
  .comentario{ width: 100% !important; }
}


/* =========================
   Composer (escribir comentario)
========================= */
.comentar{
  display: flex;
  flex-direction: column;
  position: relative;
  justify-content: space-between;

  border: 1px solid #e9e9e9;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.06);
  overflow: hidden;
}

.comentar #comentario{
  width: 100%;
  height: 110px;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  outline: none;

  padding: 14px 14px 12px;
  font-size: 15px;
  line-height: 1.35;
  color: #676767;
  resize: none;
}

.comentar #comentario::placeholder{ color: #9a9a9a; }
.comentar #comentario:focus::placeholder{ opacity: .5; }

.comment-footer{
  height: auto;
  padding: 10px 12px;
  gap: 10px;

  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.comment-footer > div{
  display: flex;
  gap: 10px;
  align-items: center;
}

.comentar .contador{
  color: #666;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f6f6f6;
}

.contador.maxcaracteres{ color: red; }

/* Botones generales */
button.btn{
  outline: none !important;
  border-radius: 999px !important;
  height: 38px;
  padding: 0 14px;

  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
}

.btn.btn-success{
  box-shadow: 0 8px 18px rgba(92,184,92,.25);
}


/* =========================
   Encuesta (inputs crear encuesta)
========================= */
.encuesta{
  padding: 0 15px;
  display: none;
  position: relative;
}

.encuesta input{
  margin: 7px 0;
  width: 90%;
  font-size: 15px;
}

.addOption{
  position: absolute;
  bottom: 2px;
  left: 90%;
  cursor: pointer;
  opacity: .6;
  font-size: 20px;
}
.addOption:hover, .addOption:active{ opacity: 1; }


/* =========================
   Tabs segmentados
========================= */
.nav.nav-pills.nav-navegacion{
  display: flex;
  gap: 10px;
  background: #f4f4f4;
  padding: 6px;
  border-radius: 14px;
}

.nav.nav-pills.nav-navegacion > li{
  float: none;
  flex: 1;
}

.nav.nav-pills.nav-navegacion > li > a{
  text-align: center;
  border-radius: 12px;
  margin: 0 !important;
  border: 0 !important;
  background: transparent;
  font-weight: 700;
}

.nav.nav-pills.nav-navegacion > li.active > a,
.nav.nav-pills.nav-navegacion > li.active > a:hover,
.nav.nav-pills.nav-navegacion > li.active > a:focus{
  background: #1aa64a;
  color: #fff;
}


/* =========================
   Card de comentario
========================= */
.comentario{
  position: relative;
  width: 49%;
  margin-bottom: 16px;

  border-radius: 16px;
  background: #fff;
  box-shadow: 10px 12px 58px 10px rgba(0,0,0,.08);
  overflow: hidden;
}

/* Texto del comentario */
.comentario > p{
  padding: 12px 14px 30px;
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
}


/* =========================
   Botón borrar overlay (comentario y respuestas)
   HTML requerido:
   <button class="comment-action modcomment" data-id=".."><img ...></button>
========================= */
.comment-action.modcomment{
  position: absolute;
  top: 10px;
  right: 10px;

  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;

  background: rgba(0,0,0,.04);
  box-shadow: none;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: .9;
  cursor: pointer;
}

.comment-action.modcomment:hover{
  opacity: 1;
  background: rgba(0,0,0,.08);
}

.comment-action.modcomment img{
  width: 16px;
  height: 16px;
  display: block;
  opacity: .75;
}


/* =========================
   Encuesta (votación + resultados)
========================= */
.separator{
  position: relative;
  text-align: center;
  margin-top: 0;
  padding: 0 14px;
}

.separator hr{
  border: 0;
  border-top: 1px solid #f0f0f0;
  margin: 0;
  padding: 0;
}

span.vota{
  position: relative;
  top: -14px;

  padding: 6px 10px;
  border: 0;
  font-size: 14px;

  background: #fff;
  color: #777;
  font-weight: bold;

  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

/* Botones votar (antes de votar) */
.votar{
  padding: 0 15px;
}

.votar button{
  background: #fff;
  width: 100%;
  display: block;
  margin: 6px 0;

  border: 1px solid #1aa64a;
  border-radius: 12px;

  padding: 10px 12px;
  font-weight: 700;
}

.votar button:hover, .votar button:focus{ background: #f2fff6; }

.votar > ul, .votar > ul > li{
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Resultados votados: separación + % compacto */
.votar ul li.opt-voted{
  position: relative;
  height: 40px;
  margin: 4px 0;
  font-size: 12px;
}

.opt-voted .barra{
  position: absolute;
  left: 0;
  top: 0;
  height: 40px;
  display: block;

  /* base gris “premium” */
  background: linear-gradient(90deg, #eeeeee 0%, #f7f7f7 100%);
  border-radius: 14px;

  z-index: 1;
}

/* Si el backend pinta inline background, no lo rompemos */
.opt-voted .barra[style*="background"]{
  border-radius: 14px;
}

.opt-voted .opt{
  z-index: 2;
  position: absolute;
  left: 10px;
  right: 10px;
  top: 0;

  line-height: 40px;
  color: #111 !important;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  font-size: 12.5px;
}

/* % compacto (sin “círculos”) */
.opt-voted .opt strong{
  display: inline-block;
  padding: 2px 7px;
  margin-right: 8px;

  border-radius: 999px;
  background: rgba(255,255,255,.85);

  font-weight: 900;
  min-width: 0;
  line-height: 1.2;
}

/* MAYÚSCULAS SIEMPRE (antes y después de votar) */
.votar button,
.opt,
.opt-voted .opt{
  text-transform: uppercase;
  letter-spacing: .35px;
}

@media (max-width: 620px){
  .votar ul li.opt-voted{ height: 38px; margin: 10px 0; }
  .opt-voted .barra{ height: 38px; border-radius: 13px; }
  .opt-voted .opt{ line-height: 38px; font-size: 12px; }
}


/* =========================
   Tiempo del comentario (abajo derecha)
   En flujo normal => debajo de encuesta si existe
========================= */
.time{
  padding: 8px 14px 10px;
  text-align: right;
  display: block;
  color: #848484;
  font-size: 12px;
}

.time .ptime{
  display: inline-block;
  font-size: 12px;
  background: #f5f5f5;
  color: #666;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}


/* =========================
   Caja de responder
========================= */
.respuesta-box{
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #f0f0f0;
}

.respuesta{
  position: relative;
}

.respuesta input{
  font-size: 15px;
  height: 40px;
  border-radius: 12px;
}

.txt-respuesta{ padding-right: 40px; }

.btn-responder{
  background: transparent;
  border: none;
  cursor: pointer;

  position: absolute;
  top: 0;
  right: 0;

  width: 40px;
  height: 40px !important;
  border-radius: 12px;
}

.txt-respuesta:active + .btn-responder,
.txt-respuesta:focus + .btn-responder,
.btn-responder:hover,
.btn-responder:focus{
  color: #66afe9 !important;
}


/* =========================
   Respuestas (chat bubble izquierda)
========================= */
.crespuesta{
  position: relative;
  padding: 12px 44px 10px 14px;
  margin: 5px 0;
  margin-left: 12px;

  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.06);

  /* degradado suave */
  background: linear-gradient(135deg, #fffdf2 0%, #ffffff 70%);
}

/* Flecha izquierda (normal) */
.crespuesta::after{
  content: "";
  position: absolute;
  left: -6px;
  top: 18px;
  width: 12px;
  height: 12px;

  background: #fffdf2; /* coincide con el inicio del degradado */
  border-left: 1px solid rgba(0,0,0,.06);
  border-bottom: 1px solid rgba(0,0,0,.06);

  transform: rotate(45deg);
  z-index: 2;
}

/* Texto respuesta */
.crespuesta > p{
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #111;

  display: flex;
  align-items: center;
  gap: 8px;
}

.crespuesta > p img{
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-block;
}

.crespuesta .time-respuesta{
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(0,0,0,.55);
}

/* Validada: verde suave + flecha del mismo color */
.crespuesta.validada{
  background: #ecfff4;
  border-color: rgba(26,166,74,.18);
}

.crespuesta.validada::after{
  background: #ecfff4;
}

/* Botón borrar dentro de respuesta (más pequeño) */
.crespuesta .comment-action.modcomment{
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
}
.crespuesta .comment-action.modcomment img{
  width: 14px;
  height: 14px;
}

/* Quitar cualquier barra verde antigua */
.crespuesta.validada::before{
  display: none !important;
}

@media (max-width: 620px){
  .respuesta-box{ padding-left: 8px; padding-right: 8px; }
  .crespuesta{ margin-left: 8px; margin-right: 4px; }
}


/* =========================
   Enlaces “ver más”
========================= */
a.ver-mas{
  font-size: 12px;
  margin: 5px 0 0 0;
  color: #999;
}

.ver-mas.nohay{
  cursor: not-allowed;
  text-decoration: none;
}


/* =========================
   Otros
========================= */
.nuevo{ display: none; }
.modcomment{ cursor: pointer; }
.btn.btn-votar img{ width: 19px; }


/* =========================
   MOBILE - Composer en UNA SOLA FILA
========================= */
@media (max-width: 620px){

  .comment-footer{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 10px 12px;
    flex-wrap: nowrap;              /* 🔑 una sola fila */
  }

  /* Todos los botones compactos */
  .comment-footer .btn{
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* AÑADIR ENCUESTA más discreto */
  .comment-footer .btn-primary{
    font-weight: 700;
    padding: 0 12px;
  }

  /* LIMPIAR aún más compacto */
  .comment-footer .btn-default{
    padding: 0 10px;
  }

  /* PUBLICAR ligeramente protagonista */
  .comment-footer .btn-success{
    padding: 0 14px;
  }

  /* Contador como pill pequeño */
  .comment-footer .contador{
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}
