/* ========================================
   SISTEMA DE COMENTARIOS - DOBYT
   ======================================== */

.comments-section {
  margin-top: 20px;
  padding: 0;
}

/* --- Header --- */
.comments-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e8e8e8;
}

.comments-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  font-family: inherit;
}

.comments-badge {
  background: linear-gradient(135deg, #4A90D9, #357ABD);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  min-width: 28px;
  text-align: center;
  line-height: 1.5;
}

/* --- Formulario --- */
.comment-form-card {
  background: #f8f9fb;
  border: 1px solid #e2e6ea;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  transition: box-shadow 0.3s ease;
}

.comment-form-card:focus-within {
  box-shadow: 0 4px 20px rgba(74, 144, 217, 0.12);
  border-color: #c5d5ea;
}

.comment-form-card .form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.comment-form-card .form-header .avatar-form {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.comment-form-card .form-header .user-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.comment-form-card textarea {
  width: 100%;
  border: 1px solid #dde1e6;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  color: #333;
  line-height: 1.5;
}

.comment-form-card textarea:focus {
  outline: none;
  border-color: #4A90D9;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.comment-form-card textarea::placeholder {
  color: #9ca3af;
}

.comment-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.comment-form-footer .char-count {
  font-size: 12px;
  color: #9ca3af;
}

.comment-form-footer .char-count.warning {
  color: #E74C3C;
}

.btn-publicar {
  background: linear-gradient(135deg, #4A90D9, #357ABD);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

.btn-publicar:hover {
  background: linear-gradient(135deg, #357ABD, #2868A0);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.btn-publicar:active {
  transform: translateY(0);
}

.btn-publicar:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Login CTA --- */
.comments-login-cta {
  background: linear-gradient(135deg, #f0f4f8, #e8edf2);
  border: 1px dashed #c5d0db;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
  text-align: center;
}

.comments-login-cta p {
  margin: 0 0 12px;
  font-size: 15px;
  color: #555;
}

.comments-login-cta a {
  display: inline-block;
  background: linear-gradient(135deg, #4A90D9, #357ABD);
  color: #fff;
  text-decoration: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.25s ease;
}

.comments-login-cta a:hover {
  background: linear-gradient(135deg, #357ABD, #2868A0);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
  color: #fff;
  text-decoration: none;
}

/* --- Lista de comentarios --- */
.comments-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* --- Comentario individual --- */
.comment-card {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  animation: fadeInComment 0.35s ease;
}

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

@keyframes fadeInComment {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Avatar --- */
.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- Cuerpo --- */
.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 700;
  font-size: 14px;
  color: #1a1a2e;
}

.comment-time {
  font-size: 12px;
  color: #9ca3af;
}

.comment-text {
  font-size: 14px;
  line-height: 1.6;
  color: #444;
  margin-bottom: 6px;
  word-wrap: break-word;
}

/* --- Acciones --- */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comment-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #888;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}

.comment-actions button:hover {
  background: #f0f4f8;
  color: #4A90D9;
}

.comment-actions button.active-like {
  color: #4A90D9;
  background: rgba(74, 144, 217, 0.08);
}

.comment-actions button.active-dislike {
  color: #E74C3C;
  background: rgba(231, 76, 60, 0.08);
}

.comment-actions button i {
  font-size: 13px;
}

.comment-actions .btn-denunciar:hover {
  color: #E74C3C;
  background: rgba(231, 76, 60, 0.06);
}

/* --- Respuestas (thread) --- */
.comment-replies {
  margin-top: 4px;
  padding-left: 20px;
  border-left: 2px solid #e8ecf0;
  margin-left: 0;
}

.comment-replies .comment-card {
  padding: 8px 0;
}

.comment-replies .comment-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

/* --- Reply form inline --- */
.reply-form-inline {
  margin-top: 10px;
  padding: 12px;
  background: #f8f9fb;
  border-radius: 8px;
  border: 1px solid #e8ecf0;
  animation: fadeInComment 0.25s ease;
}

.reply-form-inline textarea {
  width: 100%;
  border: 1px solid #dde1e6;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 60px;
  max-height: 120px;
  background: #fff;
  color: #333;
  line-height: 1.5;
}

.reply-form-inline textarea:focus {
  outline: none;
  border-color: #4A90D9;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.12);
}

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

.reply-form-actions .btn-cancelar-reply {
  background: none;
  border: 1px solid #dde1e6;
  color: #666;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.reply-form-actions .btn-cancelar-reply:hover {
  background: #f0f0f0;
}

.reply-form-actions .btn-publicar-reply {
  background: linear-gradient(135deg, #4A90D9, #357ABD);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.reply-form-actions .btn-publicar-reply:hover {
  background: linear-gradient(135deg, #357ABD, #2868A0);
}

/* --- Estado vacío --- */
.comments-empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

.comments-empty i {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
  color: #d1d5db;
}

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

/* --- Loading --- */
.comments-loading {
  text-align: center;
  padding: 30px;
  color: #9ca3af;
}

.comments-loading .spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #e8ecf0;
  border-top-color: #4A90D9;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* --- Toast/notification --- */
.comment-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: slideInToast 0.3s ease;
  max-width: 320px;
}

.comment-toast.error {
  background: #E74C3C;
}

.comment-toast.success {
  background: #2ECC71;
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Disclaimer --- */
.comments-disclaimer {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 16px;
  line-height: 1.5;
  padding: 0 4px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .comment-form-card {
    padding: 16px;
  }

  .comment-card {
    gap: 10px;
    padding: 14px 0;
  }

  .comment-avatar {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .comment-replies {
    padding-left: 14px;
  }

  .comment-actions button {
    padding: 4px 8px;
    font-size: 11px;
  }

  .comments-header h3 {
    font-size: 18px;
  }

  .comment-toast {
    left: 20px;
    right: 20px;
    max-width: none;
  }
}

/* --- Modal --- */
.comment-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.comment-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.comment-modal {
  background: #fff;
  width: 100%;
  max-width: 400px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.comment-modal-overlay.active .comment-modal {
  transform: translateY(0);
}

.comment-modal-header {
  padding: 20px 24px;
  background: #f8f9fb;
  border-bottom: 1px solid #eef2f6;
  display: flex;
  align-items: center;
  gap: 12px;
}

.comment-modal-header i {
  color: #E74C3C;
  font-size: 20px;
}

.comment-modal-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

.comment-modal-body {
  padding: 24px;
  font-size: 15px;
  color: #444;
  line-height: 1.6;
}

.comment-modal-footer {
  padding: 16px 24px;
  background: #f8f9fb;
  border-top: 1px solid #eef2f6;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-modal {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.btn-modal-cancel {
  background: #eef2f6;
  color: #666;
}

.btn-modal-cancel:hover {
  background: #e2e8f0;
}

.btn-modal-confirm {
  background: #E74C3C;
  color: #fff;
}

.btn-modal-confirm:hover {
  background: #d63031;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* --- Nuevos Estilos para Avatares con Imagen --- */
.img-avatar-form {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e2e6ea;
}

.comment-avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comment-replies .comment-avatar-img {
  width: 34px;
  height: 34px;
}
